SRL Archive - First Scripts

Minkinos WillowCutandBank


Minkino

2009-06-12 10:10:22

This script cuts willows near draynor and banks them at draynor bank. I am hopefully going to submit it for members so give all types of constructive criticism and ideas for it.

Here is the code and there is a .scar file down the bottom:
// Thanks to Rubix and TViYHU and OSMM could not be possible without them.

{ }
{ Place character near Willows in Draynor then log out }
{ }
{ }
{ }


program MyFirstWoodCut;
{.include SRL/SRL/misc/SMART.scar}
{.include SRL\SRL.Scar}
{.include SRL/SRL/Skill/WoodCutting.scar}


const
//<><><><><>Loads<><><><><>\\
LoadsPerPlayer = 1; //Loads per player before switching

//<><><><><>SRL Id<><><><><>\\
YourSRLId = '';
YourSRLPass = '';

//<><><><><>Bank Pin<><><><><>\\
YourPin = ''; //Make same for all players if none leave blank

//<><><><><>Lamp Skill<><><><><>\\

{<><><><><><><><><><><><><><><><><><><><>
Player Setup
<><><><><><><><><><><><><><><><><><><><>}

procedure DeclarePlayers;
begin

HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := 'muff';
Players[0].Pin := '';
Players[0].Active := True;

end;

{<><><><><><><><><Do Not Edit Below this Line><><><><><><><><><><><>}


var
x, y, LoadsNum, LoadsNum2: integer;
Banked: boolean;


//<><><><><><><><><><>Anti Randoms<><><><><><><><><><>\\

procedure AntiRandoms;
begin
if (FindFight) then
RunAway('N', True, 1, 1500);
FindNormalRandoms;
FindLamp('');
end;

//<><><><><><><><><><>Anti Ban<><><><><><><><><><>\\

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(30) of
1: RandomRClick;
2: HoverSkill(LampSkill, False);
3: RandomMovement;
4: BoredHuman;
5: DoEmote(400 + Random(90));
end;
end;


//<><><><><><><><><><>Chop Tree<><><><><><><><><><>\\


procedure ChopTree;
var CuttingTime: Integer;
Tries: integer;
begin
if (not LoggedIn) then Exit;
MarkTime(CuttingTime);
MakeCompass('S')
repeat
if FindObjCustom(x, y, ['Wil', 'low'], [1989969, 3760987, 2844763], 7) then
begin
Mouse(x, y, 0, 0, false);
if (IsUpText('Chop')) then
wait(5000 + random(150));
ChooseOption('hop')
wait(10000 + random(3000));
AntiBan;
if (not FindObjCustom(x, y, ['Wil', 'low'], [1989969, 3760987, 2844763], 7)) then
Wait(100 + random(100));
Tries := Tries + 1;
if (tries = 50) then
begin
Writeln('Willows dould not be found. Switching Players....');
Logout;
NextPlayer(False);
Exit;
end;
end;
until (invfull) or (TimeFromMark(CuttingTime) > 800000 + random(60000));
end;


//<><><><><><><><><><>Walk To Bank<><><><><><><><><><>\\


procedure WalkToBank;
begin
if (not (LoggedIn)) then
Exit;
SymbolAccuracy := 0.2;
MakeCompass('N');
if (FindSymbol(x, y, 'bank')) then
begin
Mouse(x, y, 2, 2, true);
FFlag(0);
Writeln('Arrived At Bank');
end;
end;


//<><><><><><><><><><>Banking<><><><><><><><><><>\\

procedure Bank;
begin
if not LoggedIn then Exit;
MakeCompass('W')
Wait(300 + random(160));
OpenBankQuiet('db');
if (PinScreen) then
InPin(YourPin);
DepositAll;
Banked := True;
LoadsNum := LoadsNum + 1;
LoadsNum2 := LoadsNum2 + 1;
ReportVars[1] := ReportVars[1] + 1;
SendSRLReport;
CloseBank;
writeln('Load Banked');
Wait(150 + random(278));
MakeCompass('S');
end;

//<><><><><><><><><><>Walk to Willows<><><><><><><><><><>\\

procedure WalkToWillow;
begin
if not LoggedIn then Exit;
if (FindSymbol(x, y, 'fish')) then
begin
Mouse(x, y, 2, 2, true);
FFlag(0);
Writeln('Arrived At Willows');
end;
end;

//<><><><><><><><><><>Check Inventory<><><><><><><><><><>\\

procedure CheckInventory;
begin
if (InvFull) then
begin
WalkToBank;
end else
begin
ChopTree;
end;
end;


//<><><><><><><><><><>Setup Script<><><><><><><><><><>\\

procedure SetupScript;
begin
SRLId := YourSRLId;
SRLPassword := YourSRLPass;
ScriptID := '687';
DeclarePlayers;
if LoggedIn then
exit;
end;

procedure MainProc;
begin
ChopTree;
CheckInventory;
AntiBan;
WalkToBank;
Bank;
WalkToWillow;
AntiBan;
end;


begin
SMARTSetUpEX(55, False, True, False);
SetTargetDC(SMARTGetDC);
SetupSRL;
ActivateClient;
SetupScript;
LoginPlayer;
repeat
MainProc;
AntiBan;
until (LoadsNum = LoadsPerPlayer) or (not LoggedIn);
NextPlayer(true);
end.

dialeyj2

2009-06-12 21:51:24

it looks good but i dont think you used the anti-random procedure enough
you should call it between every chop in case a random shows up when your cutting
i might be wrong about that but it seems to work well in my wood cutter

Dynamite

2009-06-12 21:56:47

Use failsafes.
Use DTMs.
In your bank procedure you have:
if (PinScreen) then
InPin(YourPin);
DepositAll;
Banked := True;
LoadsNum := LoadsNum + 1;
LoadsNum2 := LoadsNum2 + 1;
ReportVars[1] := ReportVars[1] + 1;
SendSRLReport;
CloseBank;
writeln('Load Banked');
Wait(150 + random(278));
MakeCompass('S');
end;
if you have:
if Pin then
InPin;
DepositWillows;

If im correct you need a 'else' in between InPin and DepositWillows otherwise if there isnt a pin it wont do anything I don't think :p
I have no idea what i just said. Too tired. Got exams ciao :)

T~M

V3n

2009-06-14 09:42:17

From: The Man
Use failsafes.
Use DTMs.
In your bank procedure you have:
if (PinScreen) then
InPin(YourPin);
DepositAll;
Banked := True;
LoadsNum := LoadsNum + 1;
LoadsNum2 := LoadsNum2 + 1;
ReportVars[1] := ReportVars[1] + 1;
SendSRLReport;
CloseBank;
writeln('Load Banked');
Wait(150 + random(278));
MakeCompass('S');
end;
if you have:
if Pin then
InPin;
DepositWillows;

If im correct you need a 'else' in between InPin and DepositWillows otherwise if there isnt a pin it wont do anything I don't think :p
I have no idea what i just said. Too tired. Got exams ciao :)

T~M


If this does work as closely resembling java as I am suspecting, as I am not extremely familiar with Scar scripting yet, the IF statement that you were referring to is correct. If it does not have brackets enclosing the IF statements body then it will only execute one line beneath it when the statement is true. DepositAll and all following lines will be executed regardless of the IF statement being true or false.

osmm

2009-06-14 18:10:18

I'm pretty sure that he doesn't need the Else. I think that it will continue to go to DepositAll;.

But yeah, not 100% sure.

Coh3n

2009-06-14 19:22:45

You left your name and pass in the attached script. I tried to change the pass for you, but looks like someone beat me to it. Hopefully not someone who's going to take your stuff.

Anyway, just thought I'd let you know.

Griff

2009-06-14 20:35:53

Looks really good. Try learning DTMs for walking, and then RadialWalk for backup, and then finally the symbol finding. This failsafe will make it so the walking almost never fails! (It also looks impressive for your applications). Other than that, work on your standards, and try to learn to make your own TPAs. Great first script!