ID:262014
 
in this code num2text shows the wrong amount, it's actually off by 4 or 5 on it's input to src. When inputing 10,000 food to sell it displays 9996 when you complete it...

tt= Food and t = Sell

if(tt=="Food")
var/ttt=input("How much [tt] do you want to [t]?","Going rate is [vars["marketsell[tt]"]] per [tt].") as null|num
var/nRRR=num2text(round(ttt,12))
if(isnull(ttt) || !usr.client) return
if(!usr || !usr.client) return
var/tttt=ttt*vars["marketsell[tt]"]
var/nRR=num2text(round(tttt,12))
var/answer=input("it'll cost me [nRR] for your [nRRR] [tt], make the deal?","Are you sure?") as null|anything in list("Yes","No")
if(isnull(answer)) return
if(!usr || !usr.client) return
if(answer=="Yes")
if(ttt<=0)
return
if(ttt>10000)
usr<<"You cannot buy or sell more then 10,000 food at one time!"
return
if(usr.food>=ttt)
usr.food-=ttt
usr.money+=tttt
usr<<"Thank you for your trade of [nRRR] [tt] for [nRR]!!!"
return
else
usr<<"You don't have that much food!"
return
else
return
Jon Snow wrote:
in this code num2text shows the wrong amount, it's actually off by 4 or 5 on it's input to src. When inputing 10,000 food to sell it displays 9996 when you complete it...

You rounded off the input to the nearest dozen. 10,000 rounded to the nearest dozen is 9,996.

Lummox JR
In response to Lummox JR
lmao, thanks lummox. I had no idea that it rounded to nearest dozen, shoulda read the reference :)
In response to Jon Snow
It does not normally round to the nearest dozen. You told it to when you said "round([whatever],12)".
In response to ACWraith
That is, you've got:

<code>var/nRRR=num2text(round(ttt,12))</code>

But what you want is:

<code>var/nRRR=num2text(round(ttt),12)</code>
In response to Foomer
gotcha, scary to think of how easy it is to do simple things wrong like this... I guess I shoulda learned coding better before trying to write thousands of lines of code on a game... hehe