Jump to content

event.execute always giving me an NPE


k9thebeast

Recommended Posts

NPC storeGuy = script.getNpcs().closest("Store");
if(storeGuy != null){
	script.log("Trading store guy");
	InteractionEvent e = new InteractionEvent(storeGuy, "Trade");
	e.setMaximumAttempts(2);
	e.execute(); //line 67

https://gyazo.com/8ec12a4cb9a91d57d032238ad0df094f

Seems to happen every time I do event.execute (not alone to this type of event)

Link to comment
Share on other sites

2 hours ago, Alek said:

Event execute() is an internal method used by the event executor. You can use either

bot.getEventExecutor().execute(event) or the wrapper method which is simply "execute(Event)"

therefore

execute(e); will work

Hi,

Might be a good idea to put this in the docs.
Also, since you probably can't hide this method from the public API, could be a good idea to return an error with a message containing what you just explained whenever the method is called 'inappropriately'.

I remember this part of the API causing me so many headaches back in the day.

Bye

  • 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.
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...