ID:166171
 
How do I make it so that in a verb I'm taking away one of a var
every step I take. Something like repeating the process.

The Code might help so here it is...
mob/var
speeding = 0
walkdelay = 2

client/Move()
if(usr.speeding <= 0)
usr.speeding = 1
..()
sleep(mob.walkdelay)
usr.speeding = 0
else
return


mob/Login()
speeding = 0
..()


mob
verb
Run()
if(src.run>=1)
usr.walkdelay =0
sleep(4)
run-=1
..()
else
src<<"Your too tired, rest."
Stop_Run()
usr.walkdelay =2
Rest()
src.run+=rand(0,2)
..()


I forgot what the ..() did so I just stuck it in there, but I remmembered now so I took them out of my accual code.
You have to modify [atom]/Move() than, eg:
mob/Move()
.=..()
if(!.)return//forgot if this is suppose to be (.) or (!.) to see if movement failed before
if(src.running) src.stamina--//-- => -=1


- GhostAnime
In response to GhostAnime (#1)
Also how do I make something repeat. Liike resting, src.run+=rand(0,2). Make it so that it goes back to that line if i'm still resting and if I'm not resrint fstop the process.

((Nevermined, fixed it.))
In response to DarkD3vil666 (#2)
mob
var/recycle=0 //this is used as a flag
var/some_other_flag=0
verb
Toggle_Some_Other_Flag()
if(!some_other_flag) some_other_flag=1
else some_other_flag=0
Recycle()
if(!recycle)
recycle=1 //turns the recycle flag on...
src<<"You start to recycle."
while(recycle) //while the flag is on...do these below...
src<<"Recycling..."
if(some_other_flag) recycle=0 //if some_other_flag is on, then turn off the recycle flag
sleep(10) //sleep 1 second before going back to the start of the while loop...