Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Create random click locations


    Jabs

    Recommended Posts

    Hi guys, yesterday I created my first ever Master Farmer thieving bot.

    And rightnow it works amazing. I am now working on perfecting my antiban. 

    How ever. i notice that when ever I am interacting with a Master Farmer, it clicks on the same location, can I make it that it will click but with random pixels offset?

    So instead of click on the same location all the time. It will move a little bit.

     

    image.png.ea7f4b8d533dca82e8bb10b78ce0e02f.png

     

    This is my current Steal piece of code.

    My bot is also supporting banking. Rightnow if my inventory is full. I run to the closest bank location. But a second after it tries to interact with the Banker NPC even tho its not near enough at the bank location making it stuck behind a wall. Rightnow i fixed it by adding a sleep so it waits before it is at a location.

     

    How Can i optimize this piece of code?

    image.png.8aca18a32431c99bf9785a3e8904fecc.png

     

    Thanks in advance guys!

     

    Link to comment
    Share on other sites

    You could calculate a point close to your current mouse position, verify it's within the bounds of the entity and move the mouse to the calculated point.

    Currently you're relying too much on basic sleeps and are executing multiple actions one after another. This isn't reliable as you mentioned. To fix this, modify your code to execute only a single action per loop. This can be achieved by writing something along the lines of

    private void bank() {
      if (Bank.isOpen()) {
        if (Bank.depositAllItems()) {
          MethodProvider.sleepUntil(Inventory::isEmpty, 3000); 
        }
      } else {
        if (bankArea.contains(Client.getLocalPlayer()) {
          NPC banker = NPCs.closest(...);
          if (banker != null && banker.interact("Bank")) {
           	MethodProvider.sleepUntil(Bank::isOpen, Client.getLocalPlayer()::isMoving, 3000, 100); 
          }
        } else {
          // walk to bank area 
        }
      }
    }

    Notice how I added a bunch of if-statements to determine which action should be executed. Only execute one action, maybe add a proper sleepUntil after that and then let onLoop be called again to determine next action instead of relying on basic sleeps.

    Also, you wouldn't want to increase your thieveCount variable value when you click the NPC, because that's not reliable either. Instead, you could utilize ChatListener or InventoryListener for this, or even a proper sleepUntil inside an if-statement.

    Link to comment
    Share on other sites

    Thank you for the banking code, I will try to modify my script.

    For the random clicks I have to do some more research in the api then. How to calculate current mouse position ect. But thank you for the idea! And thanks for the help!

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.