Results 1 to 11 of 11

Thread: First Script - Portable Forge

  1. #1
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    264
    Mentioned
    11 Post(s)
    Quoted
    130 Post(s)

    Talking First Script - Portable Forge

    Hi,

    I would like to present my first script. The goal is to create a script that supports all portables on all the main places. Just posting this to get some feedback, to improve my scripting skills.

    The script doesn't have any antiban as of jet. Will be implemented.

    Thanks in advance!

    Simba Code:
    program scriptTemplate;

    {$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 := 'zezima';
        password := 'botting24/7';
        isActive := true;
        isMember := true;
      end
      currentPlayer := 0;
    end;

    procedure useBank();
    var
      arP: TPointArray;
      ATPA: T2DPointArray;
      x, y, i: integer;

    begin
      if not IsLoggedIn then
        Exit;

      if bankScreen.isOpen(BANK_CHEST_LUMBRIDGE) then
      begin
        writeLn('Bank already open.');
        exit;
      end;
      bankScreen.open(BANK_CHEST_LUMBRIDGE);
      Wait(gaussRangeInt(500, 1300));
      exit;
    end;

    procedure findingForge();

    var
      arP, arAP: TPointArray;
      x, y, i, forgeWaitCount: integer;
      bushTPA: TPointArray;
      ATPA: T2DPointArray;
      TPA: TPointArray;
      waitTimer: TTimeMarker;
      b: Boolean;

    begin
    waitTimer.reset();
    waitTimer.start();

    if (bankScreen.isOpen(BANK_CHEST_LUMBRIDGE)) then
    begin
      bankScreen.clickButton(BANK_BUTTON_PRESET_1);
      repeat
        begin
          mainscreen.findObject(x, y, 1663163, 6, colorSetting(2, 0.36, 1.44), mainscreen.playerPoint, 15, 15, 15, ['orge'], 3);
          WriteLn('Looking for forge:' + BoolToStr(b));
          Wait(gaussRangeInt(1000, 2000));
        end;
        if (Length(TPA) < 2) then
        begin

            if isMouseOverText(['orge'], 200) then
            begin
              fastClick(MOUSE_LEFT);
              break;
            end;
        end;
      until (productionScreen.isOpen) or (waitTimer.getTime() > 200000);
    end;
    if (waitTimer.GetTime() > 200000) then
    begin
      WriteLn('couldn''t find portable, terminating script');
      TerminateScript();
    end;
    end;

    procedure usingForge();
    var
      i: integer;
    begin
      Wait(gaussRangeInt(700, 1100));
      if (productionScreen.isOpen) then
      begin
        productionScreen.clickStart(true);
          repeat
          begin
          wait(gaussRangeInt(1000, 1500));
          WriteLn('waiting');
          end;
          until (progressScreen.isOpen = false);
          wait(gaussRangeInt(500, 1000));
      end;
      findingForge;
    end;

    {Main Loop}
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
      if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        exitTreasure();
        mainScreen.setAngle(MS_ANGLE_HIGH);
        minimap.setAngle(MM_DIRECTION_WEST);
      end;
      repeat
        useBank();
        findingForge();
        usingForge();
      until(false);
    end.
    Last edited by SlipperyPickle; 01-01-2015 at 09:53 PM.

  2. #2
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    264
    Mentioned
    11 Post(s)
    Quoted
    130 Post(s)

    Default

    Bump for feedback

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

    Default

    Nice work

    Quote Originally Posted by Suikerwafel View Post
    Bump for feedback
    Simba Code:
    program scriptTemplate;

    {$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 := 'zezima';
        password := 'botting24/7';
        isActive := true;
        isMember := true;
      end
      currentPlayer := 0;
    end;

    procedure useBank();
    var
      arP: TPointArray;    // You don't use any of these variables?
      ATPA: T2DPointArray;
      x, y, i: integer;

    begin
      if not IsLoggedIn then
        Exit;
                            // The parameter for isOpen is wait time: isOpen(waitTime), isOpen(5000)
      if bankScreen.isOpen(BANK_CHEST_LUMBRIDGE) then
      begin
        writeLn('Bank already open.');
        exit;
      end;                                  // You can actually remove the block above
      bankScreen.open(BANK_CHEST_LUMBRIDGE);// as bs.open() calls bs.isOpen() before looking for the bank
      Wait(gaussRangeInt(500, 1300));
      exit;   // Why exit when you are already at the end of the procedure? You will exit anyway.
    end;

    procedure findingForge();

    var
      arP, arAP: TPointArray;
      x, y, i, forgeWaitCount: integer;
      bushTPA: TPointArray; // lol, spaceblow's redberry gatherer :p ?
      ATPA: T2DPointArray;
      TPA: TPointArray;
      waitTimer: TTimeMarker;
      b: Boolean;

    begin // everything should be tabbed (indented )
    waitTimer.reset(); // no need to reset it, since you declared it locally here (it will be 0 each time you start this procedure)
    waitTimer.start();

    if (bankScreen.isOpen(BANK_CHEST_LUMBRIDGE)) then  // Again, the CHEST_LUMBRIDGE is actually an integer constant (10)
    begin                                              // so this is just writing isOpen(10);
      bankScreen.clickButton(BANK_BUTTON_PRESET_1);
      repeat
        begin // Don't need this begin..end. They should only follow a conditional if..then.. etc (it's always gonna run so no need for it)
          mainscreen.findObject(x, y, 1663163, 6, colorSetting(2, 0.36, 1.44), mainscreen.playerPoint, 15, 15, 15, ['orge'], 3);
          WriteLn('Looking for forge:' + BoolToStr(b)); // What is this bool for? It will always return false
          Wait(gaussRangeInt(1000, 2000));
        end;
        if (Length(TPA) < 2) then  // Your ms.findObject code above doesn't output any TPAs?
        begin                      // Fidd object also moves/clicks the mouse, so this block is redundant

            if isMouseOverText(['orge'], 200) then
            begin
              fastClick(MOUSE_LEFT);
              break;
            end;
        end;
      until (productionScreen.isOpen) or (waitTimer.getTime() > 200000);  // You could isOpen(5000) or something
    end;                                                                  // to wait for up to 5sec after clicking it
    if (waitTimer.GetTime() > 200000) then
    begin
      WriteLn('couldn''t find portable, terminating script');
      TerminateScript();
    end;
    end;

    procedure usingForge();
    var
      i: integer; // You don't use this
    begin
      Wait(gaussRangeInt(700, 1100));
      if (productionScreen.isOpen) then
      begin
        productionScreen.clickStart(true);
          repeat
          begin
          wait(gaussRangeInt(1000, 1500));   // messy indentation, hard to read
          WriteLn('waiting');
          end;
          until (progressScreen.isOpen = false); // could also (not progressScreen.isOpen())
          wait(gaussRangeInt(500, 1000));
      end;
      findingForge;
    end;

    {Main Loop}
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
      if not isLoggedIn() then  // I'd put this block inside the repeat loop below
      begin                     // so it will check if you're logged out each loop
        players[currentPlayer].login();
        exitTreasure();
        mainScreen.setAngle(MS_ANGLE_HIGH);
        minimap.setAngle(MM_DIRECTION_WEST);
      end;
      repeat
        useBank();
        findingForge();
        usingForge();
      until(false);
    end.

  4. #4
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    264
    Mentioned
    11 Post(s)
    Quoted
    130 Post(s)

    Default

    Thank you for the feedback! Nice you took the effort to help me! I have to admit the code is a bit messy. And I used many scripts as example, that's the reason for some of the useless variables Will use your feedback and report back

    Thanks!

  5. #5
    Join Date
    Oct 2014
    Location
    With ezreal~
    Posts
    295
    Mentioned
    45 Post(s)
    Quoted
    255 Post(s)

    Default

    From one noob working with portables to another, good job!

    Idk what the mo' betterer simba scripters use for failsafes, but one of the ways I make sure my script opens up the bank and selects the proper preset is by doing:
    Simba Code:
    repeat
      bankScreen.open(BANK_CHEST_SHANTAY);
      wait(randomRange(600, 800));
      until(bankScreen.isOpen());
      repeat
      if (bankPreset > 1) then //I let mah users choose which bank preset they wanna use.
      begin
        bankScreen.clickButton(BANK_BUTTON_PRESET_2);
      end else
        bankScreen.clickButton(BANK_BUTTON_PRESET_1);
      wait(randomRange(600, 800));
      until not(bankScreen.isOpen());

    Also, I laughed at the zezima pun.

  6. #6
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    264
    Mentioned
    11 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by pizzapants View Post
    From one noob working with portables to another, good job!

    Idk what the mo' betterer simba scripters use for failsafes, but one of the ways I make sure my script opens up the bank and selects the proper preset is by doing:
    Simba Code:
    repeat
      bankScreen.open(BANK_CHEST_SHANTAY);
      wait(randomRange(600, 800));
      until(bankScreen.isOpen());
      repeat
      if (bankPreset > 1) then //I let mah users choose which bank preset they wanna use.
      begin
        bankScreen.clickButton(BANK_BUTTON_PRESET_2);
      end else
        bankScreen.clickButton(BANK_BUTTON_PRESET_1);
      wait(randomRange(600, 800));
      until not(bankScreen.isOpen());

    Also, I laughed at the zezima pun.
    Yeah, stupid, accidentally left my username and pass in the script

    But thanks for the feedback!

  7. #7
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    264
    Mentioned
    11 Post(s)
    Quoted
    130 Post(s)

    Default

    Update
    Updated my script. It now runs much better.

    ToDo:
    - Fix the problem where it sometimes banks twice;
    - Fancy paint;
    - AIO portable script;
    - More banking spots.

    Simba Code:
    program scriptTemplate;

    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I SPS/lib/SPS-RS3.Simba}

    const
      bankPreset := 1;
      WhichOres  := 5;
                      // 1  = Bronze
                      // 2  = Blurite
                      // 3  = Iron
                      // 4  = Silver
                      // 5  = Steel
                      // 6  = Gold
                      // 7  = Perfect gold
                      // 8  = Mith
                      // 9  = Addy
                      // 15 = Rune


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

    procedure antiBan();
    var
      i: Integer;

    begin
      if not isLoggedIn() then
        exit;

      if i < 41 then
      begin
        case i of
          0..9:   mouseMovingObject();
          10..20:  sleepAndMoveMouse(500);
          21..30: sleepAndMoveMouse(randomRange(100, 900));
          31..39: begin
                    mouseOffClient(random(4));
                    wait(randomRange(1000, 5000));
                  end;
          40..41: begin
                    mouseOffClient(random(4));
                    wait(randomRange(5000, 10000));
                  end;
        end;
      end;
    end;

    procedure useBank();
    begin
      if not IsLoggedIn then
        Exit;

      if bankScreen.isOpen then
        exit;

      bankScreen.open(BANK_CHEST_LUMBRIDGE);
      Wait(gaussRangeInt(700, 1100));
    end;

    procedure usePreset();
    begin
      if bankScreen.isOpen(5000) then
        bankScreen.clickButton(BANK_BUTTON_PRESET_1)
      else
        useBank
    end;

    procedure findingForge();
    var
      x, y: integer;
      waitTimer: TTimeMarker;

    begin
      waitTimer.start();

      if (not tabBackpack.isFull()) and (not tabBackpack.isFull()) and (not tabBackpack.isFull()) then
      useBank;

      if bankScreen.isOpen then
        usePreset;

      repeat
        mainscreen.findObject(x, y, 1663163, 6, colorSetting(2, 0.36, 1.44), mainscreen.playerPoint, 15, 15, 15, ['orge'], 3);

        if isMouseOverText(['orge'], 200) then
          begin
            fastClick(MOUSE_LEFT);
            break;
          end;
      until (productionScreen.isOpen(5000)) or (waitTimer.getTime() > 200000);

      if (waitTimer.GetTime() > 200000) then
      begin
        WriteLn('couldn''t find portable, terminating script');
        TerminateScript();
      end;
    end;

    procedure usingForge();
    begin

      Wait(gaussRangeInt(700, 1100));
      if (productionScreen.isOpen(500)) then
          productionScreen.selectBox(WhichOres);
          productionScreen.clickStart(true);
    end;

    procedure waitingForge();
    begin
      Wait(gaussRangeInt(1000, 1100));
      if(not progressScreen.isOpen()) then
      exit;

      repeat
        wait(1000);
        antiBan();
        writeLn('waiting');
      until (not progressScreen.isOpen()) and (not progressScreen.isOpen()) and (not progressScreen.isOpen());
    end;

    {Main Loop}
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
      mainScreen.setAngle(MS_ANGLE_HIGH);
      minimap.setAngle(MM_DIRECTION_WEST);

      repeat
        if not isLoggedIn() then
        begin
          players[currentPlayer].login();
          exitTreasure();
          mainScreen.setAngle(MS_ANGLE_HIGH);
          minimap.setAngle(MM_DIRECTION_WEST);
        end;

        useBank();
        usePreset();
        findingForge();
        usingForge();
        waitingForge();
      until(false);
    end.

  8. #8
    Join Date
    Apr 2012
    Posts
    31
    Mentioned
    1 Post(s)
    Quoted
    11 Post(s)

    Default

    Congrats on the release! This looks really useful, I'll be checking it out in the future.

  9. #9
    Join Date
    Dec 2014
    Posts
    188
    Mentioned
    3 Post(s)
    Quoted
    100 Post(s)

    Default

    Works great!

  10. #10
    Join Date
    Dec 2014
    Posts
    188
    Mentioned
    3 Post(s)
    Quoted
    100 Post(s)

    Default

    Can this work with Gold casting? Forget, it works

  11. #11
    Join Date
    Aug 2013
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    This looks like a nice script. I cannot wait to try and break the script and let you know what errors i find.

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
  •