SRL Archive - First Scripts

Need Help With Making A Procedure Run Only Once


Adieux

2014-08-06 00:00:44

Hi, so when you go to cut a log for the first time it asks you what tool to you
*add to bonfire*
*use knife*
*use tinderbox*

It only asks you once and then it will automatically select the tool for you until you log out.
I need to make a procedure run only once, during the first batch of logs I tried doing something like this
[PHP]procedure clickKnife();
begin
mouseBox(intToBox(268,182,313,228), MOUSE_LEFT);
end;

procedure cutLogs();
var x,y: integer;
begin

if bankscreen.close then
begin
wait(randomRange(1000,2000));
tabBackPack.mouseSlot(1, MOUSE_LEFT)
end;

if tabBackPack.mouseSlot(1, MOUSE_LEFT) then
begin
wait(randomRange(1000,2000));
clickKnife();
wait(randomRange(500,1000));
mouseBox(intToBox(287,328,507,352), MOUSE_LEFT);
wait(randomRange(1000,2000));
end;

if progressScreen.isOpen(6000) then
begin
WriteLn('Waiting for logs to cut');
repeat
wait(randomRange(500,1000));
until (progressScreen.getButton() < 1);
end else
writeLn('Couldnt open progress screen');
end;[/PHP]

But it still tries to click the knife every time, which looks robotic since there isnt anything there onscreen.
Thanks for any help!

Gunner

2014-08-06 00:57:58

From: luispadron
Hi, so when you go to cut a log for the first time it asks you what tool to you
*add to bonfire*
*use knife*
*use tinderbox*

It only asks you once and then it will automatically select the tool for you until you log out.
I need to make a procedure run only once, during the first batch of logs I tried doing something like this

But it still tries to click the knife every time, which looks robotic since there isnt anything there onscreen.
Thanks for any help!


From: luispadron
Hi, so when you go to cut a log for the first time it asks you what tool to you
*add to bonfire*
*use knife*
*use tinderbox*

It only asks you once and then it will automatically select the tool for you until you log out.
I need to make a procedure run only once, during the first batch of logs I tried doing something like this

But it still tries to click the knife every time, which looks robotic since there isnt anything there onscreen.
Thanks for any help!


Just off the top of my head, you could do a


procedure clickKnife();

var
knifesClicked: integer;

begin
inc(knifesClicked);
if (knifesClicked) > 1 then
exit;
mouseBox(intToBox(268,182,313,228), MOUSE_LEFT);
end;

procedure cutLogs();
var x,y: integer;

begin

if bankscreen.close then
begin
wait(randomRange(1000,2000));
tabBackPack.mouseSlot(1, MOUSE_LEFT)
end;

if tabBackPack.mouseSlot(1, MOUSE_LEFT) then
begin
wait(randomRange(1000,2000));
clickKnife();
wait(randomRange(500,1000));
mouseBox(intToBox(287,328,507,352), MOUSE_LEFT);
wait(randomRange(1000,2000));
end;

if progressScreen.isOpen(6000) then
begin
WriteLn('Waiting for logs to cut');
repeat
wait(randomRange(500,1000));
until (progressScreen.getButton() < 1);
end else
writeLn('Couldnt open progress screen');
end;

That should only click the knife the first time. After that the count will be greater than 1 and it will just exit that procedure each time by. That's the logic anyways. You'll need to verify that that code is correct. It's 1AM and there may be some issues with it.

Camel

2014-08-06 00:58:56

You could just use the toolscreen class in srl-6.


procedure cutLogs();
var x,y: integer;

begin

if bankscreen.close then
begin
wait(randomRange(1000,2000));
tabBackPack.mouseSlot(1, MOUSE_LEFT)
end;

if tabBackPack.mouseSlot(1, MOUSE_LEFT) then
begin
wait(randomRange(1000,2000));
if ToolScreen.isOpen then
begin
Toolscreen.select('knife');
end;
wait(randomRange(500,1000));
mouseBox(intToBox(287,328,507,352), MOUSE_LEFT);
wait(randomRange(1000,2000));
end;

if progressScreen.isOpen(6000) then
begin
WriteLn('Waiting for logs to cut');
repeat
wait(randomRange(500,1000));
until (progressScreen.getButton() < 1);
end else
writeLn('Couldnt open progress screen');
end;

The Mayor

2014-08-06 00:59:47

Or you could use both:


var
CraftCount: integer;

procedure cutLogs();
begin
tabBackpack.mouseSlot(randomRange(1, 7), MOUSE_LEFT);

if craftCount < 1 then
if toolScreen.isOpen(2000) then
begin
toolScreen.select('Knife');
inc(CraftCount); // craftCount + 1 first time
end;

if productionScreen.isOpen(3000) then
begin
productionScreen.selectBox(1);
productionScreen.clickStart();

if progressScreen.isOpen(2000) then
repeat
wait(100);
//some antiban here
until progressScreen.getButton() < 1;
end;
end;

Adieux

2014-08-06 01:04:57

Thank you all for the help! I thought there might be an srl6 function for this but didnt know it

I'll try this tomorrow as its late right now, thanks again for being awesome and helpful!