Why do you want the icon when there is nothing tracked?
to give the user something to click on to bring up the menu. when items are being tracked then there are (multiple) item icons and counts being displayed as text, so its obvious where it is. when nothing is being tracked then its harder to find because the text was being set to "", all that was left was the object icon.
Why not just set the text to "no currency tracked"
i presume if theyre not tracking anything then i shouldnt take up a lot of real estate with excessive text, displaying just the object icon seemed to be a more reasonable choice.
leaving the icon at nil, and just putting it all into the text works pretty well for now. not sure i want to play with toggling the launcher/data feed thingy if display mods arent expecting that potential change.
as torhal mentioned above, perhaps if/when the standard is changed. if the user could pick from icon display choices of; never, always, only when no text ("" in this case), only with text. then i could set and forget an object icon and let the user decide how/when they want it displayed - anything that then looks weird is then their problem and not mine.
Except that by doing so, you aren't allowing the users of the plugin to decide (via options in their display AddOn) whether or not they -want- to see an icon.
the flip side is that its my object, i dont have to supply an icon if i dont think one is required, the api doesnt force me to do that (nor should it).
if they turn it off and theres no text (because nothing is being tracked at the moment) then nothing gets displayed at all and finding the location to right click for the menu to kick in (to pick something to track) might prove difficult (which is a major problem)
if they turn it on and there is text then they get an extra icon they probably wont want (which is only a minor visual problem).
i dont think theyll have an issue with the way ive done it but if someone can supply a workaround thats consistent and usable for both cases then im happy to recode it to work that way instead.
i just dont think it can be done at the moment because display mods only have a yes/no choice to display the icon, it would need more choices, like once you chose to display the icon another input is required; always display, only display when there is text, only display when there isnt text. (or add all those to the top level choice if thats easier)
text is always there, its never nil, it might be "" though, its the icon i'm setting to nil.
i was doing this because i was adding multiple textures in the text so didnt need the icon as well when it had text. ie i had the icon set only when i didnt add any text.
if im tracking a currency then theres no icon, except the icon never goes away when i set it to nil - but only if it was previously set.
if i do a uireload then the icon doesnt appear, if i then untrack all currencies (so the icon is set) then the icon comes back (working correctly), if i then track a currency (so the icon is set to nil) then the icon doesnt go away (this is the problem), its still there even though ive set it to nil.
i've tried nil and false (which are fine for no icon) and "" (which isnt, it leaves an empty space where an icon should go)
sorry this is long, i just wanted to try and clarify it properly.
self.text = ""
local hasText = false
-- expand all token headers
local numTokenTypes = GetCurrencyListSize( )
local name, isHeader, isExpanded, isUnused, isWatched, count, currencyType, icon
for j = numTokenTypes, 1, -1 do
name, isHeader, isExpanded = GetCurrencyListInfo( j )
if isHeader and not isExpanded then
ExpandCurrencyList( j, 1 )
numTokenTypes = GetCurrencyListSize( )
for j = 1, numTokenTypes do
name, isHeader, isExpanded, isUnused, isWatched, count, icon = GetCurrencyListInfo( j )
if not isHeader then
if ArkInventory.db.char.option.ldb.tracking.currency.tracked[name] then
self.text = string.format( "%s |T%s:0|t %d", self.text, icon or ArkInventory.Const.Texture.Missing, count or 0 )
hasText = true
if hasText then
self.icon = nil
self.icon = ArkInventory.Global.Location[ArkInventory.Const.Location.Token].Texture