WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   SetFormattedText help.. WTF (https://www.wowinterface.com/forums/showthread.php?t=33271)

alimjocox 06-18-10 10:04 PM

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?

Waverian 06-18-10 10:17 PM

Quote:

Originally Posted by alimjocox (Post 192805)
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.


All times are GMT -6. The time now is 01:46 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI