|
|
Joined: Aug 2003
Posts: 148
Vogon poet
|
OP
Vogon poet
Joined: Aug 2003
Posts: 148 |
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..
_________ may death strike you.
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
$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. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: Aug 2003
Posts: 148
Vogon poet
|
OP
Vogon poet
Joined: Aug 2003
Posts: 148 |
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
_________ may death strike you.
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
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.
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
Joined: Aug 2003
Posts: 148
Vogon poet
|
OP
Vogon poet
Joined: Aug 2003
Posts: 148 |
ok... thanks
_________ may death strike you.
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
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
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: May 2003
Posts: 215
Fjord artisan
|
Fjord artisan
Joined: May 2003
Posts: 215 |
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
- Jason
|
|
|
|
|
|