IF and GOTO
 
Post new topic   Reply to topic    Hawkee.com Forum Index -> mIRC Tutorials
 
`Kazuma  -  Tue Jan 31, 2006 9:22 am Reply with quote
One of the biggest mistakes beginning scripters make is assuming that you MUST have an 'else' statement, or that you have to 'goto' to get to your commands. Commonly seen in scripts-
Code
 

In most cases, the 'else' section can be completely removed. Or another example, using goto:
Code
 

Instead of using gotos like this, just stick the code in the ifs:
Code
 

A final example of an if that doesn't need a goto:

Code
 

This assumes that ':end' is a label at the end of the routine. Instead, just use 'return'- it will end the current alias or remote, without halting any default behaviors or other scripts. (same end effect.)
Smile
Acid-Religion  -  Sat May 20, 2006 6:04 pm Reply with quote
Quite right. Using the else halt command can really mess up things.. And if you on top of that use On *:text:*:*: it will really mess things up...
I usually refrain from using halt altogether as experience shows that I do not need it at all (mostly).. Smile
Mylesmart  -  Sat May 05, 2007 1:09 pm Reply with quote
yes, i agree with acid.
CakerX  -  Fri May 11, 2007 2:25 pm Reply with quote
don't use halt unless you want to stop EVERYTHING.

return works best, use /return $null
Display posts from previous:   
Post new topic   Reply to topic    Hawkee.com Forum Index -> mIRC Tutorials All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.