can i use /iif or maybe even $iif inside of on text statments, replacing /if like this:
on @15:text:!* :#: {
$iif($1 == !die,part $chan,notice $nick Nope, No Access.)
}
(for my bot) im wondering because before i tear the crap out of my codes, i want to know if it works or not..
$iif is mostly used for minor variances in a string, and not the best choice for your situation.
on @15:text:!* :#: {
if ($1 == !die) part $chan
elseif ($1 == !fart) describe $chan lets one rip $iif($2 ison $chan,at $2) $+ .
else notice $nick Nope, Access Denied.
}
You can see where I used $iif to add "at somenick" if the user typed !fart somenick.
If they don't specify a nick, then nothing else is added. (no false condition is required)
- Raccoon
well my problem is i have many if !blah == $1 statments and then i have if staments in that, so if there was a way to simplfy it that'd be nice
For each condition you must use one if statement. Using $iif is possible, but to get it working right, you would have to start nesting $iif's, which is even worse than using multiple if's.
Besides, in the end how the code looks isn't imprtant.
on @15:text:!* :#: {
if ($1 == !die) {
other statements
part $chan
}
elseif ($1 == !fart) describe $chan lets one rip $iif($2 ison $chan,at $2) $+ .
else notice $nick Nope, Access Denied.
}
Your script is as complex as you make it. If there are some global if-statements that are alike for multiple triggers, there are many ways of consolidating your code so you don't have to repeat the same check over and over in each one.
- Raccoon
You can try something like this...
1) Make an ini file with the following setup;
[commands]
!die=<enter commands for !die>
!blah=/msg $chan $nick said blah!
2) Use an if statement in your TEXT event to check whether the command is listed
if ($readini(commands.ini,commands,$1)) { return }
else { do this }
This will only need one if statement and you can add/delete commands with ease just by using /writeini, /remini