Results 1 to 5 of 5

Thread: Wait until help

  1. #1
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default Wait until help

    Something like this waits until the bank is open


    Code:
    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.

  2. #2
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

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

    Simba Code:
    procedure banking();
    begin
      //banking code here

      if (not (bankScreen.isOpen(5000))) then
       banking(); //try again
    end;
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  3. #3
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    .isOpen() takes a timeout paremeter itself, so you could do
    Simba Code:
    bankScreen.isOpen(10000)
    which will wait up to 10 seconds, and if you wanted to try again you could do...

    Simba Code:
    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.

  4. #4
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by JJordan View Post
    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

    Simba Code:
    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()
    Last edited by KeepBotting; 02-24-2015 at 03:38 AM.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  5. #5
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    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

    Simba Code:
    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:
    Simba Code:
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •