Quantcast
money format gold etc coins - WoWInterface
Thread Tools Display Modes
06-16-20, 11:14 PM   #1
nirran
A Murloc Raider
Join Date: Mar 2005
Posts: 8
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
  Reply With Quote
06-17-20, 12:03 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,276
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]
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 06-17-20 at 02:55 AM.
  Reply With Quote
06-17-20, 02:47 AM   #3
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 176
Format money string

I use the GetCoinTextureString for this.
__________________
Better to fail then never have tried at all.
  Reply With Quote
06-17-20, 12:14 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,759
Originally Posted by Yukyuk View Post
I use the GetCoinTextureString for this.
Yep.
http://wowprogramming.com/docs/api/G...ureString.html
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
06-17-20, 12:28 PM   #5
nirran
A Murloc Raider
Join Date: Mar 2005
Posts: 8
Originally Posted by Fizzlemizz View Post
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)
  Reply With Quote
06-17-20, 12:47 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,276
Originally Posted by Yukyuk View Post
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 .
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
06-17-20, 08:31 PM   #7
nirran
A Murloc Raider
Join Date: Mar 2005
Posts: 8
Originally Posted by Fizzlemizz View Post
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
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » money format gold etc coins

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