Jump to content

Question about InteractionEvent


Butters

Recommended Posts

Was testing stuff with interaction event and can't get my head around the hasFailed() and hasFinished() methods. Snippet below:

Player worker = s.players.closest(tradeArea, workerName);
  if (worker != null) {
    InteractionEvent e = new InteractionEvent(worker, "Trade with");
    e.setHover(false);
    e.setMaximumAttempts(1);
    e.setOperateCamera(true);
    s.execute(e);							
    Utils.condSleep(5000, 300, () -> e.hasFinished() || e.hasFailed());

    if (e.hasFinished()) {
      s.log("Interaction even has finished and will sleep!!!");
      Utils.condSleep(20000, 500, () -> s.trade.isFirstInterfaceOpen());
    }
    if (e.hasFailed()) 
      s.log("Interaction event failed!!!!!!!");
  }

As you can see this is for trading. It seems that hasFinished() == true when the event succeeds (doesn't fail), hasFailed() == when it fails to eventually send a trade request.

The problem I'm facing is that the hasFailed() method sometimes fires even if it actually succeeds (sent a trade request). Is this a bug or am I doing something wrong?

  • Like 1
Link to comment
Share on other sites

11 minutes ago, Chris said:

if the event executes sucessfully then it will be true? true meaning it did the action "Trade with"

it will fail it couldnt interact

 

Sadly it did. 

Log looked something like: [log message - action|
Interaction event failed - didn't trade
Interaction event failed - didn't trade
Interaction event failed - trade sent somehow

 

Link to comment
Share on other sites

18 minutes ago, nosepicker said:

Sadly it did. 

Log looked something like: [log message - action|
Interaction event failed - didn't trade
Interaction event failed - didn't trade
Interaction event failed - trade sent somehow

 

This also happens with the .interact() method aswell. Annoying as fuck sometimes.

Link to comment
Share on other sites

  • 11 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

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