View Single Post
03-12-15, 06:09 PM   #1
Kraiven
A Deviate Faerie Dragon
 
Kraiven's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2015
Posts: 10
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"] = {
	text = "Role: " .. roleReturnValueHere, "SpecRole:" specReturnValueHere,
	button1 = "Change Talent Spec",
	button2 = "Not Right Now",
	OnAccept = function(self)
		local inLockdown = InCombatLockdown() -- Check if in combat 
		if inLockdown then
			message("|cffff0000WARNING!|r \n \n |cffffff00In combat and unable to switch specs at this time. \n Try again when combat has ended.|r")
		else	
			SetActiveSpecGroup(GetActiveSpecGroup()%2+1) -- Switches Talent Spec
		end
	end,
	showAlert = true,  -- Alert Icon in PopUp
	timeout = 0,
	whileDead = false,
	hideOnEscape = true,
	preferredIndex = 3,
}
Obviously I would have the arguments called in locals. Thank you for any advice! Always appreciated.
  Reply With Quote