WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   money format gold etc coins (https://www.wowinterface.com/forums/showthread.php?t=58054)

nirran 06-16-20 11:14 PM

money format gold etc coins
 
i want to format the money string to break up large numbers and have the coin icons in the string,this is what i have,it works but need the method to add the icons

Code:

function GetGoldTextureString(value)

    local copper, silver, gold, calc

        copper = (("%d"):format(value % 100))

        silver = (("%d"):format((value / 100) % 100))
       
        gold = (("%d"):format(value / 100 / 100))

        calc = FormatLargeNumber(gold)
       
        return (calc.."g "..silver.."s "..copper.."c")

end


Fizzlemizz 06-17-20 12:03 AM

Code:

return calc.."|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t "..silver.."|TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0|t "..copper.."|TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0|t"
That's inserting the standard coins into a string using |T |t (texture) start/end escape sequences.

For more information on escape sequences, See

[Another awesome page btw, greatly appreciated]

Yukyuk 06-17-20 02:47 AM

Format money string
 
I use the GetCoinTextureString for this.

Seerah 06-17-20 12:14 PM

Quote:

Originally Posted by Yukyuk (Post 336159)
I use the GetCoinTextureString for this.

Yep.
http://wowprogramming.com/docs/api/G...ureString.html

nirran 06-17-20 12:28 PM

Quote:

Originally Posted by Fizzlemizz (Post 336157)
Code:

return calc.."|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t "..silver.."|TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0|t "..copper.."|TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0|t"
That's inserting the standard coins into a string using |T |t (texture) start/end escape sequences.

For more information on escape sequences, See

[Another awesome page btw, greatly appreciated]

thank you very much,appreciate it,thisis my finnal

Code:

    local copper, silver, gold, calc, ccoin, scoin, gcoin

        copper = (("%d"):format(value % 100))

        silver = (("%d"):format((value / 100) % 100))
       
        gold = (("%d"):format(value / 100 / 100))

        calc = FormatLargeNumber(gold)

        ccoin = "|TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0|t "
       
        scoin = "|TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0|t "
       
        gcoin = "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t "
               
        return (calc..gcoin..silver..scoin..copper..ccoin)


Fizzlemizz 06-17-20 12:47 PM

Quote:

Originally Posted by Yukyuk (Post 336159)
I use the GetCoinTextureString for this.

Absolutely. The manual method becomes handy if say, you just want to show gold only. After the first million or so, silver and copper become pretty irrelevant ;).

nirran 06-17-20 08:31 PM

Quote:

Originally Posted by Fizzlemizz (Post 336174)
Absolutely. The manual method becomes handy if say, you just want to show gold only. After the first million or so, silver and copper become pretty irrelevant ;).

that is exactly why i did it :)


All times are GMT -6. The time now is 02:48 PM.

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