SRL Archive - RS3 Help

Wait until help


JJordan

2015-02-23 22:26:07

Something like this waits until the bank is open



repeat
wait(randomRange(100, 250));
until(bankScreen.isOpen(GaussRangeInt(200, 350)));

but how would I add a timeout in pascal? ie If 3 seconds pass try the action again.

KeepBotting

2015-02-23 22:31:09

.isOpen() takes a timeout paremeter itself, so you could do
bankScreen.isOpen(10000)
which will wait up to 10 seconds, and if you wanted to try again you could do…


procedure banking();
begin
//banking code here

if (not (bankScreen.isOpen(5000))) then
banking(); //try again
end;

JJordan

2015-02-23 22:34:00

From: KeepBotting
.isOpen() takes a timeout paremeter itself, so you could do
bankScreen.isOpen(10000)
which will wait up to 10 seconds, and if you wanted to try again you could do…


procedure banking();
begin
//banking code here

if (not (bankScreen.isOpen(5000))) then
banking(); //try again
end;


Didn't realize that with banking but my question would still be useful to know for other circumstances.

KeepBotting

2015-02-23 22:35:13

From: JJordan
Didn't realize that with banking but my question would still be useful to know for other circumstances.


Did I misinterpret your question? You want to repeat your banking action again if a timeout occurs, right? .isOpen() has a built-in timeout, so if that expires, repeat the procedure. If that's not what you need, let me know

e: if you mean in a global instance, not just the bankScreen you could use a TTimeMarker


procedure someProcedure();
var
t:TTimeMarker;
begin
//some code

t.start(); //start the TTimeMarker

repeat
doSomething();
wait(1000);
until (t.getTime() > 30000);
end;

That's just a generic timer which isn't tied to any specific function like .isOpen()

JJordan

2015-02-23 22:42:19

From: KeepBotting
Did I misinterpret your question? You want to repeat your banking action again if a timeout occurs, right? .isOpen() has a built-in timeout, so if that expires, repeat the procedure. If that's not what you need, let me know

e: if you mean in a global instance, not just the bankScreen you could use a TTimeMarker


procedure someProcedure();
var
t:TTimeMarker;
begin
//some code

t.start(); //start the TTimeMarker

repeat
doSomething();
wait(1000);
until (t.getTime() > 30000);
end;

That's just a generic timer which isn't tied to any specific function like .isOpen()


That's what I was looking for, I need to create something similar to the Time#sleepUntil(Condition condition) function in another client.

Thank you :)

a purpose:

if (not isBurning) then
begin
findBonFire();
globalTimer.start;
repeat
wait(randomRange(100, 250));
until(isBurning or globalTimer.getTime() > 3000);
globalTimer.reset;
end;

excuse my poor pascal abilities