LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Interface Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=3)
-   -   Help with Quickslot plugin... not updating quickslot (https://www.lotrointerface.com/forums/showthread.php?t=2046)

Radicus 09-10-2013 06:27 AM

Help with Quickslot plugin... not updating quickslot
 
1 Attachment(s)
Hi,
Was wondering if someone could give me a hand with this little plugin I'm working on.

There's a Countdown timer quickslot button which in theory should change value each time it is clicked and send the updated qs data to the selected channel, ie. raid, fellowship or general.

If you hover the mouse over the button, the tip will show the qs data, and it is displayed in the correct format with the channel and timer. eg "/ra 6".

When you click on the button, the alias information updates as the counter ticks down, but it is not sent to the selected channel. The weird thing is, when the timer reaches the end, the final qs data IS displayed... ie. No "6", "5", "4", "3", "2" ," 1", just "Engage!"

The bit you need to see the last couple of sections in the window.lua file.

Any help appreciated!

Garan 09-10-2013 09:46 AM

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.

Radicus 09-10-2013 10:39 AM

Ah! The good ol SetWantUpdates(true) oddity strikes again. Had me stumped for hours and I did try that in several iterations/combinations but couldn't get it to fire.

That worked a treat, thanks again dude!


All times are GMT -5. The time now is 11:21 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI