How to stop a script? Help with if_then_else, please

Posted by Lucano on Tue 31 May 2005 11:20 AM — 2 posts, 30,851 views.

#0
Hello, I need to do the following: When the trigger pops up, I want to check the queue system for all the afflictions. Then, if the system finds an affliction, will eat the herb, but I need to wait for "You may eat another plant" again, so I need to stop to check for the rest of the afflictions. How do I do that?

By the way, I got the trigger to stop the timer that appears.

^You may eat another plant\.$

world.setvariable "eatcan", "1"
if world.getvariable ("confusion") = "1" then
world.setvariable "eatcan", "0"
world.setvariable "eatnow", "ash"
world.enabletimer "eatit", 1
world.execute "outr 1 ash"
world.execute "eat ash"
I NEED TO STOP FURTHER STUFF HERE
[Elseif world.getvariable ("dementia") = "1" then
world.setvariable "eatcan", "0"
world.setvariable "eatnow", "ash"
world.enabletimer "eatit", 1
world.execute "outr 1 ash"
world.execute "eat ash"
I NEED TO STOP FURTHER STUFF HERE
[MORE ELSEIF STUFF LIKE THAT ONE]
end if


Thanks in advance,

Lucano, a complete inept in coding :S
#1
Use EXIT SUB to leave the subroutine when you want to stop further processing.

In the case of this particular function, the if/elseif blocks should take care of what you wanted already. The first thing that evaluates to true will be executed and the rest won't even be tested.