Jump to content

Script hangs on Inventory interaction when in trade


bfir3

Recommended Posts

I'm having an issue right now, where occasionally when attempting to interact with an Inventory item (to offer), the script will hang. The mouse will move to the inventory item, but it will not right click to interact with it. Usually just pausing and unpausing the script will solve it, and these messages will appear in the log (only after cycling the pause):

[WARN][Bot #1][08/08 03:51:53 AM]: Event executor is taking too long to suspend; terminating now...
[ERROR][Bot #1][08/08 03:51:53 AM]: Caught thread death in EventExecutor

Any ideas?

Edited by bfir3
Link to comment
Share on other sites

Yeah, I'm not gonna use a while loop like that. Not a good idea.

 

I added additional tracing to my code to hopefully get some more answers. It looks like the interaction fails, but that execution does not continue to the following instruction.

if (!this.getInventory().interact(slotId, "Offer-x"))
{
	this.log("Unable to interact with Inventory item");
}
script.log("Continuing after Inventory interaction attempt");

The next time the issue comes up I will check my log to see what appears. :)

Link to comment
Share on other sites

To follow up, the issue occurred again today and I checked the log when the mouse was hovering over the inventory item but not interacting with it. Neither of the traces were shown in the log. When I paused the script, the traces both appears shortly after:

[INFO][Bot #1][08/09 08:06:30 PM]: Unable to interact with Offer-X
[INFO][Bot #1][08/09 08:06:30 PM]: Waiting after interaction to offer amount
[INFO][Bot #1][08/09 08:06:30 PM]: Script Fir3 RuneCrafter v1.00 has paused!
[INFO][Bot #1][08/09 08:06:30 PM]: Script Fir3 RuneCrafter v1.00 has resumed!

And then shortly after I saw again:

[WARN][Bot #1][08/09 08:06:34 PM]: Event executor is taking too long to suspend; terminating now...
[WARN][Bot #1][08/09 08:06:46 PM]: Event executor is taking too long to suspend; terminating now...
[ERROR][Bot #1][08/09 08:06:46 PM]: Caught thread death in EventExecutor

When I hit play after pausing the script, it continues fine but usually tries to interact with the inventory item over and over again really quickly (after it was stuck not interacting for a while).

 

Any ideas guys?

 

Link to comment
Share on other sites

I often got the same error when hopping worlds. It seems like the event executor can get bugged after a while, causing the script to freeze. What I did is "renewing" the event executor every time before hopping (or in your case, before interacting with an inventory item) like this

try {
	Field field = Bot.class.getDeclaredField("eventExecutor");
	field.setAccessible(true);
	field.set(bot, new EventExecutor(bot));
} catch (Exception e) { }

This completely prevented the error from occuring again for me. I imagine it would fix your problem too.

 

Link to comment
Share on other sites

I often got the same error when hopping worlds. It seems like the event executor can get bugged after a while, causing the script to freeze. What I did is "renewing" the event executor every time before hopping (or in your case, before interacting with an inventory item) like this

try {
	Field field = Bot.class.getDeclaredField("eventExecutor");
	field.setAccessible(true);
	field.set(bot, new EventExecutor(bot));
} catch (Exception e) { }

This completely prevented the error from occuring again for me. I imagine it would fix your problem too.

 

I may take this approach eventually, but I think my problem is actually related to using an interact action that doesn't exist. I noticed that this error seemed to be occurring when the client would incorrectly report that the player is in a trade (using this.getTrade().isCurrentlyTrading()) and my script would call interact on the desired inventory item with action "Offer-X" when the action does not exist. Instead of failing to interact and continuing as normal, it looks like the interaction method gets completely stuck when the action doesn't exist and locks up further script execution.

 

Does this sound accurate? If so, it may be a change required in the API?

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