mIRC Homepage
Posted By: quanbhvn How much use if statement in an event? - 26/09/15 03:19 PM
I have a script like this:
Code:
on *:TEXT:*:#Mychan: {
if (*atext* iswm $1-) { msg $chan text No 1 }
elseif (*btext* iswm $1-) { msg $chan text No 2 }
elseif (*ctext* iswm $1-) { msg $chan text No 3 }
elseif (*dtext* iswm $1-) { msg $chan text No 4 }
...
...
...
elseif (*ztext* iswm $1-) { msg $chan text No 99 }
}


Thus, have limit to the number of "elseif" allowed to use?

Although it still works, but I think the syntax is not correct.

Please help me to present a more accurate script.

Thank you.
Posted By: westor Re: How much use if statement in an event? - 26/09/15 06:21 PM
You can use unlimited 'elseif' statement and is the only way in that code that your are trying to do.
Posted By: quanbhvn Re: How much use if statement in an event? - 30/09/15 03:41 AM
Originally Posted By: westor
You can use unlimited 'elseif' statement and is the only way in that code that your are trying to do.


I've tried, it seems it works not very accurate. I've used 200 elseif statement. sometimes it works, sometimes not. If my statement is wrong, it will never work. So I think my statement was correct. How to use 200 or even 2000 statement "elseif" but the script still works correctly?
Posted By: quanbhvn Re: How much use if statement in an event? - 30/09/15 06:44 AM
I'm pretty sure there are many other ways and smarter but i can't think something better for now. Please help me. Thank you.
Posted By: OrFeAsGr Re: How much use if statement in an event? - 30/09/15 08:45 AM
If you have a list of text matches and they're not some kind of text commands that may need further if statements you can save the matches on an .ini file and their values should then be the replies.
In case you haven't used .ini before type /help /writeini
/help $readini
© mIRC Discussion Forums