Those old ("|cRRGGBB") codes are out
I have done the following so far:
For the pins them self (This is already working as it should):
Lua Code:
QuestssubmenuControls:insert({ -- Undone Quest pin color
type = "colorpicker",
name = GetString(QUEST_SETTINGS_UNDONE_PIN_COLOR),
tooltip = GetString(QUEST_SETTINGS_UNDONE_PIN_COLOR_TT),
getFunc = function() return unpack(savedVariables.pinTextureQuestsUndone.tint) end,
setFunc = function(r, g, b, a)
savedVariables.pinTextureQuestsUndone.tint = {r, g, b, a}
QuestsUndonePreview:SetColor(r, g, b, a)
LMP:SetLayoutKey(PINS_QUESTS_UNDONE, "tint", ZO_ColorDef:New(r, g, b, a))
LMP:RefreshPins(PINS_QUESTS_UNDONE)
end,
disabled = function() return not savedVariables.filters[PINS_QUESTS_UNDONE] end,
default = {r = defaults.pinTextureQuestsUndone.tint[1], g = defaults.pinTextureQuestsUndone.tint[2], b = defaults.pinTextureQuestsUndone.tint[3], a = defaults.pinTextureQuestsUndone.tint[4]}
})
I have done this in settings for pin text:
Lua Code:
QuestssubmenuControls:insert({ -- Undone Quest pin text color
type = "colorpicker",
name = GetString(QUEST_SETTINGS_UNDONE_PINTEXT_COLOR),
tooltip = GetString(QUEST_SETTINGS_UNDONE_PINTEXT_COLOR_TT),
getFunc = function() return unpack(savedVariables.pinTextureQuestsUndone.textcolor) end,
setFunc = function(r, g, b, a)
savedVariables.pinTextureQuestsUndone.textcolor = {r, g, b, a}
LMP:RefreshPins(PINS_QUESTS_UNDONE)
end,
disabled = function() return not savedVariables.filters[PINS_QUESTS_UNDONE] end,
default = {r = defaults.pinTextureQuestsUndone.textcolor[1], g = defaults.pinTextureQuestsUndone.textcolor[2], b = defaults.pinTextureQuestsUndone.textcolor[3], a = defaults.pinTextureQuestsUndone.textcolor[4]}
})
but have problems implementing that into my pins.
OLD pin code is this:
Lua Code:
pinTag = {zo_strformat(savedVariables.pinTextcolorCodes.questdonergb..Name)}
table.insert(pinTag, 2, zo_strformat(savedVariables.pinTextcolorCodes.questdonergb.."["..NPC.."]"))
I tried your pin code:
Lua Code:
pinTag = {savedVariables.pinTextureQuestsUndone.textcolor:Colorize(zo_strformat("<<1>>", Name))}
but it throws a "function expected instead of nil" error.
Originally Posted by Garkin
Do you want to stick with your current codes ("|cRRGGBB") or do you want to convert colors to tables?
Current color codes:
Lua Code:
--define local references to ZO_ColorDef objects at the start of the file: local COLOR_QUEST_GIVER --assign actual object in OnAddonLoaded, after you load saved variables: COLOR_QUEST_GIVER = ZO_ColorDef:New(savedVariables.pinTextcolorCodes.questgiverrgb:gsub("^|c", "")) --Settings menu looks like this: { type = "colorpicker", name = GetString(PINTEXT_COLOR_SETTINGS_QUESTGIVER), tooltip = GetString(PINTEXT_COLOR_SETTINGS_QUESTGIVER_TT), getFunc = function() return COLOR_QUEST_GIVER:UnpackRGBA() end, setFunc = function(r, g, b, a) COLOR_QUEST_GIVER:SetRGBA(r, g, b, a) savedVariables.pinTextcolorCodes.questgiverrgb = "|c" .. COLOR_QUEST_GIVER:ToHex() LMP:RefreshPins(PINS_QUESTGIVER) end, default = ZO:ColorDef:New(defaults.pinTextcolorCodes.questgiverrgb:gsub("^|c", "")), },
Tables:
Lua Code:
--define local references to ZO_ColorDef objects at the start of the file: local COLOR_QUEST_GIVER --assign actual object in OnAddonLoaded, after you load saved variables: COLOR_QUEST_GIVER = ZO_ColorDef:New(unpack(savedVariables.pinTextcolorCodes.questgiverrgb)) --Settings menu looks like this: { type = "colorpicker", name = GetString(PINTEXT_COLOR_SETTINGS_QUESTGIVER), tooltip = GetString(PINTEXT_COLOR_SETTINGS_QUESTGIVER_TT), getFunc = function() return COLOR_QUEST_GIVER:UnpackRGBA() end, setFunc = function(r, g, b, a) COLOR_QUEST_GIVER:SetRGBA(r, g, b, a) savedVariables.pinTextcolorCodes.questgiverrgb = {r, g, b, a} LMP:RefreshPins(PINS_QUESTGIVER) end, default = ZO_ColorDef:New(unpack(defaults.pinTextcolorCodes.questgiverrgb)), }, --and your pinTag: pinTag = {COLOR_QUEST_GIVER:Colorize(zo_strformat("<<1>>", Name))} --I have no idea if you need zo_strformat to remove special characters in there, but I have added it just in case.
|