Results 1 to 7 of 7

Thread: How to make it not repeat a single procedure

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

    Default How to make it not repeat a single procedure

    Hey again, okay I have made some progress with my script however, I do not wish for it to do one of the procedures everytime. And getting a bit confused as to what to type so that it would check if that specific procedure has been done already.

    This is the code, but I don't want it to do 'SwitchtoNorthHigh' procedure everytime it finishes a lap. Any help on that.

    Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I SPS/lib/SPS-RS3.Simba}
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'username';
        password := 'password';
        isActive := true;
        isMember := false;
      end
      currentPlayer := 0;
    end;
    
    procedure SwitchtoNorthHigh();
    var
      resetcamera: Tbox;
    begin
      resetcamera := intTobox(586, 25, 606, 41);
      MouseBox(resetcamera, MOUSE_LEFT);
      WriteLn('Starting up Lap');
      mainScreen.setAngle(MS_ANGLE_HIGH);
    end;
    
    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();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
      repeat
       if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        exitTreasure();
      end;
    
      SwitchtoNorthHigh();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
      ClimbOverLowWall();
      SwingonRope();
      SwingacrossMonkeyBars();
      JumpDownLedge();
      StartingOver();
      until(false);
    end.

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

    Default

    Take it out of your loop.

    Currently you loop:

    Simba Code:
    repeat
       if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        exitTreasure();
      end;

      SwitchtoNorthHigh();
      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
      ClimbOverLowWall();
      SwingonRope();
      SwingacrossMonkeyBars();
      JumpDownLedge();
      StartingOver();
    until(false);

    So take SwitchtoNorthHigh() and put it below declarePlayers and out of your loop.

    Simba Code:
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
      SwitchtoNorthHigh();
      repeat
       if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        exitTreasure();
      end;

      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
      ClimbOverLowWall();
      SwingonRope();
      SwingacrossMonkeyBars();
      JumpDownLedge();
      StartingOver();
      until(false);
    end.

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

    Default

    yeah I was going to do that, but if for example it logs out and I need it to go back do that procedure again, will it do it? I know the whole script would mess up if it doesn't log out at the start of the course but just for future reference, how would I get the script to know if a specific procedure has already completed.

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

    Default

    My solution would be to create a procedure called loginPlayer() that will call players[currentPlayer].login(), exitTreasure() etc and at the end call your north/high function and if the player isnt logged in then invoke that procedure.

  5. #5
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by nero_dante View Post
    yeah I was going to do that, but if for example it logs out and I need it to go back do that procedure again, will it do it? I know the whole script would mess up if it doesn't log out at the start of the course but just for future reference, how would I get the script to know if a specific procedure has already completed.
    Could you not do this then:

    Simba Code:
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
      repeat
       if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        exitTreasure();
        SwitchtoNorthHigh();
      end;

      WalkLogBeam();
      ClimbUpWall();
      WalkAcrossBalancingLedge();
      ClimbOverLowWall();
      SwingonRope();
      SwingacrossMonkeyBars();
      JumpDownLedge();
      StartingOver();
      until(false);
    end.

    I guess you could also leave it where the bank suggested and then put it in the login portion as well. This way will only work if you start logged out. I typically like to have a setup() function in my script that calls all the initial login and any other stuff you need. You could call that before your loop, and then call the compass setup in your 6 hour fix code.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

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

    Default

    Here is your script with the feature I just described implemented. I also formatted your code and commented my changes.

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

    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'username';
        password := 'password';
        isActive := true;
        isMember := false;
      end
      currentPlayer := 0;
    end;

    procedure SwitchtoNorthHigh();
    var
      resetcamera: Tbox;
    begin
      resetcamera := intTobox(586, 25, 606, 41);
      MouseBox(resetcamera, MOUSE_LEFT);
      WriteLn('Starting up Lap');
      mainScreen.setAngle(MS_ANGLE_HIGH);
    end;

    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;

    procedure loginPlayer();
    begin
      players[currentPlayer].login(); //Same as your original check
      exitTreasure();
      SwitchtoNorthHigh(); //Logged in again, fix the compass!
    end;

    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
      SwitchtoNorthHigh(); //Call it outside of the loop so it will execute at the beginning
      repeat
        if not isLoggedIn() then
        begin
          loginPlayer(); //Custom relogin procedure that takes care of all the steup
        end;
        WalkLogBeam();
        ClimbUpWall();
        WalkAcrossBalancingLedge();
        ClimbOverLowWall();
        SwingonRope();
        SwingacrossMonkeyBars();
        JumpDownLedge();
        StartingOver();
      until (false);
    end.

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

    Default

    Quote Originally Posted by the bank View Post
    Here is your script with the feature I just described implemented. I also formatted your code and commented my changes.

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

    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'username';
        password := 'password';
        isActive := true;
        isMember := false;
      end
      currentPlayer := 0;
    end;

    procedure SwitchtoNorthHigh();
    var
      resetcamera: Tbox;
    begin
      resetcamera := intTobox(586, 25, 606, 41);
      MouseBox(resetcamera, MOUSE_LEFT);
      WriteLn('Starting up Lap');
      mainScreen.setAngle(MS_ANGLE_HIGH);
    end;

    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;

    procedure loginPlayer();
    begin
      players[currentPlayer].login(); //Same as your original check
      exitTreasure();
      SwitchtoNorthHigh(); //Logged in again, fix the compass!
    end;

    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
      SwitchtoNorthHigh(); //Call it outside of the loop so it will execute at the beginning
      repeat
        if not isLoggedIn() then
        begin
          loginPlayer(); //Custom relogin procedure that takes care of all the steup
        end;
        WalkLogBeam();
        ClimbUpWall();
        WalkAcrossBalancingLedge();
        ClimbOverLowWall();
        SwingonRope();
        SwingacrossMonkeyBars();
        JumpDownLedge();
        StartingOver();
      until (false);
    end.
    Thanks .. Simba won't create a client right now for some reason so I'll check that out tomrrow Thanks for help.

    Also thanks aswell Garrett

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
  •