Jump to content

Terminate random event script


Soldtodie

Recommended Posts

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 by Botrepreneur
Link to comment
Share on other sites

    @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

    @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

His snippet stops it from executing.

The solvers automatically stop after executing.

When exactly do you want it to stop ? tongue.png

 

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 by Soldtodie
Link to comment
Share on other sites

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 ? tongue.png

Edited by Botrepreneur
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...