Results 1 to 21 of 21

Thread: Help with looping issues

  1. #1
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default Help with looping issues

    Hello,

    I'm currently working on a script to make planks in Taverley that access the Tzhaar bank using the Tokkul-Zo. The goal of the script is firstly for my ironman :P but I also want to provide a script to the community that wont be used for gold farm because of high level requirements, but it can still be used as a money maker.

    My current goal is simply to get this thing to work, from there I can add case values/player form to let us pick between mahogany or oak or whatever logs.
    However, I am currently stuck pretty badly.
    Right now, the script is capable of detecting if there are logs or planks in the inventory (thanks @The Mayor as I stole a ton of your script ) and then it either goes to the Tzhaar bank using the third option on the TokkulZo or it loadstone teleports to Taverly.

    The banking part works, I used a dtm to find the banker, it clicks the first preset box and then teleports to Taverley with the oak logs.
    Then it will walk to the plank maker but here is the issue. When I have it find then right click the planker it opens the interface and I get a cosntant "---- Current mouse-over text: """ and the procedure to click the right mousebox on that screen that pops up wont initiate.

    Can anybody help me??

    Simba Code:
    program TzHaarPlanker;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I SPS/lib/SPS-RS3.Simba}
    {$i srl-6/lib/misc/srlplayerform.simba}

    {------------------------------------------------------------------------------)
                                       Instructions:

       1. Press play and fill out Player form
       2. Profit.

    (------------------------------------------------------------------------------)


    {------------------------------------------------------------------------------)

            DON'T TOUCH ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU'RE DOING!

    (------------------------------------------------------------------------------}


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /|' }
    { |                    Global Variable Declaration                     |' }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/|' }
    var
      { DTMs }
        PlankDTM, LogDTM, TzhaarBankDTM, LoadsDone: integer;

    procedure initPlayerForm();
    begin
      with playerForm do
      begin
        name := 'CBremsTzHaarPlanker';
        scriptHelpThread := 'To Be Added Upon Release';

        editBoxLabels := ['Loads To Do'];
        editBoxDefaults := ['1000'];
        editBoxHints := ['Number of Logs / 28'];
        checkBoxLabels := [''];
        checkBoxDefaults := [''];
        checkBoxHints := [''];
        comboBoxLabels := ['Type of Plank'];
        comboBoxDefaults := ['Oak'];

        setLength(comboBoxItems, length(comboBoxLabels));
        comboBoxItems[0] := ['Normal', 'Oak', 'Teak', 'Mahogany'];
      end;
    end;

    procedure declarePlayers();
    var
      i: integer;
    begin
      players.setup(playerForm.players);
      currentPlayer := 0;
      for i := 0 to high(players) do
        with players[i] do
        begin
        integers[0] := strToInt(playerForm.players[i].settings[0]); // Loads To Do

        //booleans[0] := strToBool(playerForm.players[i].settings[0]);

        strings[0] := playerForm.players[i].settings[1];            // Plank Type
        end;
    end;

    procedure debugSPFSettings();
    var
      i: integer;
    begin
      writeln('');

      for i := 0 to high(players) do
      begin
        writeLn('Loads To Do:             ',  players[i].integers[0]);
        writeLn('Plank Type:              ',  players[i].strings[0]);
      end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: loadDTMs                                                | }
    { | Description: Loads DTMs into script                                | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure loadDTMs();
    begin
     PlankDTM := DTMFromString('mbQAAAHicY2VgYOBmYmAQB2JmIOYEYn4glgZiASBWB2JNIJYDYjdTdaBqRhT8nwETMGLBYAAApJ8Cmg==');
     LogDTM := DTMFromString('mggAAAHicY2NgYHjCyMDwCYifA/EdIL4KxG+B+BcQ/wFiBiYGBhYgZgTiz0D+yr54oCAjBv7PgB1gqoRgCAAAPOEK/w==');
     TzhaarBankDTM := DTMFromString('mbQAAAHicY2VgYNjNyMAwFYi3APFhID4OxE1A3APENUBcD8SdQFyYkc1wY48uQ0RgEENuSjpDXmoGAxdQPzpmxILBAACXmQza');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isPlankBackPack                                          | }
    { | Description: Checks if there is a plank in backpack                | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isPlankBackpack(): boolean;
    var
      x, y: integer;
    begin
      if not gameTabs.openTab(TAB_BACKPACK) then
        exit;
      result := findDTM(plankDTM, x, y, tabBackpack.getBounds());
      if result then print('Planks found in backpack');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isLogBackPack                                            | }
    { | Description: Checks if there is are logs in backpack               | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isLogBackpack(): Boolean;
    var
      x, y: integer;
    begin
      if not gameTabs.openTab(TAB_BACKPACK) then
        exit;
      result := findDTM(logDTM, x, y, tabBackpack.getBounds());
      if result then print('Logs found in backpack');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isPlankInterfaceOpen                                     | }
    { | Description: Checks if the Plank Interface is open                 | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isPlankInterfaceOpen(): boolean;
    var
      x, y: integer;
      TPA: TPointArray;

    begin
      result := findColorsSpiralTolerance(x, y, TPA, 1514057, mainscreen.getBounds(), 3, colorSetting(2, 0.22, 1.39));
      if result then print('The plank interface is open');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: antiBan                                                 | }
    { | Description: Self-explanatory :P                                   | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure antiBan();
    var
      i: integer;
    begin
      if not isLoggedIn() then
        exit;
      writeLn('Engaging in antiban');

      i := random(500);
      case i of
          1..12: pickUpMouse();
          13..18: randomRClickItem();
          19..32: sleepAndMoveMouse(random(2000) + 750);
          33..85: mouseOffClient(OFF_CLIENT_RANDOM);
          86..120: mainScreen.setAngle(MS_ANGLE_HIGH);
          121..400: smallRandomMouse();
      end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Teleport to Fight Caves                                 | }
    { | Description: Teleport to Fight Caves if there are planks in invo   | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure teleBank();
    begin

      if not isLoggedin() then
        exit;

      if isPlankBackpack then
        typeSend('1', false);
        wait(randomRange(920, 1375));
      if ConversationBox.isOpen() then
        conversationBox.selectOption(5);
        wait(randomRange(2425, 2700));

    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Use Tzhaar Bank                                         | }
    { | Description: Find and left click banker, use bank preset button    | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure bankTzhaar();
    var
      x, y: integer
    begin
      if not isLoggedin() then
        exit;

      repeat
      if findDTM(TzhaarBankDTM, x, y, mainscreen.getBounds()) then
        begin
          mouse(x, y, 2, 2, MOUSE_MOVE);
            if isMouseOverText(['Bank']) then
            begin
              fastClick(MOUSE_LEFT);
              wait(randomRange(2400, 2650));
            end;
        end;
      until bankScreen.isOpen(500);

      bankScreen.clickButton(BANK_BUTTON_PRESET_1);
      wait(randomRange(500, 1200));
      exit;
    end;


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Teleport to Plank Maker                                 | }
    { | Description: Teleports to Taverley, walks to Plank Maker           | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure teleToPlanker();
    var
      pathToPlanker: TPointArray;
      p: TPoint;
    begin
      pathToPlanker := [Point(69, 121), Point(111, 91)];
      if not isLoggedin() then
      exit;

      if isLogBackpack() then
        lodestoneScreen.teleportTo(LOCATION_TAVERLEY);
        wait(randomRange(16000, 17500));

        if SPS.walkPath(pathToPlanker) then
        begin
        minimap.waitPlayerMoving();
        wait(randomRange(500,650));
        end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Open the Planking Interface                             | }
    { | Description: Find and right click Plank Maker                      | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure openPlankInterface();
    var
      x, y, i: integer;
    begin
     if not isLoggedIn() then
      exit;

      repeat
        mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['Talk-to'], MOUSE_RIGHT);
        wait(randomRange(1000, 2000));
        chooseOption.select(['Buy']);
        inc(i);
        wait(randomRange(1000, 2000));
      until isPlankInterfaceOpen() or (i >= 3);

    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: plankLogs                                               | }
    { | Description: Turn Logs into Planks                                 | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure plankLogs();
    var
      normalBox, oakBox, teakBox, mahoganyBox: TBox
    begin
    normalBox := intToBox(215, 310, 295, 325);
    oakBox := intToBox(530, 355, 600, 372);
    teakBox := intToBox(215, 455, 295, 470);
    mahoganyBox := intToBox(455, 455, 535, 470);

    if not isLoggedIn() then
          exit;

      wait(randomRange(500, 1000));

      players[currentPlayer].strings[0] := 'Oak';

      writeLn('Made it to the plank logs procedure');
       begin
        case (players[currentPlayer].strings[0]) of
          'Normal':
            begin
              mouseBox(normalBox, MOUSE_LEFT);
              writeLn('Clicked on the Normal Plank "Buy All" option!');
            end;

          'Oak':
            begin
              mouseBox(oakBox, MOUSE_LEFT);
              writeLn('Clicked on the Oak Plank "Buy All" option!');
            end;

          'Teak':
            begin
              mouseBox(teakBox, MOUSE_LEFT);
              writeLn('Clicked on the Teak Plank "Buy All" option!');
            end;

          'Mahogany':
            begin
              mouseBox(mahoganyBox, MOUSE_LEFT);
              writeLn('Clicked on the Mahogany Plank "Buy All" option!');
            end;
        end;
       end;
    end;


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: mainLoop                                                | }
    { | Description: All that the script is or ever could be o.0           | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure mainLoop();
    begin

    if not isLoggedIn() then
      exit;

    repeat
    if isPlankBackpack() then
      begin
        teleBank();
        bankTzhaar();
      end else
        teleToPlanker();
        openPlankInterface();
        plankLogs();
        inc(LoadsDone);

    until loadsDone = players[currentPlayer].integers[0];

    if loadsDone >= players[currentPlayer].integers[0] then
      writeLn('Completed amount of requested loads!');
      terminateScript();
    end;

    begin
      clearDebug();
      initPlayerForm();
      runPlayerForm();
      SPS.setup('SouthTaverleyMap', RUNESCAPE_OTHER);
      loadDTMs();
      smartEnableDrawing := true;

      if (not playerForm.isScriptReady) then
        exit;

      declarePlayers();
      debugSPFSettings(); //this can be removed if I'm happy with script
      setupSRL();


      repeat
      if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        wait(gaussRangeInt(1500, 3500));
        exitSquealOfFortune();
        minimap.setAngle(MM_DIRECTION_NORTH);
        mainScreen.setAngle(MS_ANGLE_HIGH);
      end;


      mainLoop();

      until (false);

    end
    Last edited by cbrems; 03-05-2015 at 06:57 PM. Reason: updated script

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

    Default

    Quote Originally Posted by cbrems View Post
    Hello,

    I'm currently working on a script to make planks in Taverley that access the Tzhaar bank using the Tokkul-Zo. The goal of the script is firstly for my ironman :P but I also want to provide a script to the community that wont be used for gold farm because of high level requirements, but it can still be used as a money maker.

    My current goal is simply to get this thing to work, from there I can add case values/player form to let us pick between mahogany or oak or whatever logs.
    However, I am currently stuck pretty badly.
    Right now, the script is capable of detecting if there are logs or planks in the inventory (thanks @The Mayor as I stole a ton of your script ) and then it either goes to the Tzhaar bank using the third option on the TokkulZo or it loadstone teleports to Taverly.

    The banking part works, I used a dtm to find the banker, it clicks the first preset box and then teleports to Taverley with the oak logs.
    Then it will walk to the plank maker but here is the issue. When I have it find then right click the planker it opens the interface and I get a cosntant "---- Current mouse-over text: """ and the procedure to click the right mousebox on that screen that pops up wont initiate.

    Can anybody help me??

    Simba Code:
    procedure openPlankInterface();
    var
      x, y, i: integer;
    begin
     if not isLoggedIn() then
      exit;

      repeat
        mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['Talk-to'], MOUSE_RIGHT);
        wait(randomRange(1000, 2000));
        chooseOption.select(['Buy']);
        inc(i);
      until isPlankInterfaceOpen() or (i >= 3);

      if isPlankInterfaceOpen() then
        begin
          plankLogs();
        end;
    end;
    instead of

    Simba Code:
    mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['Talk-to'], MOUSE_RIGHT);

    try
    Simba Code:
    mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['alk-to'], MOUSE_RIGHT);


    that fixed the mouse over text for me
    Last edited by fady; 03-04-2015 at 09:39 PM.

  3. #3
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Quote Originally Posted by fady View Post
    instead of

    Simba Code:
    mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['Talk-to'], MOUSE_RIGHT);

    try
    Simba Code:
    mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['alk-to'], MOUSE_RIGHT);


    that fixed the mouse over text for me
    I gave it a whirl, no luck. The mouse over text isnt appearing until the "convert wood to planks" screen comes up and then the next procedure to find the mouse box and click in it isn't taking place

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

    Default

    Quote Originally Posted by cbrems View Post
    I gave it a whirl, no luck. The mouse over text isnt appearing until the "convert wood to planks" screen comes up and then the next procedure to find the mouse box and click in it isn't taking place
    Oh I'm sorry, I misunderstood, does the function
    Simba Code:
    function isPlankInterfaceOpen(): boolean;
    var
      x, y: integer;
      TPA: TPointArray;

    begin
      result := findColorsSpiralTolerance(x, y, TPA, 3419164, mainscreen.getBounds(), 0, colorSetting(2, 0.00, 0.00));
      if result then print('The plank interface is open');
    end;

    return a positive result? because what i think is happening, is that the first time the script tries to find the plank maker goes through, but the script doesn't detect that the plank interface is open, so it repeats the loop and gets stuck at finding the plank maker again, so it gets stuck at the "mouseovertext" portion of finding the plank maker.
    Last edited by fady; 03-04-2015 at 09:59 PM. Reason: grammer

  5. #5
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    What fady said is correct. After it clicks the plank maker, it starts the loop again straight away because the interface will take a few ms to open. You should add a wait after clicking the 'Buy'

    Simba Code:
    repeat
      if isPlankInterfaceOpen() then
        break()
      else begin
        mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['Talk-to'], MOUSE_RIGHT);
        chooseOption.select(['Buy']);
        wait(random(2000, 3000));
        i += 1;
      end;
    until (i >= 3);

  6. #6
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    What fady said is correct. After it clicks the plank maker, it starts the loop again straight away because the interface will take a few ms to open. You should add a wait after clicking the 'Buy'

    Simba Code:
    repeat
      if isPlankInterfaceOpen() then
        break()
      else begin
        mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['Talk-to'], MOUSE_RIGHT);
        chooseOption.select(['Buy']);
        wait(random(2000, 3000));
        i += 1;
      end;
    until (i >= 3);
    I've tried this, and did again just to make sure.
    I changed the wait to be 6 seconds long to be sure I was waiting enough and the outcome is the same.

    The screen opens, I get a positive return from the function (to anwser Fady) but then it goes back to "current mouse over text"

  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 cbrems View Post
    I've tried this, and did again just to make sure.
    I changed the wait to be 6 seconds long to be sure I was waiting enough and the outcome is the same.

    The screen opens, I get a positive return from the function (to anwser Fady) but then it goes back to "current mouse over text"
    Disable SRL-6's debug (disableSrlDebug := true;) and then debug everything yourself. By that I mean

    Simba Code:
    function isPlankInterfaceOpen(): boolean;
    var
      x, y: integer;
      TPA: TPointArray;

    begin
      result := findColorsSpiralTolerance(x, y, TPA, 3419164, mainscreen.getBounds(), 0, colorSetting(2, 0.00, 0.00));
      if (length(TPA) > 0) then
       writeLn('Looks like we have a TPA');

      if (result) then
       writeLn('The plank interface is open');
    end;

    Just toss a conditional writeLn into everything, and see what isn't working like it should.
    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
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    Disable SRL-6's debug (disableSrlDebug := true;) and then debug everything yourself. By that I mean

    Simba Code:
    function isPlankInterfaceOpen(): boolean;
    var
      x, y: integer;
      TPA: TPointArray;

    begin
      result := findColorsSpiralTolerance(x, y, TPA, 3419164, mainscreen.getBounds(), 0, colorSetting(2, 0.00, 0.00));
      if (length(TPA) > 0) then
       writeLn('Looks like we have a TPA');

      if (result) then
       writeLn('The plank interface is open');
    end;

    Just toss a conditional writeLn into everything, and see what isn't working like it should.
    Alright, I did that, great idea! Thanks! Here's what we get now

    -- The plank interface is open <------This is my write line procedure to make sure that it can return a positive result
    Made it to the plank logs procedure <------This tells me that it was able to start the "planklogs" procedure
    -- TRSGameTabs.openTab(2)
    ---- Tab is already open, exiting
    -- TRSGameTabs.openTab(2): = True
    -- Logs found in backpack <------This tells me the plank logs is failing, so it loops back to see if logs are in backpack and then begins that part of the main loop

    I have no idea why the gametabs is coming up, but it is stopping the script from clicking the defined mouse box

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

    Default

    Quote Originally Posted by cbrems View Post
    Alright, I did that, great idea! Thanks! Here's what we get now

    -- The plank interface is open <------This is my write line procedure to make sure that it can return a positive result
    Made it to the plank logs procedure <------This tells me that it was able to start the "planklogs" procedure
    -- TRSGameTabs.openTab(2)
    ---- Tab is already open, exiting
    -- TRSGameTabs.openTab(2): = True
    -- Logs found in backpack <------This tells me the plank logs is failing, so it loops back to see if logs are in backpack and then begins that part of the main loop

    I have no idea why the gametabs is coming up, but it is stopping the script from clicking the defined mouse box
    Tab 2 is the backpack. Isn't that what you want to be open? Why would that stop the script from clicking?

    The debug
    Code:
    -- TRSGameTabs.openTab(2)
    ---- Tab is already open, exiting
    -- TRSGameTabs.openTab(2): = True
    stems from the gameTabs.openTab(TAB_BACKPACK); that you call at the start of many of your routines.
    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

  10. #10
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    Tab 2 is the backpack. Isn't that what you want to be open? Why would that stop the script from clicking?

    The debug
    Code:
    -- TRSGameTabs.openTab(2)
    ---- Tab is already open, exiting
    -- TRSGameTabs.openTab(2): = True
    stems from the gameTabs.openTab(TAB_BACKPACK); that you call at the start of many of your routines.
    I do want the backpack open. But, what is going on is that when I open the plank interface the mouse box wont get clicked, the script wont even try to click them. I put a writeLn() statement that should come up after it clicks the mousebox but that isn't happening.

    Is the issue that the mouse box is in the mainscreen after the plank interface opens?

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

    Default

    Quote Originally Posted by cbrems View Post
    I do want the backpack open. But, what is going on is that when I open the plank interface the mouse box wont get clicked, the script wont even try to click them. I put a writeLn() statement that should come up after it clicks the mousebox but that isn't happening.

    Is the issue that the mouse box is in the mainscreen after the plank interface opens?
    Still confused - can you post the updated script so I see where exactly the things you're referencing are located?
    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

  12. #12
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Here is the most current version
    Simba Code:
    TzHaarPlanker;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I SPS/lib/SPS-RS3.Simba}
    {$i srl-6/lib/misc/srlplayerform.simba}

    {------------------------------------------------------------------------------)
                                       Instructions:

       1. Press play and fill out Player form
       2. Profit.

    (------------------------------------------------------------------------------)


    {------------------------------------------------------------------------------)

            DON'T TOUCH ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU'RE DOING!

    (------------------------------------------------------------------------------}


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /|' }
    { |                    Global Variable Declaration                     |' }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/|' }
    var
      { DTMs }
        PlankDTM, LogDTM, TzhaarBankDTM, LoadsDone: integer;

    procedure initPlayerForm();
    begin
      with playerForm do
      begin
        name := 'CBremsTzHaarPlanker';
        scriptHelpThread := 'To Be Added Upon Release';

        editBoxLabels := ['Loads To Do'];
        editBoxDefaults := ['1000'];
        editBoxHints := ['Number of Logs / 28'];
        checkBoxLabels := [''];
        checkBoxDefaults := [''];
        checkBoxHints := [''];
        comboBoxLabels := ['Type of Plank'];
        comboBoxDefaults := ['Oak'];

        setLength(comboBoxItems, length(comboBoxLabels));
        comboBoxItems[0] := ['Normal', 'Oak', 'Teak', 'Mahogany'];
      end;
    end;

    procedure declarePlayers();
    var
      i: integer;
    begin
      players.setup(playerForm.players);
      currentPlayer := 0;
      for i := 0 to high(players) do
        with players[i] do
        begin
        integers[0] := strToInt(playerForm.players[i].settings[0]); // Loads To Do

        //booleans[0] := strToBool(playerForm.players[i].settings[0]);

        strings[0] := playerForm.players[i].settings[1];            // Plank Type
        end;
    end;

    procedure debugSPFSettings();
    var
      i: integer;
    begin
      writeln('');

      for i := 0 to high(players) do
      begin
        writeLn('Loads To Do:             ',  players[i].integers[0]);
        writeLn('Plank Type:              ',  players[i].strings[0]);
      end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: loadDTMs                                                | }
    { | Description: Loads DTMs into script                                | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure loadDTMs();
    begin
     PlankDTM := DTMFromString('mbQAAAHicY2VgYOBmYmAQB2JmIOYEYn4glgZiASBWB2JNIJYDYjdTdaBqRhT8nwETMGLBYAAApJ8Cmg==');
     LogDTM := DTMFromString('mggAAAHicY2NgYHjCyMDwCYifA/EdIL4KxG+B+BcQ/wFiBiYGBhYgZgTiz0D+yr54oCAjBv7PgB1gqoRgCAAAPOEK/w==');
     TzhaarBankDTM := DTMFromString('mbQAAAHicY2VgYNjNyMAwFYi3APFhID4OxE1A3APENUBcD8SdQFyYkc1wY48uQ0RgEENuSjpDXmoGAxdQPzpmxILBAACXmQza');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isPlankBackPack                                          | }
    { | Description: Checks if there is a plank in backpack                | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isPlankBackpack(): boolean;
    var
      x, y: integer;
    begin
      if not gameTabs.openTab(TAB_BACKPACK) then
        exit;
      result := findDTM(plankDTM, x, y, tabBackpack.getBounds());
      if result then print('Planks found in backpack');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isLogBackPack                                            | }
    { | Description: Checks if there is are logs in backpack               | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isLogBackpack(): Boolean;
    var
      x, y: integer;
    begin
      if not gameTabs.openTab(TAB_BACKPACK) then
        exit;
      result := findDTM(logDTM, x, y, tabBackpack.getBounds());
      if result then print('Logs found in backpack');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isPlankInterfaceOpen                                     | }
    { | Description: Checks if the Plank Interface is open                 | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isPlankInterfaceOpen(): boolean;
    var
      x, y: integer;
      TPA: TPointArray;

    begin
      result := findColorsSpiralTolerance(x, y, TPA, 1514057, mainscreen.getBounds(), 3, colorSetting(2, 0.22, 1.39));
      if result then print('The plank interface is open');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: antiBan                                                 | }
    { | Description: Self-explanatory :P                                   | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure antiBan();
    var
      i: integer;
    begin
      if not isLoggedIn() then
        exit;
      writeLn('Engaging in antiban');

      i := random(500);
      case i of
          1..12: pickUpMouse();
          13..18: randomRClickItem();
          19..32: sleepAndMoveMouse(random(2000) + 750);
          33..85: mouseOffClient(OFF_CLIENT_RANDOM);
          86..120: mainScreen.setAngle(MS_ANGLE_HIGH);
          121..400: smallRandomMouse();
      end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Teleport to Fight Caves                                 | }
    { | Description: Teleport to Fight Caves if there are planks in invo   | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure teleBank();
    begin

      if not isLoggedin() then
        exit;

      if isPlankBackpack then
        typeSend('1', false);
        wait(randomRange(920, 1375));
      if ConversationBox.isOpen() then
        conversationBox.selectOption(5);
        wait(randomRange(2425, 2700));

    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Use Tzhaar Bank                                         | }
    { | Description: Find and left click banker, use bank preset button    | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure bankTzhaar();
    var
      x, y: integer
    begin
      if not isLoggedin() then
        exit;

      repeat
      if findDTM(TzhaarBankDTM, x, y, mainscreen.getBounds()) then
        begin
          mouse(x, y, 2, 2, MOUSE_MOVE);
            if isMouseOverText(['Bank', 'TzHaar-Mej-Jal']) then
            begin
              fastClick(MOUSE_LEFT);
              wait(randomRange(2400, 2650));
            end;
        end;
      until bankScreen.isOpen(500);

      bankScreen.clickButton(BANK_BUTTON_PRESET_1);
      wait(randomRange(500, 1200));
      exit;
    end;


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Teleport to Plank Maker                                 | }
    { | Description: Teleports to Taverley, walks to Plank Maker           | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure teleToPlanker();
    var
      pathToPlanker: TPointArray;
      p: TPoint;
    begin
      pathToPlanker := [Point(69, 121), Point(111, 91)];
      if not isLoggedin() then
      exit;

      if isLogBackpack() then
        lodestoneScreen.teleportTo(LOCATION_TAVERLEY);
        wait(randomRange(16000, 17500));

        if SPS.walkPath(pathToPlanker) then
        begin
        minimap.waitPlayerMoving();
        wait(randomRange(500,650));
        end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Open the Planking Interface                             | }
    { | Description: Find and right click Plank Maker                      | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure openPlankInterface();
    var
      x, y, i: integer;
    begin
     if not isLoggedIn() then
      exit;

      repeat
        mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['Talk-to'], MOUSE_RIGHT);
        wait(randomRange(1000, 2000));
        chooseOption.select(['Buy']);
        inc(i);
        wait(randomRange(1000, 2000));
      until isPlankInterfaceOpen() or (i >= 3);

    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: plankLogs                                               | }
    { | Description: Turn Logs into Planks                                 | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure plankLogs();
    var
      normalBox, oakBox, teakBox, mahoganyBox: TBox
    begin
    normalBox := intToBox(215, 310, 295, 325);
    oakBox := intToBox(455, 310, 535, 325);
    teakBox := intToBox(215, 455, 295, 470);
    mahoganyBox := intToBox(455, 455, 535, 470);

    if not isLoggedIn() then
          exit;

      wait(randomRange(500, 1000));

      writeLn('Made it to the plank logs procedure');
       begin
        case (players[currentPlayer].strings[0]) of
          'Normal':
            begin
              mouseBox(normalBox, MOUSE_LEFT);
              writeLn('Clicked on the Normal Plank "Buy All" option!');
            end;

          'Oak':
            begin
              mouseBox(oakBox, MOUSE_LEFT);
              writeLn('Clicked on the Oak Plank "Buy All" option!');
            end;

          'Teak':
            begin
              mouseBox(teakBox, MOUSE_LEFT);
              writeLn('Clicked on the Teak Plank "Buy All" option!');
            end;

          'Mahogany':
            begin
              mouseBox(mahoganyBox, MOUSE_LEFT);
              writeLn('Clicked on the Mahogany Plank "Buy All" option!');
            end;
        end;
       end;
    end;


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: mainLoop                                                | }
    { | Description: All that the script is or ever could be o.0           | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure mainLoop();
    begin

    if not isLoggedIn() then
      exit;

    repeat
    if isPlankBackpack() then
      begin
        teleBank();
        bankTzhaar();
      end else
        teleToPlanker();
        openPlankInterface();
        plankLogs();
        inc(LoadsDone);

    until loadsDone = players[currentPlayer].integers[0];

    if loadsDone >= players[currentPlayer].integers[0] then
      writeLn('Completed amount of requested loads!');
      terminateScript();
    end;

    begin
      clearDebug();
      initPlayerForm();
      runPlayerForm();
      SPS.setup('SouthTaverleyMap', RUNESCAPE_OTHER);
      loadDTMs();
      smartEnableDrawing := true;

      if (not playerForm.isScriptReady) then
        exit;

      declarePlayers();
      debugSPFSettings(); //this can be removed if I'm happy with script
      setupSRL();


      repeat
      if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        wait(gaussRangeInt(1500, 3500));
        exitSquealOfFortune();
        minimap.setAngle(MM_DIRECTION_NORTH);
        mainScreen.setAngle(MS_ANGLE_HIGH);
      end;


      mainLoop();

      until (false);

    end



    The procedure that is being faulty.

    Simba Code:
    procedure plankLogs();
    var
      normalBox, oakBox, teakBox, mahoganyBox: TBox
    begin
    normalBox := intToBox(215, 310, 295, 325);
    oakBox := intToBox(455, 310, 535, 325);
    teakBox := intToBox(215, 455, 295, 470);
    mahoganyBox := intToBox(455, 455, 535, 470);

    if not isLoggedIn() then
          exit;

      wait(randomRange(500, 1000));

      writeLn('Made it to the plank logs procedure');
       begin
        case (players[currentPlayer].strings[0]) of
          'Normal':
            begin
              mouseBox(normalBox, MOUSE_LEFT);
              writeLn('Clicked on the Normal Plank "Buy All" option!');
            end;

          'Oak':
            begin
              mouseBox(oakBox, MOUSE_LEFT);
              writeLn('Clicked on the Oak Plank "Buy All" option!');
            end;

          'Teak':
            begin
              mouseBox(teakBox, MOUSE_LEFT);
              writeLn('Clicked on the Teak Plank "Buy All" option!');
            end;

          'Mahogany':
            begin
              mouseBox(mahoganyBox, MOUSE_LEFT);
              writeLn('Clicked on the Mahogany Plank "Buy All" option!');
            end;
        end;
       end;
    end;


    writeLn('Made it to the plank logs procedure'); will output.
    But then it exits the procedure, and checks my inventory to see if it has logs and then does the next procedure
    @KeepBotting

  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 cbrems View Post
    Here is the most current version
    Simba Code:
    TzHaarPlanker;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I SPS/lib/SPS-RS3.Simba}
    {$i srl-6/lib/misc/srlplayerform.simba}

    {------------------------------------------------------------------------------)
                                       Instructions:

       1. Press play and fill out Player form
       2. Profit.

    (------------------------------------------------------------------------------)


    {------------------------------------------------------------------------------)

            DON'T TOUCH ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU'RE DOING!

    (------------------------------------------------------------------------------}


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /|' }
    { |                    Global Variable Declaration                     |' }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/|' }
    var
      { DTMs }
        PlankDTM, LogDTM, TzhaarBankDTM, LoadsDone: integer;

    procedure initPlayerForm();
    begin
      with playerForm do
      begin
        name := 'CBremsTzHaarPlanker';
        scriptHelpThread := 'To Be Added Upon Release';

        editBoxLabels := ['Loads To Do'];
        editBoxDefaults := ['1000'];
        editBoxHints := ['Number of Logs / 28'];
        checkBoxLabels := [''];
        checkBoxDefaults := [''];
        checkBoxHints := [''];
        comboBoxLabels := ['Type of Plank'];
        comboBoxDefaults := ['Oak'];

        setLength(comboBoxItems, length(comboBoxLabels));
        comboBoxItems[0] := ['Normal', 'Oak', 'Teak', 'Mahogany'];
      end;
    end;

    procedure declarePlayers();
    var
      i: integer;
    begin
      players.setup(playerForm.players);
      currentPlayer := 0;
      for i := 0 to high(players) do
        with players[i] do
        begin
        integers[0] := strToInt(playerForm.players[i].settings[0]); // Loads To Do

        //booleans[0] := strToBool(playerForm.players[i].settings[0]);

        strings[0] := playerForm.players[i].settings[1];            // Plank Type
        end;
    end;

    procedure debugSPFSettings();
    var
      i: integer;
    begin
      writeln('');

      for i := 0 to high(players) do
      begin
        writeLn('Loads To Do:             ',  players[i].integers[0]);
        writeLn('Plank Type:              ',  players[i].strings[0]);
      end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: loadDTMs                                                | }
    { | Description: Loads DTMs into script                                | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure loadDTMs();
    begin
     PlankDTM := DTMFromString('mbQAAAHicY2VgYOBmYmAQB2JmIOYEYn4glgZiASBWB2JNIJYDYjdTdaBqRhT8nwETMGLBYAAApJ8Cmg==');
     LogDTM := DTMFromString('mggAAAHicY2NgYHjCyMDwCYifA/EdIL4KxG+B+BcQ/wFiBiYGBhYgZgTiz0D+yr54oCAjBv7PgB1gqoRgCAAAPOEK/w==');
     TzhaarBankDTM := DTMFromString('mbQAAAHicY2VgYNjNyMAwFYi3APFhID4OxE1A3APENUBcD8SdQFyYkc1wY48uQ0RgEENuSjpDXmoGAxdQPzpmxILBAACXmQza');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isPlankBackPack                                          | }
    { | Description: Checks if there is a plank in backpack                | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isPlankBackpack(): boolean;
    var
      x, y: integer;
    begin
      if not gameTabs.openTab(TAB_BACKPACK) then
        exit;
      result := findDTM(plankDTM, x, y, tabBackpack.getBounds());
      if result then print('Planks found in backpack');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isLogBackPack                                            | }
    { | Description: Checks if there is are logs in backpack               | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isLogBackpack(): Boolean;
    var
      x, y: integer;
    begin
      if not gameTabs.openTab(TAB_BACKPACK) then
        exit;
      result := findDTM(logDTM, x, y, tabBackpack.getBounds());
      if result then print('Logs found in backpack');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Function: isPlankInterfaceOpen                                     | }
    { | Description: Checks if the Plank Interface is open                 | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    function isPlankInterfaceOpen(): boolean;
    var
      x, y: integer;
      TPA: TPointArray;

    begin
      result := findColorsSpiralTolerance(x, y, TPA, 1514057, mainscreen.getBounds(), 3, colorSetting(2, 0.22, 1.39));
      if result then print('The plank interface is open');
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: antiBan                                                 | }
    { | Description: Self-explanatory :P                                   | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure antiBan();
    var
      i: integer;
    begin
      if not isLoggedIn() then
        exit;
      writeLn('Engaging in antiban');

      i := random(500);
      case i of
          1..12: pickUpMouse();
          13..18: randomRClickItem();
          19..32: sleepAndMoveMouse(random(2000) + 750);
          33..85: mouseOffClient(OFF_CLIENT_RANDOM);
          86..120: mainScreen.setAngle(MS_ANGLE_HIGH);
          121..400: smallRandomMouse();
      end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Teleport to Fight Caves                                 | }
    { | Description: Teleport to Fight Caves if there are planks in invo   | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure teleBank();
    begin

      if not isLoggedin() then
        exit;

      if isPlankBackpack then
        typeSend('1', false);
        wait(randomRange(920, 1375));
      if ConversationBox.isOpen() then
        conversationBox.selectOption(5);
        wait(randomRange(2425, 2700));

    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Use Tzhaar Bank                                         | }
    { | Description: Find and left click banker, use bank preset button    | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure bankTzhaar();
    var
      x, y: integer
    begin
      if not isLoggedin() then
        exit;

      repeat
      if findDTM(TzhaarBankDTM, x, y, mainscreen.getBounds()) then
        begin
          mouse(x, y, 2, 2, MOUSE_MOVE);
            if isMouseOverText(['Bank', 'TzHaar-Mej-Jal']) then
            begin
              fastClick(MOUSE_LEFT);
              wait(randomRange(2400, 2650));
            end;
        end;
      until bankScreen.isOpen(500);

      bankScreen.clickButton(BANK_BUTTON_PRESET_1);
      wait(randomRange(500, 1200));
      exit;
    end;


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Teleport to Plank Maker                                 | }
    { | Description: Teleports to Taverley, walks to Plank Maker           | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure teleToPlanker();
    var
      pathToPlanker: TPointArray;
      p: TPoint;
    begin
      pathToPlanker := [Point(69, 121), Point(111, 91)];
      if not isLoggedin() then
      exit;

      if isLogBackpack() then
        lodestoneScreen.teleportTo(LOCATION_TAVERLEY);
        wait(randomRange(16000, 17500));

        if SPS.walkPath(pathToPlanker) then
        begin
        minimap.waitPlayerMoving();
        wait(randomRange(500,650));
        end;
    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: Open the Planking Interface                             | }
    { | Description: Find and right click Plank Maker                      | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure openPlankInterface();
    var
      x, y, i: integer;
    begin
     if not isLoggedIn() then
      exit;

      repeat
        mainscreen.findObject(x, y, 15389154, 8, colorSetting(2, 0.53, 091), mainscreen.PlayerPoint, 3, 3, 2, ['Talk-to'], MOUSE_RIGHT);
        wait(randomRange(1000, 2000));
        chooseOption.select(['Buy']);
        inc(i);
        wait(randomRange(1000, 2000));
      until isPlankInterfaceOpen() or (i >= 3);

    end;

    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: plankLogs                                               | }
    { | Description: Turn Logs into Planks                                 | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure plankLogs();
    var
      normalBox, oakBox, teakBox, mahoganyBox: TBox
    begin
    normalBox := intToBox(215, 310, 295, 325);
    oakBox := intToBox(455, 310, 535, 325);
    teakBox := intToBox(215, 455, 295, 470);
    mahoganyBox := intToBox(455, 455, 535, 470);

    if not isLoggedIn() then
          exit;

      wait(randomRange(500, 1000));

      writeLn('Made it to the plank logs procedure');
       begin
        case (players[currentPlayer].strings[0]) of
          'Normal':
            begin
              mouseBox(normalBox, MOUSE_LEFT);
              writeLn('Clicked on the Normal Plank "Buy All" option!');
            end;

          'Oak':
            begin
              mouseBox(oakBox, MOUSE_LEFT);
              writeLn('Clicked on the Oak Plank "Buy All" option!');
            end;

          'Teak':
            begin
              mouseBox(teakBox, MOUSE_LEFT);
              writeLn('Clicked on the Teak Plank "Buy All" option!');
            end;

          'Mahogany':
            begin
              mouseBox(mahoganyBox, MOUSE_LEFT);
              writeLn('Clicked on the Mahogany Plank "Buy All" option!');
            end;
        end;
       end;
    end;


    { |\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /\  /| }
    { | Procedure: mainLoop                                                | }
    { | Description: All that the script is or ever could be o.0           | }
    { |__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/| }
    procedure mainLoop();
    begin

    if not isLoggedIn() then
      exit;

    repeat
    if isPlankBackpack() then
      begin
        teleBank();
        bankTzhaar();
      end else
        teleToPlanker();
        openPlankInterface();
        plankLogs();
        inc(LoadsDone);

    until loadsDone = players[currentPlayer].integers[0];

    if loadsDone >= players[currentPlayer].integers[0] then
      writeLn('Completed amount of requested loads!');
      terminateScript();
    end;

    begin
      clearDebug();
      initPlayerForm();
      runPlayerForm();
      SPS.setup('SouthTaverleyMap', RUNESCAPE_OTHER);
      loadDTMs();
      smartEnableDrawing := true;

      if (not playerForm.isScriptReady) then
        exit;

      declarePlayers();
      debugSPFSettings(); //this can be removed if I'm happy with script
      setupSRL();


      repeat
      if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        wait(gaussRangeInt(1500, 3500));
        exitSquealOfFortune();
        minimap.setAngle(MM_DIRECTION_NORTH);
        mainScreen.setAngle(MS_ANGLE_HIGH);
      end;


      mainLoop();

      until (false);

    end



    The procedure that is being faulty.

    Simba Code:
    procedure plankLogs();
    var
      normalBox, oakBox, teakBox, mahoganyBox: TBox
    begin
    normalBox := intToBox(215, 310, 295, 325);
    oakBox := intToBox(455, 310, 535, 325);
    teakBox := intToBox(215, 455, 295, 470);
    mahoganyBox := intToBox(455, 455, 535, 470);

    if not isLoggedIn() then
          exit;

      wait(randomRange(500, 1000));

      writeLn('Made it to the plank logs procedure');
       begin
        case (players[currentPlayer].strings[0]) of
          'Normal':
            begin
              mouseBox(normalBox, MOUSE_LEFT);
              writeLn('Clicked on the Normal Plank "Buy All" option!');
            end;

          'Oak':
            begin
              mouseBox(oakBox, MOUSE_LEFT);
              writeLn('Clicked on the Oak Plank "Buy All" option!');
            end;

          'Teak':
            begin
              mouseBox(teakBox, MOUSE_LEFT);
              writeLn('Clicked on the Teak Plank "Buy All" option!');
            end;

          'Mahogany':
            begin
              mouseBox(mahoganyBox, MOUSE_LEFT);
              writeLn('Clicked on the Mahogany Plank "Buy All" option!');
            end;
        end;
       end;
    end;


    writeLn('Made it to the plank logs procedure'); will output.
    But then it exits the procedure, and checks my inventory to see if it has logs and then does the next procedure
    @KeepBotting
    I think the SRL player form might be an issue.

    1. In declarePlayers(), you have .settings[1] commented as "Plank Type"
    2. In debugSpfSettings(), you have .strings[0] commented as "Plank Type"
    3. But in the faulty procedure, your case statement is looking at .strings[0]

    So, here, try this:

    Simba Code:
    procedure plankLogs();
    var
      normalBox, oakBox, teakBox, mahoganyBox: TBox
    begin
    normalBox := intToBox(215, 310, 295, 325);
    oakBox := intToBox(455, 310, 535, 325);
    teakBox := intToBox(215, 455, 295, 470);
    mahoganyBox := intToBox(455, 455, 535, 470);

    if not isLoggedIn() then
          exit;

      wait(randomRange(500, 1000));

      players[currentPlayer].strings[0] := 'Oak'; //I've forcibly assigned a value to what
                                                  //the case statement is checking. If this
                                                  //procedure runs after making this change
                                                  //(I'm confident that it will), then you
                                                  //Know it's an issue with your player form settings

      writeLn('Made it to the plank logs procedure');
       begin
        case (players[currentPlayer].strings[0]) of
          'Normal':
            begin
              mouseBox(normalBox, MOUSE_LEFT);
              writeLn('Clicked on the Normal Plank "Buy All" option!');
            end;

          'Oak':
            begin
              mouseBox(oakBox, MOUSE_LEFT);
              writeLn('Clicked on the Oak Plank "Buy All" option!');
            end;

          'Teak':
            begin
              mouseBox(teakBox, MOUSE_LEFT);
              writeLn('Clicked on the Teak Plank "Buy All" option!');
            end;

          'Mahogany':
            begin
              mouseBox(mahoganyBox, MOUSE_LEFT);
              writeLn('Clicked on the Mahogany Plank "Buy All" option!');
            end;
        end;
       end;
    end;

    I think you may have been using a string at one point, then switch the player form to use a comboBox (and thus a setting) but forgot it change it elsewhere - the rest of the script is still looking for that string

    E: I really don't know how the player form works though (have yet to read up on it) so I apologise in advance if that's not the issue
    Last edited by KeepBotting; 03-07-2015 at 03:04 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

  14. #14
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    I think the SRL player form might be an issue.

    1. In declarePlayers(), you have .settings[1] commented as "Plank Type"
    2. In debugSpfSettings(), you have .strings[0] commented as "Plank Type"
    3. But in the faulty procedure, your case statement is looking at .strings[0]

    So, here, try this:

    Simba Code:
    procedure plankLogs();
    var
      normalBox, oakBox, teakBox, mahoganyBox: TBox
    begin
    normalBox := intToBox(215, 310, 295, 325);
    oakBox := intToBox(455, 310, 535, 325);
    teakBox := intToBox(215, 455, 295, 470);
    mahoganyBox := intToBox(455, 455, 535, 470);

    if not isLoggedIn() then
          exit;

      wait(randomRange(500, 1000));

      players[currentPlayer].strings[0] := 'Oak'; //I've forcibly assigned a value to what
                                                  //the case statement is checking. If this
                                                  //procedure runs after making this change
                                                  //(I'm confident that it will), then you
                                                  //Know it's an issue with your player form settings

      writeLn('Made it to the plank logs procedure');
       begin
        case (players[currentPlayer].strings[0]) of
          'Normal':
            begin
              mouseBox(normalBox, MOUSE_LEFT);
              writeLn('Clicked on the Normal Plank "Buy All" option!');
            end;

          'Oak':
            begin
              mouseBox(oakBox, MOUSE_LEFT);
              writeLn('Clicked on the Oak Plank "Buy All" option!');
            end;

          'Teak':
            begin
              mouseBox(teakBox, MOUSE_LEFT);
              writeLn('Clicked on the Teak Plank "Buy All" option!');
            end;

          'Mahogany':
            begin
              mouseBox(mahoganyBox, MOUSE_LEFT);
              writeLn('Clicked on the Mahogany Plank "Buy All" option!');
            end;
        end;
       end;
    end;

    I think you may have been using a string at one point, then switch the player form to use a comboBox (and thus a setting) but forgot it change it elsewhere - the rest of the script is still looking for that string

    E: I really don't know how the player form works though (have yet to read up on it) so I apologise in advance if that's not the issue
    You right =D

    -- The plank interface is open
    Made it to the plank logs procedure
    Clicked on the Oak Plank "Buy All" option!

    It gave me the output finally, but still no click for some reason ... it doesn't even go to the box

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

    Default

    Quote Originally Posted by cbrems View Post
    You right =D

    -- The plank interface is open
    Made it to the plank logs procedure
    Clicked on the Oak Plank "Buy All" option!

    It gave me the output finally, but still no click for some reason ... it doesn't even go to the box
    That's weird o_O the writeln runs but the mousebox doesn't? Seems impossible ... does it happen with every case in the case statement?
    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

  16. #16
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    That's weird o_O the writeln runs but the mousebox doesn't? Seems impossible ... does it happen with every case in the case statement?
    I had to go to work so couldn't test it :P
    I remade the mouse box to make sure to coordinates were spot on but it still misses and I don't believe it's left clicking. I'll get back to you after I'm able to try it again on my tablet, probably in like 2 hours

  17. #17
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Quote Originally Posted by cbrems View Post
    I had to go to work so couldn't test it :P
    I remade the mouse box to make sure to coordinates were spot on but it still misses and I don't believe it's left clicking. I'll get back to you after I'm able to try it again on my tablet, probably in like 2 hours
    I lied, it will click but it wont click on the coordinates I specify...I set all four coordinates to the same "buy all" box on the interface but it still goes and click the 8 slot in the action bar? I triple checked it, my coordinates are correct..

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

    Default

    Quote Originally Posted by cbrems View Post
    I lied, it will click but it wont click on the coordinates I specify...I set all four coordinates to the same "buy all" box on the interface but it still goes and click the 8 slot in the action bar? I triple checked it, my coordinates are correct..
    Did you drag Simba's crosshair to the SMART window before picking the coords?
    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

  19. #19
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    Did you drag Simba's crosshair to the SMART window before picking the coords?
    I have never done that before, didn't know i had to o.0
    I did get it to work tho, I stole Mayor's coords from his script and moved my interface so it was correct

    I watched it run for like 3 hours at work to make sure it was doing well, I have some issues with the banking process because sometimes it teleports too far from the banker so hopefully after I fix that its stable enough to release

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

    Default

    Quote Originally Posted by cbrems View Post
    I have never done that before, didn't know i had to o.0
    I did get it to work tho, I stole Mayor's coords from his script and moved my interface so it was correct

    I watched it run for like 3 hours at work to make sure it was doing well, I have some issues with the banking process because sometimes it teleports too far from the banker so hopefully after I fix that its stable enough to release
    Yes, if you don't set a window with the crosshair, the coordinates displayed in the bottom-left of Simba are relative to the origin (0,0) of your desktop, not the RS window. SMART's mouse obviously can't move outside its own bounds, so nothing is ever clicked.

    Ideally you'd not use static coordinates at all, but rather a bitmap or DTM. Also if by "moved my interface" you mean you've altered the interface in RS itself, that's not best because now everyone using your script will have to adjust their interface in the exact same way.

    The issue with teleporting too far away from the banker can be solved by re-locating after teleporting, best done with SPS or a DTM of the place on the minimap you want to be
    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

  21. #21
    Join Date
    Sep 2014
    Posts
    112
    Mentioned
    5 Post(s)
    Quoted
    55 Post(s)

    Default

    Thank you so much

    I will remake the coordinates so that they will be correct for everyone by default, I think if I deleted all the jagex files it will all go to default...
    Also, there isn't a bank icon at the banker, but I think I'll be able to fix the banking easy enough

    Again, thanks for your help!

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
  •