Jump to content

Is there a way to seperate breakhandler from random events?


Recommended Posts

Posted (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 by swiffyp
Posted

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();
    }
}
  • Like 1
Posted

 

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

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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