Sandstorm
2008-12-05 16:29:23
Averages:
Basically just gets the average of a set array of numbers. In my opinion, it could be INFINITELY useful, from customizing waits all the way to making a script look much closer to the real person in control of the account.
Function and example of use at bottom:
Function MidPoint:
Not very useful in my opinion, just a few lines.
Procedure Misclick:
It will occasionally go over the object, then back to it. The higher Chance is, the less likely to go over.
A bunch of duel arena functions (still tweaking these):
Checks if any armor has been turned off.
Checks if the challenge screen is up.
Checks if the first duel screen is up.
Checks if the second duel screen is up.
Checks if you have accepted; screws up based on who accepts first. First duel screen.
Similiar to Accept, but for the second duel screen.
Checks if your in the duel arena lobby, or in a fight. Still needs more work, because it sometimes messes up. I've got a few ideas for it though.
Checks if the rules have been changed.
Checks if the Won screen that appears after a duel is up.
Function Reverse:
Just takes the string you put in, completely turns it around. Took me a while to get this working, and I can't see of any use for it :P.
SandWait:
Waits until a condition is met (must be a boolean), or the time is up.
Basically just gets the average of a set array of numbers. In my opinion, it could be INFINITELY useful, from customizing waits all the way to making a script look much closer to the real person in control of the account.
Function and example of use at bottom:
program New;
{.include srl/srl.scar}
{*******************************************************************************
Function Averages(A : Array of Extended) : Integer;
By: Sand Storm
Description: Finds the average of an array of numbers.
*******************************************************************************}
Function Averages(A : Array of Extended) : Integer;
var
I : Integer;
B : Extended;
Begin
If GetArrayLength(A) = 0 Then
Begin
WriteLn('You need 2 or more numbers to get an average!');
Exit;
End else
If GetArrayLength(A) = 1 Then
Begin
Result:=Round(A[0]);
Exit;
End else
For I:=0 To GetArrayLength(A)-1 Do
B:=A[I]+B;
Result:=Round(B/GetArrayLength(A));
end
begin
Wait(Averages([30, 40, 50]) - 10 + randomrange(15, 30));
end.Function MidPoint:
Not very useful in my opinion, just a few lines.
Program New;
{.include srl/srl.scar}
{*******************************************************************************
Function MidPoint(X1, Y1, X2, Y2 : Integer) : String;
By: Sand Storm
Description: Returns the middle of four points.
*******************************************************************************}
Function MidPoint(X1, Y1, X2, Y2 : Integer) : Variant;
Var
P, C : Integer;
Begin
P := X1 + X2;
C := Y1 + Y2;
Result := (IntToStr(P / 2)+ ', ' +IntToStr(C / 2));
End;
Begin
WriteLn(MidPoint(MSX1, MSX2, MSY1, MSY2));
End.Procedure Misclick:
It will occasionally go over the object, then back to it. The higher Chance is, the less likely to go over.
Program New;
{.include srl/srl.scar}
{*******************************************************************************
Function AboveBelow(x, y : integer) : Integer;
By: Sand Storm
Description: Checks whether your in a certain area compared to a point.
*******************************************************************************}
Function AboveBelow(x, y : integer) : Integer;
Var
XX, YY : Integer;
begin
Xx := x;
Yy := y;
GetMousePos(x, y);
if (x < Xx) and (y < yy) then
Begin
Result := 1;
Exit;
End;
if (x < Xx) and (y > yy) then
Begin
Result := 2;
Exit;
End;
if (x > Xx) and (y > yy) then
Begin
Result := 3;
Exit;
End Else
Result := 4;
End;
{*******************************************************************************
Procedure Misclick(Chance, P, A : Integer; Left : Boolean);
By: Sand Storm
Description: Should sometimes misclick by moving the mouse farther than it
should by 20-30 pixels, then reverse back up to the real coords.
*******************************************************************************}
Procedure Misclick(Chance, p, a : Integer; left : boolean);
Begin
Case AboveBelow(p, a) Of
1 : Case Random(Chance) Of
0 : Begin
Mouse(p + 20 + random(10), a + 20 + random(10), 3, 3, left);
Mmouse(p + 20 + random(10), a - (30 + random(10)) - random(10), 3, 3);
Mouse(p, a, 3, 3, left);
End;
1..Chance : Mouse (p, a, 3, 3, left);
end;
2 : Case Random(Chance) Of
0 : Begin
Mouse(p + 20 + random(10), a - 20 - random(10), 3, 3, left);
Mmouse(p + 20 + random(10), a - (30 + random(10)) - random(10), 3, 3);
Mouse(p, a, 3, 3, left);
End;
1..Chance : Mouse (p, a, 3, 3, left);
end;
3 : Case Random(Chance) Of
0 : Begin
Mouse(p - 20 - random(10), a - 20 - random(10), 3, 3, left);
Mmouse(p + 20 + random(10), a - (30 + random(10)) - random(10), 3, 3);
Mouse(p, a, 3, 3, left);
End;
1..Chance : Mouse (p, a, 3, 3, left);
end;
4 : Case Random(Chance) Of
0 : Begin
Mouse(p - 20 - random(10), a + 20 + random(10), 3, 3, left);
Mmouse(p + 20 + random(10), a - (30 + random(10)) - random(10), 3, 3);
Mouse(p, a, 3, 3, left);
End;
1..Chance : Mouse (p, a, 3, 3, left);
end;
End;
end;
Begin
SetupSrl;
Misclick(2, 620, 337, false);
End.A bunch of duel arena functions (still tweaking these):
Function ArmorOff : Boolean;
Begin
Result := FindColor(x, y, 114, 84, 61, 244, 259);
End;Checks if any armor has been turned off.
Function Challenge : Boolean;
Begin
Result := GetColor(258, 107) = 0;
End;Checks if the challenge screen is up.
Function DuelScreen1 : Boolean;
Begin
Result := GetColor(73, 37) = 0;
End;Checks if the first duel screen is up.
Function DuelScreen2 : Boolean;
Begin
Result := GetColor(391, 34) = 0;
End;Checks if the second duel screen is up.
Function Accept : Boolean;
Begin
Result := GetColor(196, 305) = 11184810;
End;Checks if you have accepted; screws up based on who accepts first. First duel screen.
Function Accept2 : Boolean;
Begin
Result := GetColor(354, 308) = 6976375;
End;Similiar to Accept, but for the second duel screen.
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');
wait(100 + random(500));
If Not Result Then
Break;
End;
End;Checks if your in the duel arena lobby, or in a fight. Still needs more work, because it sometimes messes up. I've got a few ideas for it though.
Function Changes : Boolean;
Begin
Result := FindColor(x, y, 163, 275, 57, 304, 245);
End;Checks if the rules have been changed.
Function Won : Boolean;
Begin
Result := GetColor(386, 286) = 32768;
End;Checks if the Won screen that appears after a duel is up.
Function Reverse:
Just takes the string you put in, completely turns it around. Took me a while to get this working, and I can't see of any use for it :P.
Function Reverse(STR : String) : string;
Var
I : Integer;
Str2 : Array Of String;
Begin
SetArrayLength(Str2, Length(Str));
For I:= 1 To GetArrayLength(Str2) - 1 Do
Str2[I] := StrGet(Str, I);
For I:= 1 To GetArrayLength(Str2) - 1 Do
Result := Str2[I] + Result;
Result := StrGet(Str, Length(Str)) + Result;
End;SandWait:
Waits until a condition is met (must be a boolean), or the time is up.
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;