SRL Archive - First Scripts

CatherbyCooker


Polack

2015-04-22 22:44:58

Not necessarily my first script, but this is my first script that both walks and banks.
I know there's already other scripts that do this (probably much better then mine), I just wanted to write this myself.
Everything seems to work relatively well, even though there's a few things that need tweaking (banking & clicking on range (sometimes seems to mess up when another players cooking animation gets in front of color–especially if they're wearing red…).

I would appreciate all feedback on how the script runs, and how to improve it. I'm interested in using reflection to find the Range, but I don't know how (I think it has to do with the tile the range is on, but I don't know how to get this/use it?)…I can't find any thorough tutorials on reflection scripting, so if anyone could link me, or help me out there I would appreciate it.

Instructions:
Set interpreter to Pascal, and have the pascal reflection include
Start at Catherby
Put item you want to cook in very first slot


Disclaimer:

Script does not have antiban, not interested in adding it unless someone tells me how to add antiban DURING wait period. Not after. Stability > Speed > Safety are my priorities.
Make sure you have enough food, as the script does not stop itself when you run out of food.


program CatherbyCooker;
{$DEFINE SMART}
{$i srl-osr/srl.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].WorldInfo := []; // ***Desired World, leave blank if random***
Players[0].Name :='username';
Players[0].Pass :='password';
//Players[0].Nick :='not needed';
Players[0].Active:=True;
end;

Procedure WalkToRange;
begin
R_WalkPath([Point(2816, 3437)]);
R_WalkPath([Point(2816, 3442)]);
Flag;
Wait(1000 + Random(200));
end;

procedure Cook;
var
x, y: integer;
begin
if not LoggedIn then LoginPlayer else
begin
MakeCompass('e');
Mouse(580,227,5,5,Mouse_Right);
ChooseOption('Use');
Wait(200+random(500));
if FindObjCustom(x,y, ['Use'], [1056403], 5) then
wait(200+random(100));
begin
wait(100+random(200));
ClickMouse2(mouse_right);
wait(randomRange (100, 500));
ChooseOptionMulti(['ange']);
Flag;
wait(2000+Random(500));
MoveMouse(259, 407);
Wait(randomRange(200,500))
Clickmouse2(mouse_right);
Wait(randomRange(200,600));
chooseOptionMulti(['All']);
Wait(RandomRange(66000, 67000));
end;
end;
end;

Procedure WalkToBank;
begin
R_WalkPath([Point(2813, 3437)]);
R_WalkPath([Point(2809, 3440)]);
MakeCompass('n');
end;

Procedure Bank;
var
x, y: integer;
begin
repeat
repeat
FindColorSpiralTolerance(x, y, 7178646, MSX1, MSY1, MSX2, MSY2, 5)
until(FindObj(x, y, 'booth', 7178646, 25) or BankScreen);
writeln('Found Bank Booth');
MMouse(x, y, 6, 8);
ClickMouse2(mouse_left);
writeln('Opening Bank!');
wait(1000);
until(BankScreen);
writeln('Bank Is Open');
DepositAll;
Withdraw(0,0,28);
Wait(randomRange(800,1000));
end;

procedure mainLoop;
begin
Bank;
WalkToRange;
Cook;
WalkToBank;
end;

begin
SetUpSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
LoginPlayer;
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('n');
repeat
mainLoop;
until(false);
end.



Edit: I referred to and ripped some of the code off some other expired Rogue Den scripts