Thread Tools Display Modes
07/18/17, 10:58 PM   #1
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 103
zo_stringformat problem

I'm getting some goofy issues with color formatting and combining strings in zo_strformat.

Lua Code:
  1. changeColor = SomeColor1:ToHex -- Convert user defined color for context color (currency gain or loss)
  2. currencyTypeColor = SomeColor2:ToHex -- Convert user defined color for type of currency.
  3. currencyIcon = "|t16:16:/esoui/art/currency/alliancepoints.dds|t"
  4. currencyName = "Gold" -- Variable for name of currency.
  5. changeType = ZO_LocalizeDecimalNumber("VARIABLE HERE FOR CURRENCY AMOUNT") -- # of currency gained or lost.
  6. messageUnformatted = "You deposit <<1>> in your bank." -- User defined Saved Variable for message format.

Lua Code:
  1. currencyString = ("|r|c" .. currencyTypeColor .. currencyIcon .. " " .. changeType .. currencyName .. "|r|c" .. changeColor)
  2. combine = zo_strformat(messageUnformatted, currencyString)
  3. d(zo_strformat("|c<<1>><<2>>|r", changeColor, combine)

This outputs:


For some reason with certain color values when a ZO_LocalizeDecimalNumber variable has a comma added to it, the color formatting breaks. I tried removing other values here, but the only thing that fixes it is removing the trailing color formatting.

Is there some additional formatting ZO_LocalizeDecimalNumber is doing that could interfere with the color code? Or is the manner in which I'm combining several strings here outside of the intended scope for the usage of zo_strformat?

EDIT: Colors here for reference are:
0b610b (Green)
b30000 (Red)

Last edited by ArtOfShred : 07/18/17 at 11:23 PM.
  Reply With Quote
07/19/17, 12:58 AM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Moved this since it did not belong in the other thread and most likely is not a bug in the game. Did you try to reproduce the issue with no other addons enabled? From your pictures it doesn't look like it. You wrote on gitter that your problem only shows up while you use pChat, so it is most likely a pChat bug.
pChat does some strange things with the text it is displaying which work fine with most regular messages, but cause trouble with the more advanced stuff like in your example.
  Reply With Quote
07/19/17, 04:31 PM   #3
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 103
The output from above is with no addons that modify chat functions running. With pChat that zero turns into a whole different mess.
  Reply With Quote
07/20/17, 02:27 AM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Originally Posted by ArtOfShred View Post
The output from above is with no addons that modify chat functions running. With pChat that zero turns into a whole different mess.
The screenshot above is clearly done with some chat addon enabled as it shows the time. Basegame doesn't have that feature.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » zo_stringformat problem

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off