| View previous topic :: View next topic |
| Author |
Message |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Thu Jun 17, 2010 12:31 pm Post subject: Multiple if $nicks? [SOLVED] |
|
|
Ok, say I've got this bit of code:
| Code: | if {$nick == "DJCharlie"} {
...rest of proc goes here...
}
|
What I'd like, is to check if the nick is DJCharlie OR another authorized nick. Is that possible? If so, how?
Thanks in advance!
Last edited by DJCharlie on Fri Jun 18, 2010 3:20 pm; edited 1 time in total |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Jun 17, 2010 3:29 pm Post subject: |
|
|
To use the logical OR in a conditional, do something like this:
| Code: | ...
if {conditional1 || conditional2} {
... |
Where conditional1 would be one conditional such as $nick == "DJCharlie".
In the case you'd like to test one variable against multiple values, this could be optimized using the switch command:
| Code: | ...
switch $nick {
"DJCharlie" -
"NML_375" -
"SomeOtherDude" {
...
}
}
.. |
In this case, the - means "use the next match", which allows us to stack an infinite number of cases to use the same code. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Fri Jun 18, 2010 3:19 pm Post subject: |
|
|
| That fixed it, thanks! |
|
| Back to top |
|
 |
|