aRTy42 / POE-ItemInfo

Item Info Script for Path of Exile
167 stars 225 forks source link

Highlight items gets old values #121

Open Krzysiu opened 5 years ago

Krzysiu commented 5 years ago

I don't know where exactly the problem lies, but often I got such problem: 1) highlight X item 2) X gets highlighted 3) highlight Y item 4) Y gets highlighted 5) highlight Z item 6) X (sic!) gets highlighted

There's some code which is described as "This prevents the highlighting function to fill search fields with data from previous item parsings", but that apparently doesn't work.

While I didn't find exact place where it's happening, I'm sure it's because the variable is global - the clipboard is replaced in 3rd point, so script somehow keeps info from 1st (and somewhere in between parsing/getting clipboard fails, so the old data is not replaced by new one). As this variable (parsed data/clipobard contents) is needed only to process it and then paste it into box, it should end its life when the function routine ends - there's no reason to pollute mainspace. As it's global, it persists and causes that problem.

The half-assed solution which would make use of global variable is just to "destroy" it (in fact impossible in AHK, so either empty contents [foo :=] or unallocate it [VarSetCapacity(foo,0)]) before use - this way even if other functions interfere, then it would be clean with every routine execution.

Krzysiu commented 5 years ago

Additional note: sometimes it seems to use text which was copied outside POE and POE TM. I've just encountered something like that:

1) copy "foo" to clipboard 2) highlight X item 3) "foo" is in the search box 4) hl Y item 5) X item is in the search box 6) hl Z item 7) Y is in the search box