scriptsdk/CSharp-ScriptSDK-Legacy

Moving items to another container

Closed this issue · 6 comments

Bosek commented

Moving items to another container causes ridiculous amout of InvalidOperationException: Queue is empty

new Item(id).MoveItem(container);
is worse than
Stealth.Client.MoveItem(id, item.Amount, containerID, 0, 0, 0);

but both throw InvalidOperationException time to time(well, first one throws it every time).

ScriptSDK is really great, but has soo many issues :( It crashes my UO client instantly in every second run of custom ScriptSDK app(just simple Console app with Stealth.Client.*). But that is other issue...

I will check this next days. I hadnt been able to toy that much with SDK lately and other dev is on business travel.

Bosek commented

I found out this is probably caused by another thread trying to get players location in loop(every 200ms). I've added locking to every Stealth interaction and moving items is now ok. Only getting player's position is broken now and for ever(it seems). Locking didn't solve it. I guess that ScriptSDK can't handle requests from multiple threads at once? It seems like every request to Stealth empties some queue and boom!

Stealth with Version 7 is a bit experimental. The problem is that not many testers are around for SDK and whenever we release a new stealth version we test it only rudimentary. So we need testers. I made SDK available as open source for this purpose so interested developers are able to submit fixes and ideas and we all can make SDK better. If its a stealth sided bug, i can look into the source of Stealth, but its better if i discuss it with Vizit0r who is lead developer of project. 95% of code changes comes from his pen. SDK on the other side is my personal project. It got a bit sleepy lately but i never gave up on it.

Bosek commented

Another testing of this issue. I made a simple script where the character kills a few mobiles in jungle. Everything is in one thread so it should prevent accessing Stealth API from multiple threads and possibly stop causing Queue is empty exceptions. Everything worked nicely to the point where I tried to add autoloot. Everytime I try to move anything from container to container, Queue is empty exception is thrown on random line of code(where StealthAPI is called). I've tried locking(even though I don't see any point of it). It fixed a few cases, but the exception will be sooner or later thrown again. I can upload the code if you are interested.

as a simple solution, just use the 6.7.1 stealth, the 7+ versions are as raw as hell.

Bosek commented

Yup, that was probably it. Thanks for assistance.