iTz EcLiPsE Posted January 9, 2016 Share Posted January 9, 2016 ok so im using apaecs tea thiever and ive been rewriting it myself or at least trying to and only using bits and pieces of his tut code the issue im running into and what im wondering how to get rid of is when it clicks the tea stall to thief it clicks 4 times instead of once and in different locations is there a way i can change that so it clicks in 1 spot so it doesnt end up running off and getting stuck behind the stall? Quote Link to comment Share on other sites More sharing options...
September Posted January 9, 2016 Share Posted January 9, 2016 (edited) You could add a check for where your character stands before thieving. So it makes sure it's standing at those coordinates before it thieves. And if it isn't you can make it walk to that tile. Also you need to have a sleep after clicking otherwise it will try to spamclick the thieving stall because it checks for the stall multiple times before it is actually thieved. Because the tea stall doesn't become empty right at the moment you click it right? Edited January 9, 2016 by September Quote Link to comment Share on other sites More sharing options...
iTz EcLiPsE Posted January 9, 2016 Author Share Posted January 9, 2016 You could add a check for where your character stands before thieving. So it makes sure it's standing at those coordinates before it thieves. And if it isn't you can make it walk to that tile. Also you need to have a sleep after clicking otherwise it will try to spamclick the thieving stall because it checks for the stall multiple times before it is actually thieved. Because the tea stall doesn't become empty right at the moment you click it right? yea it spam clicks but it clicks all the points on the stall that have the "Steal-from" option but yea that would prolly do it to add a sleep after the first click.. u thing 1000 is long enough or should i made it a little longer? and im not entirely sure where to put the sleep in the code the sleep worked lol idk if its codes the prettiest but it works lmao thank you Quote Link to comment Share on other sites More sharing options...
Explv Posted January 9, 2016 Share Posted January 9, 2016 (edited) yea it spam clicks but it clicks all the points on the stall that have the "Steal-from" option but yea that would prolly do it to add a sleep after the first click.. u thing 1000 is long enough or should i made it a little longer? and im not entirely sure where to put the sleep in the code the sleep worked lol idk if its codes the prettiest but it works lmao thank you I have rewritten it slightly. I put the onLoop code inside if(!myPlayer().isAnimating()) so that it will not click the Tea stall if it is already thieving. Then I added a ConditionalSleep after the interaction, which stops sleeping when the player has begun animating. (untested) import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "You", info = "My first script", name = "Tea thiever", version = 1.0, logo = "") public class TeaStealer extends Script { private enum State { STEAL, DROP } @Override public int onLoop() throws InterruptedException { if(!myPlayer().isAnimating()) { switch (getState()) { case STEAL: steal(); break; case DROP: drop(); break; } } return random(200, 300); } private State getState() { if(getInventory().isFull()) return State.DROP; return State.STEAL; } private void steal(){ Entity stall = getObjects().closest("Tea stall"); if (stall != null) { stall.interact("Steal-from"); new ConditionalSleep(2000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } } private void drop(){ getInventory().dropAll(); } } Edited January 9, 2016 by Explv Quote Link to comment Share on other sites More sharing options...
iTz EcLiPsE Posted January 9, 2016 Author Share Posted January 9, 2016 Nice I just added a random sleep 1100,1200 between the "steal" and the "break" and it worked but your method seems alot more reliable and the right way thanks for the pointer Quote Link to comment Share on other sites More sharing options...