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
  • Try asking for help in the chatbox
  • Create random click locations


    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.




    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?



    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

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    • 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.