Slash Commands and localisations
Scott, just a quick question when you get a moment.
Whilst working on updating my LDB addon for nUIs new Release update I noticed that the settings seem to be localised in files but actually in English. Is that supposed to be the case ? An example from the zhTW localisation file. Code:
nUI_L[nUI_SLASHCMD_OPTIONS( nUI_SLASHCMD_FEEDBACK, "curse" )] = "curse"; Thought I had better ask that question before I start localising all the text if most of that stuff is in nUI by default. Edit: Rofl, no matter, just noticed whilst looking at the old code I had already used your localised versions already :D Edit2: Edited due to me being too tired and wrote answer instead of ask .. rofl. |
~lol~
But you are correct. The "right" value to use is " nUI_L[nUI_SLASHCMD_OPTIONS( nUI_SLASHCMD_FEEDBACK, "curse" )]" and not just "curse" so that if someone decides to localize the slash commands for their language, they will still work correctly. |
To save starting a new thread regarding something else to do with the slash commands I thought I would post it here.
I noticed that when you toggle the display of the cooldowns on the buttons if the timing is more than a minute it doesn't update the display straight away when you turn it on. If its less than a minute it works fine. And when you turn it off it is immediate. Example: Button Cooldowns = true Arcane Torrent 2 min Countdown clicked Button shows Cooldown Turn off cooldowns and cooldown disappears Cooldown now at over 1 min but less than 2 min Turn on cooldowns and cooldown doesn't appear 40 seconds later .... still no cooldown Cooldown now at 60s Cooldown appears. Also, is the Toggle Durations supposed to toggle the Cooldowns too ? As it seems to be doing that too until the next update pass which from the note above is as much as 2 mins :D Oh and finally ( I hope ). I noticed the dimming alpha isn't quite right. if not alpha or alpha <= 0 or alpha > 1 then It looks like it is failing the first test as if I remember right it treats nil and 0 as false. Only a problem for those that want to fully transparent the button. |
That's probably a bug in the logic.
Most of nUI's modules try to avoid unnecessary screen updates (which are relatively expensive) by caching their states and performing a relatively inexpensive test to see if the state changed before doing anything that would cause a screen update. In the case of cooldowns, when the text that is to be displayed on the button changes, I call "SetText()" to update the button face, then set button.text = newValue; -- as long as the text remains the same as what "button.text" says it is displaying, I don't update the button face. My guess (I'm at work, so I can't look at the code, but you can confirm this pretty quickly) is that when the display feature is turned off via the slash command, I am setting the text to "" by calling SetText( "" ) but I am not updating the cached value. So, when you turn the cooldown back on, it doesn't realize the button text is empty and so it doesn't set the cooldown text again until it changes from the last stored value. Follow that? Take a look at [ nUI > Bars > nUI_Button.lua ] and look for either layer.cooldown:SetText() or cdc:SetText() and you should see where I am testing if the text changed and probably also testing to see if the feature is turned off via slash command. |
1 Attachment(s)
It calls this function in ButtonBar.lua whenever the slash command is executed:
Code:
function nUI_ButtonBars:setUserBarOptions( bar ) Changing the relative section in the function above to the following solves the problem but I am not sure how it will affect the rest of the overlay system. Code:
if not nUI_Options.barCooldowns or not nUI_Options.barDurations then But, it doesn't seem to solve the following problem : Arcane Torrent has a brief duration timer which is stuck at 0.0 until the cooldown timer updates again. Here's a picture to show you: |
All times are GMT -6. The time now is 05:33 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI