ID:145211
 
Code:
mob/var/training = 0
mob/var/stam = 10
mob/var/stamax = 10

mob/verb/Train()
set category = "Training"
usr << "You begin to train"
usr.training = 1
usr.stam -= rand(1,3)
usr.stamax += 1
usr.Pl += 0.1
usr.MaxPl += 0.1
train()
return

if(usr.training == 1)
usr.training = 0
usr << "You stop training"
return

proc
train()
if(usr.stam <= 1)
usr.training = 0
usr.stam = 1
usr.Pl += 0
usr.MaxPl += 0
usr.stamax += 0
usr << "your to tired"
else
usr.training = 1
return


Problem description: How do i make it loop so i dont have to keep clicking? and how do i make it that you dont gain Pl or Staimina when your on 1 stam? my way didn't work.

Any help?
In response to Strong123488
Please wait a full 24-hours before bumping your previous post.

I'm assuming that this is a zeta code, since the code structure is horrid.
  • The way you use boolean variables is incorrect. Since you only need !var to prove false, or var to prove true.
  • A simple while() loop can solve your problem.
  • You have a return label in the Train() verb, disallowing it to finish.


mob/var
Training=0
Stamina=10
MaxStamina=10

mob/verb/Train()
set category="Training"
if(Training){src<<"You stop training!";Training=0;return}
src<<"You begin to train!"
Training=1
while(Stamina>0&&Training) //This will repeatly run the next block of code until the statement is proven false.
Stamina=max(0,Stamina-rand(1,3))
MaxPL+=0.1
PL+=0.1
MaxStamina++
if(!Stamina){src<<"You're too tired!";Training=0}