View Single Post
03/09/15, 09:49 PM   #20
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by Baertram View Post
Ok, are we able to detect if we get caught and prevent executing our addon functions etc. to each bag and bank item by help of a variable we set, if we get caught?
Is there an event if we get caught and after we payed or run away?
There is no event & no "specific" InteractionType for it, and we don't have access to any of that code.

The only thing I could think of (is very sloppy) Surely theres a better way than this, but maybe it will spark an idea. I didn't test any of this, its just an idea.

To detect getting caught you could do something like hook the INTERACT_WINDOW:BeginInteraction() and check to see if GetInteractionType() returns INTERACT_CONVERSATION, and then check the chatter: ZO_ChatterOption1:GetText() and search the string for some text related to getting caught, something like: "Clear my bounty"
Or maybe just the INTERACT_WINDOW:SelectChatterOptionByIndex(optionIndex) and if the optionIndex == 1, then check the chatter text.

I couldn't think of a decent way to know when its done updating. Only thing I could think of would be to just block your code for some set amount of time with a flag. Like when you get caught set: dontRunCode = true and then On EndInteraction() do a callLater and after a few ms set it back to false.

But if you exclude code from running on old items in the EVENT_INVENTORY_SINGLE_SLOT_UPDATE, none of this matters.
If you need to run code on old items it might be easier to find a different way to handle that instead of inside that event. It would just depend on what you need updated and when does it really need to be updated.
  Reply With Quote