ID:269208
 
i was wonderin how to round up... i have
mob
proc
Statup()
src.maxhp*=1.6
src.maxmp*=1.4
src.strength*=1.3
src.defense*=1.2
src.hp=src.maxhp
src.mp=src.maxmp
src<<"<b><font color=white><font size=2>Your stats increase..."
and when i level up, eventually i will have like 40.3 strength n stuff.. i was wonderin how to get rid of that, so if neone can help, plz help!
If you'll look it up in the reference, there's a round() procedure you can use. It'll do exactly what you need.

~>Volte
In response to Volte
thanks man
In response to Oblivon_2
actually, i dont understand it..
In response to Oblivon_2
var/X = 10.5
X = round(X)
src << X //Outputs 11
In response to Ryne Rekab
Ryne Rekab wrote:
> var/X = 10.5
> X = round(X)
> src << X //Outputs 11
>


Actually, that'd output 10. Round() by default returns the number without any decimals attached to it. You can supply a second argument to make it round to the nearest 1, 5, or whatever number you want.

~>Volte
In response to Volte
Oh yeah I forgot the round() was weird like that. Sorry about that.

-Ryan