View Single Post
  #2  
Unread 09-10-2013, 09:46 AM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 341
This is an oddity in how the client handles mouse click events for quickslots. Note that if you right click you will get the result you want, it only affects the left click (at least for me). You are changing the quickslot alias in the handler that fires for a click which messes up the underlying pointers for the alias in the client causing it to evaluate to nothing (until the click after it is assigned to "Engage!" since it isn't really changing after that). Note that if you count your left clicks, the text is changed to "Engage!" on the click before "Engage!" actually shows up.

You can fairly easily get around this by changing the text asynchronously using an Update event handler:
Code:
Countqs.MouseClick=function()
 if Count>0 then
  Count=Count-1
 end
 Countqs:SetWantsUpdates(true)
end
Countqs.Update = function()
 UpdateAliases(Channel);
 Countqs:SetWantsUpdates(false)
end
The mouse click event now just enables the Update handler which fires asynchronously on the next frame render. It's important to turn off updates inside the Update event handler so that you don't waste machine cycles on every update. This enables the client to update the quickslot after it is completely done firing it's internal events for the quickslot so Lua doesn't stomp on the alias as it's being used.

Note, you probably could have changed to using the MouseUp handler since it is probably fired after the internal event is handled but since MouseUp can be fired for situations that are not clicks, it is not a good solution so I didn't even bother testing if it would have worked.

Last edited by Garan : 09-10-2013 at 09:49 AM.
Reply With Quote