when players go to sell the ore
it takes 50 ore to get 1 credit
how can i make it so there is no 1.4256646 credits?
rounding off?
ID:162896
Nov 10 2007, 6:49 am
|
|
In response to Jman9901
|
|
sorry,
verb/Sell_ore() see, user can have more then 50 ore so if he has 75 ore he would get 1.5 credits i dont want it to cash the other 25 in??? is that possible?? |
In response to Kylemark
|
|
verb/Sell_ore() |
In response to Jman9901
|
|
verb There you go |
In response to Axerob
|
|
Except he wants to sell as many units of 50 ore for 1 credit each, all at once. Which means two lines of code:
usr.credit += round(ore/50) //add one credit per 50 units of ore, rounded down The % (modulo) operator is, essentially, the remainder operator. So, 75%50 = 25, 120%50 = 20, etc. |
I don't really know what you're doing, so it would help a lot if you could give a code snippet. Or if you want to just look up "round" when you press "F1" in the Dream Maker.