SRL Archive - OSR Help

In need of a little help with loops


GetHyper

2013-03-06 08:12:20

Hey,

Only recently come to this site, and wasn't intending on being a leecher.

I have been reading tutorial's for the past few days and have a little time to try scripting, now, i have never done anything like this before (previously bought the bot's) so thought it would be a good challenge.

I'm having difficulties trying to decide how to loop this, and also if the way ive set it can be altered any?
I was thinking of doing a firemaking script.


Currently, i can run and it will burn 1 log and finish, which is a start :p

program FireMaker;
{$DEFINE SMART8}
{$i srl/srl.simba}
{$I P07Include.Simba}

Var
LogDTM:integer;
x,y:integer;


Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

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

Procedure GetTinderbox;
Var
TinderboxDTM:integer;
Begin
TinderboxDTM := DTMFromString('mrAAAAHic42BgYJjNzMAwB4iXAPEqIF4ExNOBuB+IJwKxHSMDgycQOwOxLRAbALExEFsBsRsQx9lzMEzv6WYwUFAA48jgYKCpjHAsByTxYUYCGAYAuusMHg==');

if FindDTM(TinderboxDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 5, 5, true);
end;

FreeDTM(TinderboxDTM);
end;

Procedure GetLog;
Var
x, y, LogDTM: integer;
begin
LogDTM := DTMFromString('mrAAAAHic42BgYBAHYm4gFgViOSBWBGJlIBZDEueBsjmAWAiIpaBqZYC4NMocSDLiwfgBPp3IugEqkQJy');

if FindDTM(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2) then

begin
Mouse(x, y, 5, 5, true)
end else
Writeln('No DTM Found');

FreeDTM(LogDTM);
end;

Procedure Mainloop;
begin
GetTinderbox;
GetLog;
end;

begin
SetUpSRL;
ActivateClient;
repeat
Mainloop;
until(???);
end.

I know i havent got far with this, like i say, just wanting a bit of guidance.

Thank you in advance.

speedster

2013-03-06 09:15:52

you could use

repeat
MainLoop;
until not P07_LoggedIn;

Also try to declare the DTMS in a single procedure at the start of the script, using global script variables.

Procedure DeclareDtms;
begin
LogDTM := DTMFromString('mrAAAAHic42BgYBAHYm4gFgViOSBWBGJlIBZDEueBsjmAWAiIpaBqZYC4NMocSDLiwfgBPp3IugEqkQJy');
TinderboxDTM := DTMFromString('mrAAAAHic42BgYJjNzMAwB4iXAPEqIF4ExNOBuB+IJwKxHSMDgycQOwOxLRAbALExEFsBsRsQx9lzMEzv6WYwUFAA48jgYKCpjHAsByTxYUYCGAYAuusMHg==');
end;

procedure freeourDtms;
begin
FreeDtm(LogDTM);
FreeDtm(TinderboxDTM);
end;

and add before the repeat loop the following :
AddOnTerminate('freeourDtms');

GetHyper

2013-03-06 11:12:15

Thank you very much speedster, ill try this later on when im home.