Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ How to stop a script? Help with if_then_else, please

How to stop a script? Help with if_then_else, please

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Lucano   (2 posts)  Bio
Date Tue 31 May 2005 11:20 AM (UTC)
Message
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
Top

Posted by Larkin   (278 posts)  Bio
Date Reply #1 on Tue 31 May 2005 05:04 PM (UTC)

Amended on Tue 31 May 2005 05:05 PM (UTC) by Larkin

Message
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.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


29,623 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.