swiffyp Posted November 27, 2016 Share 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 Quote Link to comment Share on other sites More sharing options...
Explv Posted November 27, 2016 Share 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 Quote Link to comment Share on other sites More sharing options...
House Posted November 27, 2016 Share 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 Quote Link to comment Share on other sites More sharing options...
swiffyp Posted November 27, 2016 Author Share 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! Quote Link to comment Share on other sites More sharing options...