Reputation: 55
if { $chan == $chan_(1) || $chan == $chan_(2) && $nick == $ircbotnick } {
.....more code
The chan is defined with set chan_(1) "#1"
etc
but when I add additional fields ie $chan == $chan_(3)
that third or 4th channel fails to work as the first two do. It's supposed to pick up irc chat announces but it works as I posted but when I add more channels to it it fails on the added channels and only works with the 2 original channels 1 and 2.
Any help would be appreciated please.
Upvotes: 0
Views: 44
Reputation: 1863
Instead of adding more and more $chan == ...
conditions, try creating a list and then check for list inclusion with in
.
set valid_chans [list $chan_(1) $chan_(2) $chan_(3)]
if {$chan in $valid_chans && $nick == $ircbotnick } {
...
}
Adding additional channels to the valid_chans
list is easy to do and the if
statement does not need to change.
Upvotes: 1