mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2015
Posts: 25
Q
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jul 2015
Posts: 25
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.

Last edited by quanbhvn; 26/09/15 03:25 PM.
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
You can use unlimited 'elseif' statement and is the only way in that code that your are trying to do.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2015
Posts: 25
Q
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jul 2015
Posts: 25
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?

Joined: Jul 2015
Posts: 25
Q
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jul 2015
Posts: 25
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.

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
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

Last edited by OrFeAsGr; 30/09/15 08:47 AM.

Link Copied to Clipboard