ID:262599
 
Code:
mob
proc
Resting()
if(usr.rest == 0)
usr.stamina += 0
usr.rest = 1
if(usr.rest == 1 && usr.maxstamina)
usr.stamina += rand(1,2)
usr.move=0
usr.rest=1
sleep(5)
usr.Rest()

mob
verb
Rest()
if(!usr.resting)
icon= 'players.dmi'
icon_state = "rest"
usr << "You start resting!"
usr.canmove = 0
usr.resting = 1
while(usr.resting && (usr.stamina < usr.maxstamina || usr.Chakra < usr.maxChakra))
if(usr.stamina < usr.maxstamina) usr.stamina += rand(1,5)
if(usr.Chakra < usr.maxChakra) usr.Chakra += rand(1,5)
if(usr.stamina > usr.maxstamina) usr.stamina = usr.maxstamina
if(usr.Chakra > usr.maxChakra) usr.Chakra = usr.maxChakra
sleep(5)
if(usr.resting)
icon = 'players.dmi'
icon_state= "guy"
usr << "You finish resting!"
usr.canmove = 1
usr.resting = 0
else
return()
else
icon = 'players.dmi'
icon_state= "guy"
usr << "You stop resting!"
usr.resting = 0
usr.canmove = 1


Problem description:Well Basically what happens is that it rests and everything works fine but now, i fixed it so you cannot move when ur resting but now once you rest and you finish resting you cant move ever again. Could someone help me with this problem please?

No put usr in proc. Ungh.

Lummox JR
Kurosaki_Ichigo-San wrote:
Code:
> mob
> proc
> Resting()
> if(usr.rest == 0)
> usr.stamina += 0
> usr.rest = 1
> if(usr.rest == 1 && usr.maxstamina)
> usr.stamina += rand(1,2)
> usr.move=0
> usr.rest=1
> sleep(5)
> usr.Rest()
>
> mob
> verb
> Rest()
> if(!usr.resting)
> icon= 'players.dmi'
> icon_state = "rest"
> usr << "You start resting!"
> usr.canmove = 0
> usr.resting = 1
> while(usr.resting && (usr.stamina < usr.maxstamina || usr.Chakra < usr.maxChakra))
> if(usr.stamina < usr.maxstamina) usr.stamina += rand(1,5)
> if(usr.Chakra < usr.maxChakra) usr.Chakra += rand(1,5)
> if(usr.stamina > usr.maxstamina) usr.stamina = usr.maxstamina
> if(usr.Chakra > usr.maxChakra) usr.Chakra = usr.maxChakra
> sleep(5)
> if(usr.resting)
> icon = 'players.dmi'
> icon_state= "guy"
> usr << "You finish resting!"
> usr.canmove = 1
> usr.resting = 0
> else
> return()
> else
> icon = 'players.dmi'
> icon_state= "guy"
> usr << "You stop resting!"
> usr.resting = 0
> usr.canmove = 1
>

Problem description:Well Basically what happens is that it rests and everything works fine but now, i fixed it so you cannot move when ur resting but now once you rest and you finish resting you cant move ever again. Could someone help me with this problem please?

So many problems....

usr abuse!
mob/proc/Resting should NOT contain usr. Although it is valid in verbs, it is still(I think) cleaner programming practice to use src.

usr.rest == 0
Use !usr.rest...which really is, as I said, still abusing usr. So really you would use !src.rest or !rest

usr.rest == 1
Unless rest will hold values other than 1 or 0, use
if(rest && maxstamina)


usr.stamina += 0
What in the world is that for?

In your verb, you shouldn't have to do a check to see if you are resting. Before the loop, you set resting to 1, so unless another proc/verb modifies it, it should still be true after the loop.

Another thing I noticed, is that your Resting proc and Rest verb never call each other. I'm not sure if they are intended to do so, but I'm guessing Rest() is supposed to call Resting() somewhere.

As for why you can't move, I don't know. It would help to see how you modified mob/Move or client/Move to accomodate your canmove var. Maybe if you changed the things I said needed to be changed, you might see performance increase, and may possibly get this to work.

Hiead
In response to Lummox JR
i dunno its not working its pissing me off T_T
In response to Kurosaki_Ichigo-San
Adding on to the others:

Your Rest verb isn't calling your Resting() proc...And...Why is return called like return()? o.O