Jabs 0 Share Posted February 24, 2021 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 More sharing options...
Jabs 0 Author Share Posted February 24, 2021 Sorry if i posted it at the wrong location Link to comment Share on other sites More sharing options...
Hashtag 8691 Share Posted February 24, 2021 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 More sharing options...
Jabs 0 Author Share Posted February 24, 2021 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.