ID:150358
 
I need to know what would be the most effecient way to round my variables so i dont get any decimals... and im trying to figure out how to hide skills from people until they meet certain requirements. I tried setting the visibility of the verb to 0. And then writing a procedure that sets it to 1 when they meet certain requirements, but i cant get it to work. Any ideas??
well, for the verbs just make it, but not under there verbs. Then in your level up proc, add it at a certain level. Or if you want a obj to give it to them, when they pick it up just say
usr: verbs/mob/you/verbs/verb1

you would do that for level too.
In response to Nebathemonk
Nebathemonk wrote:
well, for the verbs just make it, but not under there verbs. Then in your level up proc, add it at a certain level. Or if you want a obj to give it to them, when they pick it up just say
usr: verbs/mob/you/verbs/verb1

you would do that for level too.

And for rounding, use round().
In response to Vortezz
I know about the round() proc, but what would be the best way to implement it. And can you go a little more in depth with the verbs thing. I mean for verbs they get when they are stronger not obj verbs.
In response to Krim
i know. do something like this.

mob/proc
Level_Up()
if(usr.exp == 20)
usr << "you go up a level"
usr.level += 1
if(usr.level == 3)
usr:verbs += mob/player/verb/blast
else
return
else
return

mob/player/verb
blast(mob/M in oview(3))
M << "you got blasted by [usr]"
usr << "you blast [M]"

there ya go, example.
In response to Krim
Krim wrote:
I know about the round() proc, but what would be the best way to implement it.

To round all numbers down ("truncate" the decimal) use

num = round(num)
//(round(1.00) = 1)
//(round(1.25) = 1)
//(round(1.50) = 1)
//(round(1.75) = 1)

To round it to the nearest integer, use

num = round(num,1)
//(round(1.00,1) = 1)
//(round(1.25,1) = 1)
//(round(1.50,1) = 2)
//(round(1.75,1) = 2)

To round up from any number, use the following proc and run it like the normal round proc:

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

This is used in the following way:
num = round_up(num)
//(round_up(1.00) = 1)
//(round_up(1.25) = 2)
//(round_up(1.50) = 2)
//(round_up(1.75) = 2)