#define Million 1000000
obj
Inventory
Gold
Amount = list("Millions"=0, "Leftover"=1)
value = 1
icon = 'Gold.dmi'
icon_state = ""
Title = "Gold"
description = "A very small sum of gold."
proc
lowerGold(var/amount)
var/millions = round(amount/Million)
var/leftover = amount - millions*Million
Amount["Millions"] = Amount["Millions"]-millions
Amount["Leftover"] = Amount["Leftover"]-leftover
if(Amount["Leftover"] < 0)
Amount["Million"] --
Amount["Leftover"] = Million + Amount["Leftover"]
if(Amount["Millions"] < 0)
Amount["Millions"] = 0
Amount["Leftover"] = 0
updateGold()
increaseGold(var/amount)
var/millions = round(amount/Million)
var/leftover = amount - millions*Million
Amount["Millions"] = Amount["Millions"]+millions
Amount["Leftover"] = Amount["Leftover"]+leftover
if(Amount["Leftover"] > Million)
Amount["Millions"] ++
Amount["Leftover"] -= Million
updateGold()
checkGold()
updateGold()
if(Amount["Millions"])
name = "[jru_Commafy(Amount["Millions"])] Million & [jru_Commafy(Amount["Leftover"])] Gold"
else
name = "[jru_Commafy(Amount["Leftover"])] Gold"
suffix = null
if(Amount["Millions"] >= 1000)
icon_state = "6"
description = "An immeasurable sum of gold."
else if(Amount["Millions"] >= 100)
icon_state = "5"
description = "An immense sum of gold."
else if(Amount["Millions"] >= 10)
icon_state = "4"
description = "An enormous sum of gold."
else if(Amount["Millions"] >= 1)
icon_state = "3"
description = "A considerable sum of gold."
else if(Amount["Leftover"] >= 100000)
icon_state = "2"
description = "A moderate sum of gold."
else if(Amount["Leftover"] >= 10000)
icon_state = "1"
description = "A small sum of gold."
else
icon_state = ""
description = "A very small sum of gold."
Now if I want to drop 25,000,001 gold how do I do that accurately? Is it possible to do it with 1 input prompt, or do I have to do multiple (one for millions, one for leftover, which I'm trying to avoid)?
Is it possible to put the number back together for display purposes?
This has been giving me a hard time, I thought of just moving everything back a few decimal places but I would still have problems displaying the number.
A little development tidbit, though: You really should rethink using big numbers like this. It's been stated dozens of times before and it'll be stated dozens of times from now, but no matter what you're doing, there's really never a necessity for using massive numbers like that, unless you're doing some exact economy simulation or something of the sort. It'll be far less of a headache for you.