swiffyp Posted November 27, 2016 Posted November 27, 2016 (edited) Hi. My script uses dwarf cannon and I have to make it pick up the cannon when the "pause" method is called so that it doesn't dissapear during breaks. The only problem is that the pause method is also called by regular random events, causing the cannon to have to be picked-up and replaced many times an hour. So my question is as the title suggests. Is there anyway to seperate the client's breakhandler from regular random events? Perhaps there is a different method then "pause", something like "onBreak"? I've tried looking in the API but it seems that they're both using the same abstract main interface class. Thanks! Edited November 27, 2016 by swiffyp
Explv Posted November 27, 2016 Posted November 27, 2016 Hi. My script uses dwarf cannon and I have to make it pick up the cannon when the "pause" method is called so that it doesn't dissapear during breaks. The only problem is that the pause method is also called by regular random events, causing the cannon to have to be picked-up and replaced many times an hour. So my question is as the title suggests. Is there anyway to seperate the client's breakhandler from regular random events? Perhaps there is a different method then "pause", something like "onBreak"? I've tried looking in the API but it seems that they're both using the same abstract main interface class. Thanks! You could try doing something like this: @ Override public void pause() { if (getBot().getRandomExecutor().getTimeUntilBreak() == 0) { pickUpCannon(); } } 1
House Posted November 27, 2016 Posted November 27, 2016 You could try doing something like this: @ Override public void pause() { if (getBot().getRandomExecutor().getTimeUntilBreak() == 0) { pickUpCannon(); } } This ^ Also good to mention getTimeUntilBreak() returns the time in minutes OR you can write your own break manager with -allow norandoms 2
swiffyp Posted November 27, 2016 Author Posted November 27, 2016 You could try doing something like this: @ Override public void pause() { if (getBot().getRandomExecutor().getTimeUntilBreak() == 0) { pickUpCannon(); } } Will test this when I get home, thanks a bunch pal!