March 15, 201510 yr 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.
March 15, 201510 yr 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.
March 15, 201510 yr do { sleep(10); } while(myPlayer().isAnimating()); not the best way of doing it but it should work
March 16, 201510 yr 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.
March 16, 201510 yr 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, 201510 yr by Nightchillz
March 16, 201510 yr 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.
March 16, 201510 yr 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.
March 16, 201510 yr 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); }
March 16, 201510 yr 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.
Create an account or sign in to comment