Jump to content

Is there a way to seperate breakhandler from random events?


swiffyp
 Share

Recommended Posts

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

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

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

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