ID:1578133
 
Keywords: training
(See the best response by LordAndrew.)
Code:
mob
verb
Train()
if (usr.flying == 0)
usr<<"You commence with your training."
icon='player.dmi'
icon_state="sparfury"
exp+=nextexp/rand(10,50)
Learn_Kamehameha()
Learn_Galick_Gun()
Learn_Special_Beam_Cannon()
spawn(30)
LevelCheck()
else if (usr.flying == 1)
usr<<"You can't fly and train at the same time."


proc
LevelCheck()
if(src.exp>=src.nextexp)
src.exp=src.exp-src.nextexp
src.nextexp*=2
src.level+=1
src.max_powerlevel += rand(1000,10000)
src.powerlevel += rand(1000,10000)
src.ki += rand(1000,10000)
src.max_ki += rand(1000,10000)
src<<"You are now Level [src.level]"


mob
var
powerlevel
max_powerlevel
ki
max_ki
level
exp
nextexp
zenni
flying=0





proc
Power_Level_Interchange()
if (usr.powerlevel >= usr.max_powerlevel)
usr.powerlevel = usr.max_powerlevel


Problem description:


Well, the code comes up fine, no runtime errors . . . However . . . When I actually test out the Train verb, I can't figure out how to make it end. I tried to make an else directive, but everything I try just doesn't work. Any tips?

P.S. I know I am kind of noobish, but I just started good coding a few days ago. My last game, a few months ago, did NOT go so well . . .
Could you elaborate more on what you mean by making the verb end?
What I mean by making the verb end is stopping the training.
In response to SSJinfinite
Best response
Ah. You'd want to create a variable that you can check to see if the person is still training:

mob
var is_training = FALSE

mob/verb/Train()
// This is a simple short-hand way of setting a Boolean to its opposite value.
src.is_training = !src.is_training

if (src.is_training)
src << "You're working out really hard!"

else
src << "You're just lounging around."

// This verb more or less does the same as the above verb, and may be more ideal for what you're trying to do.
mob/verb/Train()
if (src.is_training)
src << "You stop training."
src.is_training = FALSE

else
src << "You start training!"
src.is_training = TRUE
There's no loop. You are just are leaving the player's icon_state at "sparfury".