EDIT: I figured it out... using "." instead of ":" and r, g, b, a are nil...
Hello, I'm trying to learn how to use the ColorPickerFrame that Blizzard provides but I'm having some issue. I'm not sure if the information on WoWPedia is incorrect or if I have a Lua issue. Here's my reference: http://wowwiki.wikia.com/wiki/Using_...lorPickerFrame
From what I have figured out, the CC_ColorCallback function stops executing after the if, else, end block before setting CC_Color and CC_Title colors. I have placed some chat messages in there to see that. Cancel is printed correctly when I hit cancel on the color picker. Change is printed whenever a value changes in the color picker. But nothing executes after that, the colors dont change/dont print. I cannot figure out why this is.
Thanks in advance.
Here's my code:
Code:
local CC_Color = {
r = 0,
g = 0,
b = 0,
a = 0.7
}
function CC_ColorCallback(restore)
local newR, newG, newB, newA
if restore then
--Test message
DEFAULT_CHAT_FRAME:AddMessage("Cancel")
newR, newG, newB, newA = unpack(restore)
else
--Test message
DEFAULT_CHAT_FRAME:AddMessage("Change")
newA = OpacitySliderFrame:GetValue()
newR, newG, newB = ColorPickerFrame:GetColorRGB()
end
CC_Color.r, CC_Color.g, CC_Color.b, CC_Color.a = newR, newG, newB, newA
CC_Title.SetBackdropBorderColor(r, g, b, a)
CC_Title.setBackdropColor(r, g, b, a)
--Test message
DEFAULT_CHAT_FRAME:AddMessage("r: "..r..", b: "..b..", g: "..g..", a: "..a)
end
-- Below is temporarily placed in a slash command function: /cc color will run the following.
ColorPickerFrame:SetColorRGB(CC_Color.r, CC_Color.g, CC_Color.b)
ColorPickerFrame.hasOpacity = true
ColorPickerFrame.opacity = CC_Color.a
ColorPickerFrame.previousValues = {CC_Color.r, CC_Color.g, CC_Color.b, CC_Color.a}
ColorPickerFrame.func = CC_ColorCallback
ColorPickerFrame.opacityFunc = CC_ColorCallback
ColorPickerFrame.cancelFunc = CC_ColorCallback
ColorPickerFrame:Hide()
ColorPickerFrame:Show()