SRL Archive - FAQ

Cant run script! Help!


Nike85

2012-07-03 23:56:05

This is the script(i was trying to test it and it wont move the mouse), can someone tell me whats wrong?
Program EdgevilleYewCutter;
//{$DEFINE SMART}
{$DEFINE SRL5}
{$i srl/srl.simba}
{$i sps/sps.simba}

Const
SERVER = 0; // Enter "0" to pick a random server.
MEMBERS = True; // Set to True if using a RS-Members account. False if F2P.
NumbOfPlayers= 1; //How many players are you using
StartPlayer= 0; //Player to start auoting with! (0 means first chararacter)
SRLStats_User = ''; // Your SRL Stats ID (If you dont have one then just leave it as it is)
SRLStats_Password = ''; // Your SRL Stats Password (If you dont have one then just leave it as it is)
Version= '1.0';

procedure DeclarePlayers;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Active := True;
end;
end;

procedure CheckUp;
begin
if not LoggedIn then Exit;
FindNormalRandoms;
end;
procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(100) of
0: begin
RandomMovement;
SetAngle(SRL_ANGLE_HIGH);
end;
1: PickUpMouse;
2: HoverSkill('Woodcutting', False);
3: SleepAndMoveMouse(5000 + Random(500));
4: RandomMovement;
5: PickUpMouse;
6: BoredHuman;
7: RandomRClick;
8: ExamineInv;
9:begin
MakeCompass( RandomRange( -360, 360));
Wait(100 + random(50));
end;
21: Wait( Random( 4500));
50: CheckUp;
end;
end;

function TreeColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.30, 0.30);

if not (FindColorsTolerance(arP, 1778988, MSX1, MSY1, MSX2, MSY2, 0)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function IsWoodcutting: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 750);
end;

procedure ChopTree;
var x, y:Integer;
begin
repeat
FindNormalRandoms;
if FindObjTPA(x, y, TreeColor, 5, 1, 15, 100, 600, ['hop'])then
Case Random(2) of
0: begin
Mouse(x, y, 2, 2, mouse_right);
ChooseOption('hop');
end;
1: Mouse(x, y, 2, 2, mouse_left);
end;
while IsWoodcutting do
Wait(20);
repeat
FindNormalRandoms;
Wait(1000+random(250));
AntiBan;
Until not IsUpText('ew') or (InvFull);
Until(InvFull);
end;

begin
Smart_Server := 0;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
ClearDebug;
SetupSRL;

DeclarePlayers;
ActivateClient;
LoginPlayer;
Repeat
ChopTree;
Until(False)
end.

Recursive

2012-07-04 00:29:35

Would be better if this function

if FindObjTPA(x, y, TreeColor, 5, 1, 15, 100, 600, ['hop'])

Were to be replaced with a findobj function

Example


{Function by MAT}
function FindObj_pX(Mouse:Boolean;pX, pY,Null,Null2: Integer; Mod1,Mod2:Extended;Lol1:String): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
FindNormalRandoms;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Mod1, Mod2);
If Not Mouse then
FindColorsSpiralTolerance(MSCX, MSCY, TPA,Null, 190, 140, 320, 230, Null2) else
FindColorsSpiralTolerance(MSCX, MSCY, TPA,Null, MSX1, MSY1, MSX2, MSY2, Null2);

ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], pX, pY);
If Mouse then
begin
MMouse(pX, pY, 2, 2);
Wait(300+Random(75));
If(IsUpTextMultiCustom([Lol1])) then
begin
Result := True;
GetMousePos(pX, pY);
Break;
end;
end else
Result := True;
end;
end;

Then call the above function and fill in the parameters.
example of use
If FindObj_pX(True,pX,pY,13890040,3,0.13, 6.73,'asket') then
begin
ClickMouse2(True);
Wait(2000+Random(200))
Result := True;
{13890040 = color, 3 = tol, (0.13, 6.73) = Hue/Sat, 'asket' = name of object}
end;