Soldtodie Posted August 26, 2014 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();
Mysteryy Posted August 26, 2014 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?
Botre Posted August 26, 2014 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
Alek Posted August 26, 2014 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. } }); }
Soldtodie Posted August 26, 2014 Author 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.
Botre Posted August 26, 2014 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
Soldtodie Posted August 26, 2014 Author 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
Extreme Scripts Posted August 26, 2014 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.
Wizard Posted August 26, 2014 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.
Soldtodie Posted August 26, 2014 Author Posted August 26, 2014 @Alek's solution will work. With this i can terminate the random solver in the mid of the execute?
Wizard Posted August 26, 2014 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
Botre Posted August 26, 2014 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
Soldtodie Posted August 26, 2014 Author Posted August 26, 2014 I override it but it doesn't stop during executing.
Botre Posted August 26, 2014 Posted August 26, 2014 I override it but it doesn't stop during executing. How did you override it ? ^^
Soldtodie Posted August 26, 2014 Author Posted August 26, 2014 How did you override it ? ^^ Lol sry I failed. Can you post an example please?