SRL Archive - OSR Help

Repeat Procedure certain amount of times?


farkid

2013-04-28 06:25:06

I am trying to get my script to repeat the Procedure 10 times and then stop.

program Gems;
var a:Integer;

Procedure Gem;
Begin;
a:=0
MoveMouse(772,445)
Wait(1)
ClickMouse(772,445,1)
Wait(8)
MoveMouse(729,444)
ClickMouse(729,444,1)
wait(8)
a:=a+1;
repeat
Until(a=10)
End;

begin
repeat
gem
Until (true)
end.

I thought by using a=0 at the beginning and a=a+1 it would add it up until it reaches 10 but It clicks once and stops

i'm tryig to figure out how to stop after 10.

Soviet Union

2013-04-28 06:32:15

I'm not sure if this would work someone correct me if wrong :(

For a:=1 to 10 do

Sjoe

2013-04-28 06:34:29

Do it Sov's way or

add repeat above MoveMouse(772,445)

also remove repeat until(false) in the mainloop, that repeats infinite

farkid

2013-04-28 06:52:34

Got it to work, Thanks guys.

Chris!

2013-04-28 06:59:53

Changing it from until(false) to until(true) isn't going to help your situation. What if it never becomes true?

You could use something like this:

procedure Gem;
var
a: Integer;
begin;
a:=0
repeat
MoveMouse(772,445)
Wait(1)
ClickMouse(772,445,1)
Wait(8)
MoveMouse(729,444)
ClickMouse(729,444,1)
wait(8)
inc(a);
until (a=10);
end;

begin
repeat
Gem
until not (LoggedIn) //Example. Try and use something else.
end.

Also, refrain from using MoveMouse and ClickMouse as they're very botlike, unless this isn't for Runescape.

If it is for RuneScape, don't forgot to include the include and call SetupSRL; in your mainloop.

Example for your script:

program GemCutter;
{$I DEFINE SMART8}

procedure Gem;
var
a: Integer;
begin;
a:=0
repeat
MoveMouse(772,445)
Wait(1)
ClickMouse(772,445,1)
Wait(8)
MoveMouse(729,444)
ClickMouse(729,444,1)
wait(8)
inc(a);
until (a=10);
end;

begin
SetupSRL;
repeat
Gem
until not (LoggedIn); //Example. Try and use something else.
end.