ID:179968
 
Becuase i have a level proc in my code and i have the experience timesd by 1.5 to the max when you gain a level and it eventually goes to the thousandsth and i want to know how to just round it up. So if you know how please help me out here thanx


~Richter
Richter wrote:
Becuase i have a level proc in my code and i have the experience timesd by 1.5 to the max when you gain a level and it eventually goes to the thousandsth and i want to know how to just round it up. So if you know how please help me out here thanx


~Richter


Just use the round() proc. It is also not just capable of rounding decimal values to thier nearest integer value but you can have it round to specified multipuls. For more exact info check out the round() proc in the reference.
In response to Theodis
Just use the round() proc.

Yes, that part is correct. =)


It is also not just capable of rounding decimal values to thier nearest integer value

Sure it is.

num = round(num,1) //if given 2.745, will now have 3


Richter: If this information helps you, you can also get rid of any non-integer (decimal) portion by using round() without a number argument.

num = round(num) //if given 2.745, will now have 2
In response to Spuzzum
Almost forgot. You can also automatically round up any number (say, 2.0 to 2, but 2.1 to 3) by using the following:

proc/round_up(num)
if(round(num) != num) return round(num+1)
else return num

proc/example()
var/num = 2.1
num = round_up(num)
return num //returns 3