Results 1 to 14 of 14

Thread: Can't seem to include a wait after a procedure

  1. #1
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default Can't seem to include a wait after a procedure

    Hey I'm very new to the scripting, been using other scripts for ages, but its time I try and give back. However getting stuck on the very basics lol. This is the script I have so far but I can't seem to put pauses in the script. (it is a very basic clicking script for the Burthorpe agility course, as I am just going one step at a time.

    Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    
    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam')
    end;  // Can't seem to put a wait here..... I tried typing wait(randomrange(3800,4200));But it says it's an error
    procedure ClimbUpWall(); 
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_LEFT);
      WriteLn('Climbing up wall')
    end;
    Procedure WalkAcrossBalancingLedge();
    var
      Ledge: Tbox;
    begin
      Ledge := intTobox(156, 146, 182, 152);
      mouseBox(Ledge, MOUSE_LEFT);
      WriteLn('Walking across Balancing Ledge')
    end;
    procedure ClimbOverLowWall();
    var
      LowWall: Tbox;
    begin
      LowWall :=intTobox(235, 209, 251, 299);
      mouseBox(LowWall, MOUSE_LEFT);
      WriteLn('Climbing over low wall')
    end;
    begin
      clearDebug();
      setupSRL();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
    end.

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

    Default

    Are you trying to place a wait() on the same line as the end? Because, yeah that's going to throw a compiling error

    Do something like this:

    Simba Code:
    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam')
      wait(5000); //Here
    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
    Dec 2010
    Posts
    483
    Mentioned
    30 Post(s)
    Quoted
    328 Post(s)

    Default

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam'); //You didn't have a semicolon here
      Wait(gaussRangeInt(3800, 4200)); //Now this should work :)
    end;
    procedure ClimbUpWall();
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_LEFT);
      WriteLn('Climbing up wall')
    end;
    Procedure WalkAcrossBalancingLedge();
    var
      Ledge: Tbox;
    begin
      Ledge := intTobox(156, 146, 182, 152);
      mouseBox(Ledge, MOUSE_LEFT);
      WriteLn('Walking across Balancing Ledge')
    end;
    procedure ClimbOverLowWall();
    var
      LowWall: Tbox;
    begin
      LowWall :=intTobox(235, 209, 251, 299);
      mouseBox(LowWall, MOUSE_LEFT);
      WriteLn('Climbing over low wall')
    end;
    begin
      clearDebug();
      setupSRL();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
    end.

    E:

    KeepBotting didn't catch it either, so don't feel bad

  4. #4
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    Are you trying to place a wait() on the same line as the end? Because, yeah that's going to throw a compiling error

    Do something like this:

    Simba Code:
    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam')
      wait(5000); //Here
    end;
    I was putting it how you put it but I still got the error but I will try it again

  5. #5
    Join Date
    Feb 2015
    Posts
    422
    Mentioned
    41 Post(s)
    Quoted
    226 Post(s)

    Default

    Quote Originally Posted by nero_dante View Post
    Hey I'm very new to the scripting, been using other scripts for ages, but its time I try and give back. However getting stuck on the very basics lol. This is the script I have so far but I can't seem to put pauses in the script. (it is a very basic clicking script for the Burthorpe agility course, as I am just going one step at a time.

    Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    
    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam')
    end;  // Can't seem to put a wait here..... I tried typing wait(randomrange(3800,4200));But it says it's an error
    procedure ClimbUpWall(); 
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_LEFT);
      WriteLn('Climbing up wall')
    end;
    Procedure WalkAcrossBalancingLedge();
    var
      Ledge: Tbox;
    begin
      Ledge := intTobox(156, 146, 182, 152);
      mouseBox(Ledge, MOUSE_LEFT);
      WriteLn('Walking across Balancing Ledge')
    end;
    procedure ClimbOverLowWall();
    var
      LowWall: Tbox;
    begin
      LowWall :=intTobox(235, 209, 251, 299);
      mouseBox(LowWall, MOUSE_LEFT);
      WriteLn('Climbing over low wall')
    end;
    begin
      clearDebug();
      setupSRL();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
    end.

    The_bank is correct, it seems like the rest of your writeLns are missing a semi colon at the end as well. Adding a semi-colon at the end of each one should fix it.

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam');     // Add one here
    end;
    procedure ClimbUpWall();
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_LEFT);
      WriteLn('Climbing up wall');     // Add one here too
    end;
    Procedure WalkAcrossBalancingLedge();
    var
      Ledge: Tbox;
    begin
      Ledge := intTobox(156, 146, 182, 152);
      mouseBox(Ledge, MOUSE_LEFT);
      WriteLn('Walking across Balancing Ledge');     // And here!
    end;
    procedure ClimbOverLowWall();
    var
      LowWall: Tbox;
    begin
      LowWall :=intTobox(235, 209, 251, 299);
      mouseBox(LowWall, MOUSE_LEFT);
      WriteLn('Climbing over low wall');     // And here as well!
    end;
    begin
      clearDebug();
      setupSRL();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
    end.
    Last edited by fady; 03-05-2015 at 12:55 PM.

  6. #6
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default

    Quote Originally Posted by the bank View Post
    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam'); //You didn't have a semicolon here
      Wait(gaussRangeInt(3800, 4200)); //Now this should work :)
    end;
    procedure ClimbUpWall();
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_LEFT);
      WriteLn('Climbing up wall')
    end;
    Procedure WalkAcrossBalancingLedge();
    var
      Ledge: Tbox;
    begin
      Ledge := intTobox(156, 146, 182, 152);
      mouseBox(Ledge, MOUSE_LEFT);
      WriteLn('Walking across Balancing Ledge')
    end;
    procedure ClimbOverLowWall();
    var
      LowWall: Tbox;
    begin
      LowWall :=intTobox(235, 209, 251, 299);
      mouseBox(LowWall, MOUSE_LEFT);
      WriteLn('Climbing over low wall')
    end;
    begin
      clearDebug();
      setupSRL();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
    end.

    E:

    KeepBotting didn't catch it either, so don't feel bad
    Ahh I didn't see that error when posting, but I did have the semicolon on the script itself... must have missed it when i copy and pasted it.

    Also, what does this mean 'Wait(gaussRangeIn' why is it not randomrange?

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

    Default

    Quote Originally Posted by nero_dante View Post
    Ahh I didn't see that error when posting, but I did have the semicolon on the script itself... must have missed it when i copy and pasted it.

    Also, what does this mean 'Wait(gaussRangeIn' why is it not randomrange?
    You can use either, see this thread for an explanation of the difference between the two: https://villavu.com/forum/showthread.php?t=111711
    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

  8. #8
    Join Date
    Feb 2015
    Posts
    422
    Mentioned
    41 Post(s)
    Quoted
    226 Post(s)

    Default

    Quote Originally Posted by nero_dante View Post
    Ahh I didn't see that error when posting, but I did have the semicolon on the script itself... must have missed it when i copy and pasted it.

    Also, what does this mean 'Wait(gaussRangeIn' why is it not randomrange?
    randomrange is kind of pseudorandom, as in if given enough time all the possibilities are going to happen an equal amount of times. However, gaussRangeInt will give you a standard bell curve, where the results that are more towards the center of the range and going to happen more often than the ones that are farther away from the center, which is assumed to be more human like.

    Edit: opps beaten to it!
    Last edited by fady; 03-05-2015 at 01:01 PM.

  9. #9
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default

    Quote Originally Posted by fady View Post
    randomrange is kind of pseudorandom, as in if given enough time all the possibilities are going to happen an equal amount of times. However, gaussRangeInt will give you a standard bell curve, where the results that are more towards the center of the range and going to happen more often than the ones that are farther away from the center, which is assumed to be more human like.
    okay cool thanks for that

  10. #10
    Join Date
    Dec 2010
    Posts
    483
    Mentioned
    30 Post(s)
    Quoted
    328 Post(s)

    Default

    Quote Originally Posted by nero_dante View Post
    Ahh I didn't see that error when posting, but I did have the semicolon on the script itself... must have missed it when i copy and pasted it.

    Also, what does this mean 'Wait(gaussRangeIn' why is it not randomrange?
    No, you didnt miss it when you copied it over, you missed it all together. A semicolon does not simply disappear from copying and pasting lol.

    But am I right to assume your problem is solved?

  11. #11
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default

    Quote Originally Posted by the bank View Post
    No, you didnt miss it when you copied it over, you missed it all together. A semicolon does not simply disappear from copying and pasting lol.

    But am I right to assume your problem is solved?
    ahh, yeah it was my bad I thought i had them. and yes it did fix it. I should sleep more at night before attempting something new xD

  12. #12
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default

    Thanks for the little help that i needed. I got it to complete a whole lap :P so I'm very happy with myself xD. If you see anything that I could change to make it more simple please do let me know. I'm aware that it doesnt repeat all process's to do more laps haven't gotten that far yet :P .

    Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    
    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam');
      wait(gaussRangeInt(5800,6200));
    end;
    procedure ClimbUpWall();
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_LEFT);
      WriteLn('Climbing up wall');
      wait(gaussRangeInt(6800,7000));
    end;
    Procedure WalkAcrossBalancingLedge();
    var
      Ledge: Tbox;
    begin
      Ledge := intTobox(156, 146, 181, 150);
      mouseBox(Ledge, MOUSE_LEFT);
      WriteLn('Walking across Balancing Ledge');
      wait(gaussRangeInt(6000,6200));
    end;
    procedure ClimbOverLowWall();
    var
      LowWall: Tbox;
    begin
      LowWall :=intTobox(235, 209, 251, 299);
      mouseBox(LowWall, MOUSE_LEFT);
      WriteLn('Climbing over Low Wall');
      wait(gaussRangeInt(4800,5200));
    end;
    procedure SwingonRope();
    var
      SwingRope: Tbox;
    begin
      SwingRope :=intTobox(351, 167, 371, 191);
      mouseBox(SwingRope, MOUSE_LEFT);
      WriteLn('Swinging on Rope');
      wait(gaussRangeInt(3000,4000));
    end;
    procedure SwingAcrossMonkeyBars();
    var
      MonkeyBar: Tbox;
    begin
      MonkeyBar :=intTobox(292, 241, 351, 251);
      mouseBox(MonkeyBar, MOUSE_LEFT);
      WriteLn('Swinging across Monkey Bars');
      wait(gaussRangeInt(7800,8300));
    end;
    procedure JumpDownledge();
    var
      JumpLedge: Tbox;
    begin
      JumpLedge :=intTobox(230, 200, 278, 209);
      mouseBox(JumpLedge, MOUSE_LEFT);
      WriteLn('Finishing Lap');
      wait(gaussRangeInt(2200,2600));
    end;
    procedure StartingOver();
    var
      Starttile: Tbox;
    begin
      Starttile :=intTobox(372, 189, 390, 207);
      mouseBox(Starttile, MOUSE_LEFT);
      WriteLn('Starting New Lap');
      wait(gaussRangeInt(1900,2500));
    end;
    begin
      clearDebug();
      setupSRL();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
      ClimbOverLowWall();
      SwingonRope();
      SwingacrossMonkeyBars();
      JumpDownLedge();
      StartingOver();
    
    end.

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

    Default

    Quote Originally Posted by nero_dante View Post
    Thanks for the little help that i needed. I got it to complete a whole lap :P so I'm very happy with myself xD. If you see anything that I could change to make it more simple please do let me know. I'm aware that it doesnt repeat all process's to do more laps haven't gotten that far yet :P .

    Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    
    procedure WalkLogBeam();
    var
      logBeam: Tbox;
    begin
      LogBeam := intTobox(286, 50, 293, 180);
      mouseBox(LogBeam, MOUSE_LEFT);
      WriteLn('Walking over LogBeam');
      wait(gaussRangeInt(5800,6200));
    end;
    procedure ClimbUpWall();
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_LEFT);
      WriteLn('Climbing up wall');
      wait(gaussRangeInt(6800,7000));
    end;
    Procedure WalkAcrossBalancingLedge();
    var
      Ledge: Tbox;
    begin
      Ledge := intTobox(156, 146, 181, 150);
      mouseBox(Ledge, MOUSE_LEFT);
      WriteLn('Walking across Balancing Ledge');
      wait(gaussRangeInt(6000,6200));
    end;
    procedure ClimbOverLowWall();
    var
      LowWall: Tbox;
    begin
      LowWall :=intTobox(235, 209, 251, 299);
      mouseBox(LowWall, MOUSE_LEFT);
      WriteLn('Climbing over Low Wall');
      wait(gaussRangeInt(4800,5200));
    end;
    procedure SwingonRope();
    var
      SwingRope: Tbox;
    begin
      SwingRope :=intTobox(351, 167, 371, 191);
      mouseBox(SwingRope, MOUSE_LEFT);
      WriteLn('Swinging on Rope');
      wait(gaussRangeInt(3000,4000));
    end;
    procedure SwingAcrossMonkeyBars();
    var
      MonkeyBar: Tbox;
    begin
      MonkeyBar :=intTobox(292, 241, 351, 251);
      mouseBox(MonkeyBar, MOUSE_LEFT);
      WriteLn('Swinging across Monkey Bars');
      wait(gaussRangeInt(7800,8300));
    end;
    procedure JumpDownledge();
    var
      JumpLedge: Tbox;
    begin
      JumpLedge :=intTobox(230, 200, 278, 209);
      mouseBox(JumpLedge, MOUSE_LEFT);
      WriteLn('Finishing Lap');
      wait(gaussRangeInt(2200,2600));
    end;
    procedure StartingOver();
    var
      Starttile: Tbox;
    begin
      Starttile :=intTobox(372, 189, 390, 207);
      mouseBox(Starttile, MOUSE_LEFT);
      WriteLn('Starting New Lap');
      wait(gaussRangeInt(1900,2500));
    end;
    begin
      clearDebug();
      setupSRL();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
      ClimbOverLowWall();
      SwingonRope();
      SwingacrossMonkeyBars();
      JumpDownLedge();
      StartingOver();
    
    end.
    Congratulations I know that feel of finally getting a script to work correctly. It does feel good, and it should! You've earned it.

    One thing I'd like to point out is that you use blind clicking throughout the script (mousing to predefined boxes and clicking without checking anything). Ideally you'd have fully-fledged color-finding methods, but for now I'd encourage you to incorporate mouse-over text checks.

    e.g.
    Simba Code:
    procedure ClimbUpWall();
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_MOVE);
      if isMouseOverText('limb Wal') then //Whatever appears when you mouse-over the wall
       fastClick(MOUSE_LEFT)
      else begin
        writeLn('No mouseovertext :(');
        terminateScript();
      end;
      WriteLn('Climbing up wall');
      wait(gaussRangeInt(6800,7000));
    end;

    I believe that something to this effect is, at this point in development, even more important than implementing color-finding. Because if the camera is moved, or you hit a bad bit of lag, your script (currently) is going to continue clicking in an infinite loop.

    The above code will stop everything is something goes wrong. Failsafes become of less immediate importance as you implement more reliable first-resort methods.

    So, in conclusion: 1) great job, 2) add some mouse-over checks and shutdown failsafes, and 3) look into mainScreen.findObject() eventually for color clicking.
    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

  14. #14
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    Congratulations I know that feel of finally getting a script to work correctly. It does feel good, and it should! You've earned it.

    One thing I'd like to point out is that you use blind clicking throughout the script (mousing to predefined boxes and clicking without checking anything). Ideally you'd have fully-fledged color-finding methods, but for now I'd encourage you to incorporate mouse-over text checks.

    e.g.
    Simba Code:
    procedure ClimbUpWall();
    var
      Wall: Tbox;
    begin
      Wall := intTobox(277, 76, 305, 99);
      mouseBox(Wall, MOUSE_MOVE);
      if isMouseOverText('limb Wal') then //Whatever appears when you mouse-over the wall
       fastClick(MOUSE_LEFT)
      else begin
        writeLn('No mouseovertext :(');
        terminateScript();
      end;
      WriteLn('Climbing up wall');
      wait(gaussRangeInt(6800,7000));
    end;

    I believe that something to this effect is, at this point in development, even more important than implementing color-finding. Because if the camera is moved, or you hit a bad bit of lag, your script (currently) is going to continue clicking in an infinite loop.

    The above code will stop everything is something goes wrong. Failsafes become of less immediate importance as you implement more reliable first-resort methods.

    So, in conclusion: 1) great job, 2) add some mouse-over checks and shutdown failsafes, and 3) look into mainScreen.findObject() eventually for color clicking.
    Yeah I was planning to add mouseovertext as my nex move in the script. but simba wasn't opening up a client and I don't know how to use my browser to work a script so I'm waiting untill tomorrow to do more when hopefully the client loads

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
  •