Jusple Posted March 15, 2015 Posted March 15, 2015 Title says it all, Script interacts with furnace, chooses a bar and types a random number. My question is, is there a specific way to stop that loop and continue after its done? or do I have to make some kind of timer. cheers.
VladBots Posted March 15, 2015 Posted March 15, 2015 You need to make a system so it stops re-interacting while it is smelting. Sleeping for a long time is not a good idea.
Rudie Posted March 15, 2015 Posted March 15, 2015 Just use: if(!myPlayer().isAnimating()) { smelt sleep }
Reid Posted March 15, 2015 Posted March 15, 2015 do { sleep(10); } while(myPlayer().isAnimating()); not the best way of doing it but it should work
Tom Posted March 16, 2015 Posted March 16, 2015 do { sleep(10); } while(myPlayer().isAnimating()); not the best way of doing it but it should work The animation stops between each bar that is smelted. The best way to do this is to record the currentTimeMillis when the player is animating, then check if that recorded time has been increased by x amount of milliseconds, and if thats true then allow it to continue. I can show you a snippet perhaps when I get home.
Nightchillz Posted March 16, 2015 Posted March 16, 2015 (edited) private State getState() { if (inventory.isFull()) return State.Bankrun or whatever you are using link to your Banking Enum... I think? im learning Edited March 16, 2015 by Nightchillz
Tom Posted March 16, 2015 Posted March 16, 2015 private State getState() { if (inventory.isFull()) return State.Bankrun or whatever you are using link to your Banking Enum... I think? im learning Depending on what you smelt, you are never going to have a full inventory.
Rudie Posted March 16, 2015 Posted March 16, 2015 The animation stops between each bar that is smelted. The best way to do this is to record the currentTimeMillis when the player is animating, then check if that recorded time has been increased by x amount of milliseconds, and if thats true then allow it to continue. I can show you a snippet perhaps when I get home. Just add a sleep long enough till it animates again if it will take 1 second for it to animate again add a sleep of 1000ms before the smelt method.
Tom Posted March 16, 2015 Posted March 16, 2015 Just add a sleep long enough till it animates again if it will take 1 second for it to animate again add a sleep of 1000ms before the smelt method. You would have to return out of the method, a simple method like this would work better public boolean canAnimate(){ return System.currentTimeMillis() > (lastAnimation + 3000); }
Rudie Posted March 16, 2015 Posted March 16, 2015 You would have to return out of the method, a simple method like this would work better public boolean canAnimate(){ return System.currentTimeMillis() > (lastAnimation + 3000); } Yes, that would indeed be a better solution.