Sandstorm
2008-12-07 22:31:32
Sandstorm
What is the meaning to life?
To be the best you can be, and hopefully fulfill your dreams.
Where you Referred to SRL? If yes, by whom?
No
Programming Knowledge
No other languages but SCAR. Contemplating learning Delphi though.
Other Communitys
M.O.D., My Clans forum, HoloHYDRA
How Long have You Played Runescape?
6~ years.
Are you affilated in anyway with Jagex LTD?
No
Please write down a paragraph about Yourself.
I'm hesitant to post this, because I know some people still don't like me all that much (with good reason as well), but Camo Kyle has backed me up in my decision to post this, and I trust his judgement, as he is a good friend.
I realize that I've made some bad choices in the past, and because of those choices, I know I probably won't get anywhere near the same welcome as I would have if I chose to do things differently. Despite this, I hope you guys will at least listen before passing judgment on me.
I know I used to be an immature little shit (sorry if the language isn't allowed), as well as getting pissed off at just about everything bad people said about me. Because of this, I've been trying ever since I realized this to turn it around, and I think I've been doing pretty well. I still do mess around and throw barbed comments at people, and I do get exasperated sometimes, but I haven't done anything like this in a while.
Anyways, enough of the soppy stuff. Time to do what this area asks for. I've been scripting for around a year and a half, with a 6-8 month break. Despite that, I believe I have improved a lot in this time, and I do thoroughly enjoy scripting when I'm up to it. I like to think I'm decently advanced in scar, but that could just be my ego talking.
Sorry for the five paragraph essay, but I had a bunch of stuff I wanted to say. If you read this far, thank you for taking the time to read it.
~Sandstorm
P.S. - There's no box to answer the meaning of life question :P.
Please Post a Sample of your Work. Only SCAR Scripts Accepted.
{.Script Info:
# ScriptName = Sandstorm's Auto Dueler
# Author = Sandstorm
# Description = Auto accepts and waits until duel is over
# Version = 1.4
# Date = Dec, 17th, 2007 (initial release, remake: November 29, 2008)
# Comments = Err... None.
/Script Info
Credits:
Camo Kyle for doing just about everything that we could think
of to help. He's spent much of his free time in the past few weeks
helping me, and I don't think I could have made this script function as
well as it does without him helping me and commenting on what I could do
to make it better.
N1ke! for his UseSpecial function.
Narcle for his SpecialPercent function.
Thanks to Floor66 for his UpdateScript function; I edited it a bit.}
Program DuelTrainer;
{.include SRL/SRL.scar}
Const
AllowArmorOff = False; //Allow other people to turn armor off?
AllowRuleChange = False; //Allow other people to turn on/off rules?
Multiplayer = False; //Use more then one player? IMPORTANT TO FILL OUT.
Lag = False; //Do you lag? Increases waittimes if so.
AddToWaits = 1500; //How much to add to the waits, if Lag = true.
SRLStatsID = ''; // Your stats id
SRLStatsPass = ''; // Your stats password
CurrentVersion = '1.4'; // DO NOT TOUCH THIS!
Var
x, y, wins, lost, duels, marking, lagwait, denied, dtm, duels2, CurrentDuels, CurrentWins, CurrentLosses, Currentdenied: Integer;
First : Boolean;
procedure DeclarePlayers;
begin
HowManyPlayers :=1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //username
Players[0].Pass := ''; //password
Players[0].Nick := ''; //3-4 letters from your username
Players[0].Active := True; //Use this character or not?
Players[0].integers[0]:=10; //Duels before switching
Players[0].integers[1]:=20; //How much your special attack takes
Players[0].booleans[0]:=True; //Use special attack?
End;
Procedure ScriptTerminate;
Begin
Disguise('Won: ' + IntToStr(wins) + ' Lost: ' + IntToStr(lost));
End;
Function ArmorOff : Boolean;
Begin
Result := FindColorTolerance(x, y, 114, 71, 55, 251, 259, 5);
End;
Function Challenge : Boolean;
Begin
DTM := DTMFromString('78DA637CCCC0C0709C0105FC9F210FA619A17' +
'CC6B7986A6000AEE635903843C09C4740E22CAA1A4F071354358A' +
'40D64954351E76C6286A0038C70C9C');
Result := FindDtm(DTM, x, y, MSX1, MSY1, MSX2, MSY2);
FreeDtm(dtm);
End;
Function FindTextSand(Text: string; Chars, x1, y1, x2, y2: Integer): Boolean; Forward;
Function Duel : Boolean;
Begin
Result := FindTextSand('duel with you (f', SmallChars, MSX1, MSY1, MSX2, MSY2);
End;
Function DuelScreen1 : Boolean;
Begin
DTM := DTMFromString('78DA63BCC7C8C0E005C4C8E00C84828932BE0' +
'5B23C08A8390B6479A2A9614055030065680518');
Result := FindDtm(DTM, x, y, MSX1, MSY1, 228, 297);
FreeDtm(dtm);
End;
Function DuelScreen2 : Boolean;
Begin
DTM := DTMFromString('78DA63BCC7C8C0E005C4C8E00C84828932BE0' +
'5B23C08A8390B6479A2A9614055030065680518');
Result := FindDtm(DTM, x, y, 162, 288, MSX2, MSY2);
FreeDtm(dtm);
End;
Function Accept : Boolean;
Begin
Result := FindText(x, y, 'aiting for other', SmallChars, MSX1, MSY1, MSX2, MSY2);
End;
Function Accept2 : Boolean;
Begin
Result := FindText(x, y, 'aiting for other', SmallChars, MSX1, MSY1, MSX2, MSY2);
End;
Function Fighting : Boolean;
Var
I : Integer;
ColorsToUse : Array of Integer;
Begin
wait(100 + random(500));
ColorsToUse := [8946705, 6382604, 9205778, 9405202, 8482576, 8944913, 6840077, 8422416, 8882961, 9339410, 9142033];
For I:=0 To GetArrayLength(ColorsToUse)-1 Do
Begin
wait(100 + random(500));
Result := Not FindColorTolerance(x, y, ColorsToUse[i], MMX1, MMY1, MMX2, MMY2, 3) And Not FindColorTolerance(x, y, 244, MMX1, MMY1, MMX2, MMY2, 15) And Not FindSymbol(x, y, 'altar') and Not FindSymbol(x, y, 'minigame') and not FindSymbol(x, y, 'bank') and not FindSymbol(x, y, 'minigame');
wait(100 + random(500));
If Not Result Then
Break;
End;
End;
Function Changes : Boolean;
Begin
Result := FindColorTolerance(x, y, 665, 269, 54, 314, 247, 5);
End;
Function Won : Boolean;
Begin
DTM := DTMFromString('78DA636C62646090056264D000A160A28C738' +
'02C3922D4281350D30C6429E15703007FC604CE');
Result := FindDtm(DTM, x, y, MSX1, MSY1, MSX2, MSY2);
FreeDtm(dtm);
End;
Procedure SandWait(Time : Integer; Condition : Boolean);
Var
TimeMark : Integer;
Begin
MarkTime(TimeMark);
Repeat
Begin
If Condition Then
Exit
Else
Wait(1);
End;
Until(TimeFromMark(TimeMark) >= Time)
End;
Procedure Part2; Forward;
Procedure Part4; Forward;
Procedure FunDuel;
Var
DuelMsg : String;
Begin
If DuelScreen1 Then
Part2;
If Fighting Then
Part4;
Case random(6) Of
0 : DuelMsg:= ('funning all');
1 : DuelMsg:= ('fun dueling');
2 : DuelMsg:= ('funning everyone');
3 : DuelMsg:= ('dueling for fun');
4 : DuelMsg:= ('funning');
5 : DuelMsg:= ('funning anyone');
End;
TypeSend(AddMistakes(DuelMsg, 30));
wait(100 + random(500))
End;
function SpecialPercent: integer;
var
z: Integer;
TPA: TPointArray;
begin
GameTab(1);
z := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsTolerance(TPA, 2985515, 572, 427, 712, 428, 80);
ColorToleranceSpeed(z);
result := Round(GetArrayLength(TPA) / 283.0 * 100.0);
end;
Function SpecialActive : Boolean;
Begin
Result := FindColor(x, y, 65535, 571, 413, 716, 429);
End;
Function CheckVers : Boolean;
Begin
Result := Between('<p>', '</p>', GetPage('http://lalalacheckvers.110mb.com/CheckVersion.txt')) = CurrentVersion;
End;
Procedure ProgressReporting;
Begin
ClearDebug;
Duels := Wins + Lost;
CurrentWins := Wins - CurrentWins;
ReportVars[0] := CurrentWins;
CurrentLosses := Lost - CurrentLosses;
ReportVars[1] := CurrentLosses;
CurrentDuels := Duels - CurrentDuels;
ReportVars[2] := CurrentDuels;
Currentdenied := Denied - CurrentDenied;
ReportVars[3] := CurrentDenied;
WriteLn('You won: ' + IntToStr(Wins) + ' duels.');
WriteLn('You lost: ' + IntToStr(Lost) + ' duels.');
WriteLn('You have dueled: ' + IntToStr(Duels) + ' times.');
WriteLn('You have denied ' + IntToStr(Denied) + ' duels');
WriteLn('The script has been running for: ' + TimeRunning);
WriteLn('Thanks for using the Duel Arena Trainer by Sandstorm!');
SRLRandomsReport;
Marktime(Marking);
If First Then
First := False;
SetTimeOut(300000, 'ProgressReporting');
End;
Function UseSpecial(PowerNeed: Integer):Boolean;
begin
Gametab(1);
If not SpecialActive Then
If SpecialPercent >= PowerNeed then
begin
MouseBox(574, 417, 710, 426, 1);
Result := True;
end;
end;
function FindTextSand(Text: string; Chars, x1, y1, x2, y2: Integer): Boolean;
var
Mask, w, h, tx, ty: Integer;
begin
try
Mask:= CreateBitmapMaskFromText(Text, Chars);
wait(100 + random(500));
except
srl_Warn('ClickText', 'Invalid Character Names', warn_AllVersions);
Exit;
end;
Result:= FindBitmapMaskTolerance(Mask, tx, ty, x1, y1, x2, 502, 10, 10);
wait(100 + random(500));
GetBitmapSize(Mask, W, H);
wait(00 + random(500));
FreeBitmap(Mask);
wait(100 + random(500));
end;
Procedure Part4;
Begin
While Accept2 or DuelScreen2 Do
Begin
Wait(1000);
If Fighting Then
Break;
If Not Accept2 and DuelScreen2 Then
MouseBox(181, 302, 235, 317, 1);
SandWait(lagwait + 1000 + random(500), Fighting);
End;
Disguise('Fighting!');
While Fighting Do
Begin
If Players[currentplayer].booleans[0] Then
UseSpecial(Players[currentplayer].integers[1]);
wait(1000 + random(500));
End;
Disguise('Out of fight.');
If Won and not Fighting Then
Begin
Disguise('We won!');
MouseBox(359, 278, 437, 294, 1);
Inc(Wins);
Inc(Duels2);
If First Then
If TimeFromMark(Marking) >= 300000 Then
ProgressReporting;
End else
Begin
Disguise('We lost!');
Inc(Lost);
Inc(Duels2);
If TimeFromMark(Marking) >= 300000 Then
ProgressReporting;
End;
End;
Procedure Part1; Forward;
Procedure HandleRulesAndChanges;
Begin
If Changes and Not Accept and Not AllowRuleChange or ArmorOff and Not AllowArmorOff Then
Begin
MouseBox(313, 273, 379, 286, 1);
Denied := Denied + 1;
wait(lagwait + 1000 + random(500));
Part1;
End else
Begin
While Not Accept and DuelScreen1 Do
Begin
MouseBox(147, 277, 208, 284, 1);
wait(lagwait + 1000 + random(500));
If Not DuelScreen1 and not DuelScreen2 Then
Part1;
End;
End;
End;
Procedure Part3;
Begin
SandWait(lagwait + 1000 + random(500), DuelScreen2);
If DuelScreen2 Then
Begin
Disguise('At part three!');
MouseBox(181, 302, 235, 317, 1);
wait(lagwait + 1000 + random(500));
Part4;
End;
End;
Procedure Part2;
Begin
While DuelScreen1 Do
Begin
If Not DuelScreen1 Then
Part1;
Disguise('At part two!');
If not Changes and not AllowRuleChange or not ArmorOff or not AllowArmorOff Then
Begin
If DuelScreen2 Then
Part3;
HandleRulesAndChanges;
If DuelScreen1 Then
MouseBox(147, 277, 208, 284, 1);
End Else
HandleRulesAndChanges;
SandWait(lagwait + 1000 + random(500), DuelScreen2);
End;
Part3;
End;
Procedure HandleDuel;
Var
A : Integer;
Begin
If DuelScreen1 Then
Exit;
Mousebox(293, 484, 335, 499, 1);
While Not DuelScreen1 And Not Accept Do
Begin
If A >= 3 Then
Part1;
If Challenge Then
Begin
MouseBox(199, 192, 312, 209, 1);
wait(1000 + random(500));
Mousebox(8, 482, 53, 500, 1);
wait(1000 + random(500));
Part1;
End;
Mousebox(15, 443, 238, 452, 1);
A := A + 1;
SandWait(lagwait + 1000 + random(500), DuelScreen1 or Fighting);
End;
Mousebox(8, 482, 53, 500, 1);
End;
Procedure Part1;
Begin
Disguise('Searching for a dueler!');
While not DuelScreen1 or not Challenge Do
Begin
If Duel or DuelScreen1 Then
Begin
If Duel Then
HandleDuel;
SandWait(1000 + random(500), DuelScreen1);
If DuelScreen1 Then
Begin
Part2;
End else
Part1;
End;
wait(1000 + random(500))
If Fighting Then
Part4;
wait(100 + random(500));
If Won Then
Begin
Inc(Wins);
Inc(Duels2);
MouseBox(359, 278, 437, 294, 1);
End;
If Duel or DuelScreen1 Then
Begin
If Duel Then
HandleDuel;
SandWait(1000 + random(500), DuelScreen1);
If DuelScreen1 Then
Begin
Part2;
End else
Part1;
End;
wait(100 + random(500));
If Challenge Then
MouseBox(199, 192, 312, 209, 1);
wait(100 + random(500));
If not Duel Then
FunDuel
Else
HandleDuel;
End;
wait(2000 + random(500));
Part2;
End;
Function UpdateScript(Name, UpdateWebsite, Version: String): Boolean;
Var
Script, NewVersion : String;
NewS : Integer;
Begin
Script := GetPage(UpdateWebsite);
Newversion := Between('<p>', '</p>', GetPage('http://lalalacheckvers.110mb.com/CheckVersion.txt'))
If Not (Version = NewVersion) Then
Begin
WriteLn('Getting the latest script...');
NewS := RewriteFile(AppPath + 'Scripts\'+ Name +'.scar', False);
If WriteFileString(NewS, Script) Then
Begin
WriteLn('Successfully updated script to v'+ NewVersion +'!');
Result := True;
Exit;
End;
End;
End;
Begin
SetupSRL;
If CheckVers Then
Disguise('Your up to date, continuing!')
Else
Begin
UpdateScript('SSDuelArena', 'http://lalalacheckvers.110mb.com/SSDuelArena.scar', CurrentVersion);
WriteLn('Please reload this script; it has been updated!');
TerminateScript;
End;
If SRLStatsId = '' Then
SRLId := SRLStatsId
Else
SRLID := '6348';
If SRLStatsPass = '' Then
SRLPassword:= SRLStatsPass
Else
SRLID := 'heyhey';
Scriptid := '1101';
MarkTime(Marking);
Declareplayers;
If Not Loggedin Then
LoginPlayer;
Case Lag Of
True : Lagwait := AddToWaits;
False : Lagwait := 0;
End;
Case Multiplayer Of
False : Repeat
Part1;
If Not LoggedIn Then
Break;
Until(AllPlayersInactive);
True : Repeat
Duels2 := 0;
Repeat
Part1;
If Not LoggedIn Then Break;
Until(Players[currentplayer].integers[0] = duels2)
If LoggedIn Then
NextPlayer(True)
Else
NextPlayer(False);
Until(AllPlayersInactive)
End;
End.