Thread Tools Display Modes
06-18-10, 10:04 PM   #1
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
SetFormattedText help.. WTF

Code:
bar.value:SetFormattedText("|cff%02x%02x%02x%d%%|r (%s)", r*255, g*255, b*255, (min-max), ShortValue(max))
So I'm using oUF and trying to edit a PostUpdateHealth function. for some reason. If i get rid of the % it falls apart.. but if i leave it there it looks like this..



I'm trying to get rid of the % sign.. help?
  Reply With Quote
06-18-10, 10:17 PM   #2
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Originally Posted by alimjocox View Post
Code:
bar.value:SetFormattedText("|cff%02x%02x%02x%d%%|r (%s)", r*255, g*255, b*255, (min-max), ShortValue(max))
So I'm using oUF and trying to edit a PostUpdateHealth function. for some reason. If i get rid of the % it falls apart.. but if i leave it there it looks like this..



I'm trying to get rid of the % sign.. help?
% is used to precede a formatting token. For example %02x in your string is a single token that formats an integer value to hex. If you want your formatted string to have a % sign in the string itself, you need to escape it with an extra % sign. That means to get the % sign to display you need to have %% in your formatting string.

Which means to get rid of it, remove the two side-by-side % signs, not just one.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SetFormattedText help.. WTF

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