Number rounding?

I found a bunch of threads helping and giving various scripts to do that but none of them seem to work for me. So maybe it's not a problem with a script but how I'm using them?

upload_2019-9-7_18-24-21.png


I take my whole money, I divide it by two, I round it up with a script and... it still gives me 121.5 and such.

What am I doing wrong?
because you script is RPG VX(ace) not for MV, but its similair, $gameVariables(x). something else, but im not sure on that part.
I need to look for that one though. x = varID you use.

Edit,
it should be around this, but it might be corrected where I got wrong though.

Math.round($gameVariables.value(X))
or for multiple parts
Math.round(($gameVariables.value(X)+$gameVariables.value(Y)) /2

I can be wrong though, but its around this parts you need to look for.
Yeah, doesn't work 😛 But thank you for trying!
Try: Math.ceil($gameVariables.value (x));
That should round the value up - 121.5 will be 122. If you want to round down, use Math.floor.
Heh...

upload_2019-9-8_1-7-17.png


upload_2019-9-8_1-8-17.png
I actually did exactly what you did, then I realized I hadn't stored the result in a variable. Use the Control Variables dialogue for Variable 31 and put "Math.ceil($gameVariables.value (31));" in the script field.
Awesome, this works! Thank you all!
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/number-rounding.113024/