Static PopUp text help
I'm using a static popup method to display a warning message to users about being in the wrong spec. I'd like to add some returned values from the api into the 'text =""' field, but every way I have tried doesn't seem to work. I know if I use message() to print I can do it, but I was wondering if there was a way to express this using the static popup dialog. I have searched high and low and can't find any examples or answers as to how or why I can't.
Example code: the yellow text is where I would like to put some values in, but can I only use text? Is there a better way to achieve this? Code:
StaticPopupDialogs["WRONG_SPEC_WARNING"] = { |
I would say it's
Lua Code:
I have no idea what your version was meant to do. :) You know the .. operator concats strings, right? http://www.lua.org/manual/5.3/manual.html#3.4.6 |
Sorry I'll try to explain it quickly. The popup window says basically
| "You're active role: (tank/damager/healer), You're assigned LFG role: (tank/damager/healer). | I can't seem to get two values to print in the popup message. If I use more than 1 set of quotation marks, the popup does not display. I've used the concatenations like you suggested, even tried them before. I'm pretty much wondering if it's even possible to do within the popup "text" field. I tried like this: Code:
text = "Active Role: " .. spec .. " Assigned LFG Role: " .. specName, |
I am pretty sure that this problem is not about string concatenation. What are the values of the variables?
What does print("Role: " .. roleReturnValueHere .. " SpecRole: " .. specReturnValueHere) show? Could you please show your full code? |
The problem has nothing to do with concatenation, even though you're doing that wrong in your example. The problem is that a static popup is only defined once, but the OP wants the text it displays to changable. Fortunately, there are several simple solutions available.
#1 - Your text can include up to 2 formatting tokens, and you can pass up to 2 values to StaticPopup_Show: Code:
StaticPopupDialogs["WRONG_SPEC_WARNING"] = { Code:
StaticPopupDialogs["WRONG_SPEC_WARNING"] = { Also make sure you have some kind of error display enabled. If your code is "not working" or "nothing happens" there's almost certainly a Lua error telling you exactly what's wrong on which line of code. |
Thank you guys again for the help. Phanx that worked exactly how I needed it. I was trying to find some help on how to use the "%s" format within a static popup. I only needed two options so the first one did it. I was missing this part...
Code:
local role = UnitGroupRolesAssigned("player"); -- Role selected or assigned in LFG |
|
All times are GMT -6. The time now is 05:41 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI