Soldtodie Posted August 26, 2014 Share Posted August 26, 2014 How can I stop a random event script. I tested this but it doesn't work. RandomExecutor re = new RandomExecutor(getBot()); re.interrupt(); re.terminate(); Link to comment Share on other sites More sharing options...
Mysteryy Posted August 26, 2014 Share Posted August 26, 2014 How can I stop a random event script. I tested this but it doesn't work. RandomExecutor re = new RandomExecutor(getBot()); re.interrupt(); re.terminate(); Uhm, do you mean stop as in remove the random handler for a certain random event? Link to comment Share on other sites More sharing options...
Botre Posted August 26, 2014 Share Posted August 26, 2014 (edited) What exactly are you trying to achieve? RandomExecutor re = new RandomExecutor(getBot()); re.interrupt(); re.terminate(); ... will not terminate the script's Bot's RandomExecutor but the new RandomExecutor you created, "re" . What you might want to try instead: this.getBot(). getRandomExecutor().terminate(); Edited August 26, 2014 by Botrepreneur Link to comment Share on other sites More sharing options...
Alek Posted August 26, 2014 Share Posted August 26, 2014 @Override public void onStart() { bot.getRandomExecutor().registerHook(new RandomBehaviourHook(RandomEvent.FREAKY_FORESTER) { @Override public boolean shouldActivate() { return false; //To change body of overridden methods use File | Settings | File Templates. } }); } Link to comment Share on other sites More sharing options...
Soldtodie Posted August 26, 2014 Author Share Posted August 26, 2014 @Override public void onStart() { bot.getRandomExecutor().registerHook(new RandomBehaviourHook(RandomEvent.FREAKY_FORESTER) { @Override public boolean shouldActivate() { return false; //To change body of overridden methods use File | Settings | File Templates. } }); } I don't want to change the random. I want to stop it. Link to comment Share on other sites More sharing options...
Botre Posted August 26, 2014 Share Posted August 26, 2014 I don't want to change the random. I want to stop it. His snippet stops it from executing. The solvers automatically stop after executing. When exactly do you want it to stop ? :p Link to comment Share on other sites More sharing options...
Soldtodie Posted August 26, 2014 Author Share Posted August 26, 2014 (edited) His snippet stops it from executing. The solvers automatically stop after executing. When exactly do you want it to stop ? For instance in the mid. this.getBot(). getRandomExecutor().terminate(); This doesn't work but with .interrupt() the random script stops for a moment and start again. Edited August 26, 2014 by Soldtodie Link to comment Share on other sites More sharing options...
Extreme Scripts Posted August 26, 2014 Share Posted August 26, 2014 For instance in the mid. this.getBot(). getRandomExecutor().terminate(); This doesn't work but with .interrupt() the random script stops for a moment and start agai @Alek's solution will work. Link to comment Share on other sites More sharing options...
Wizard Posted August 26, 2014 Share Posted August 26, 2014 No problem Alek, Alek's solution overrides the existing random by return false so it wont be activated by any situation. Link to comment Share on other sites More sharing options...
Soldtodie Posted August 26, 2014 Author Share Posted August 26, 2014 @Alek's solution will work. With this i can terminate the random solver in the mid of the execute? Link to comment Share on other sites More sharing options...
Wizard Posted August 26, 2014 Share Posted August 26, 2014 With this i can terminate the random solver in the mid of the execute? No, with this, the random solver would not be executed at all Link to comment Share on other sites More sharing options...
Botre Posted August 26, 2014 Share Posted August 26, 2014 (edited) With this i can terminate the random solver in the mid of the execute? You'd have to override the RBH's onLoop() For instance in the mid. this.getBot(). getRandomExecutor().terminate(); This doesn't work but with .interrupt() the random script stops for a moment and start again. Stop and restart, isn't what interruption is all about ? Edited August 26, 2014 by Botrepreneur Link to comment Share on other sites More sharing options...
Soldtodie Posted August 26, 2014 Author Share Posted August 26, 2014 I override it but it doesn't stop during executing. Link to comment Share on other sites More sharing options...
Botre Posted August 26, 2014 Share Posted August 26, 2014 I override it but it doesn't stop during executing. How did you override it ? ^^ Link to comment Share on other sites More sharing options...
Soldtodie Posted August 26, 2014 Author Share Posted August 26, 2014 How did you override it ? ^^ Lol sry I failed. Can you post an example please? Link to comment Share on other sites More sharing options...