| View previous topic :: View next topic |
| Author |
Message |
CharlesZink Voice
Joined: 28 Feb 2010 Posts: 12 Location: The Interweb
|
Posted: Sat Apr 10, 2010 4:26 pm Post subject: IF / ELSEIF Help?? |
|
|
Hi, this is what I have gotten so far and it doesn't say anything in chat, but I do get this error message in Telnet..
| Quote: | | [20:22] Tcl error [website_disp]: syntax error in expression "$channel == #techhelpwithjeff": character not legal in expressions |
So I guess the '#' is the problem, but how do I tell it what channel then?
| Code: |
bind pub - !site website_disp
proc website_disp {nick host handle channel testes } {
if {$channel == #techhelpwithjeff} {
putserv "PRIVMSG $channel :$nick, our website is http://www.techhelpwithjeff.com/"
} elseif {$channel == #sams-tech} {
putserv "PRIVMSG $channel :$nick, our website is http://www.smartysamscomputerbuilds.com/"
} elseif {$chanel == #thenerdtv} {
putserv "PRIVMSG $channel :$nick, our website is http://www.thenerdtv.com/"
} else { putserv "PRIVMSG $channel :$nick, I do not have a site defined for this channel yet"
}
return 0
}
|
_________________ Find Me: irc.tysonbrooks.net:6667 / #thenerdtv
Bots:
Nick: UniverseBot - Channels: #thenerdtv #sams-tech #bots #techhelpwithjeff
Nick: CitronBOT - Channel: #anatolie (GeekShedIRC) |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat Apr 10, 2010 5:09 pm Post subject: Re: IF / ELSEIF Help?? |
|
|
| Code: | bind pub - !site website_disp
proc website_disp {nick host handle channel testes} {
switch -- $channel {
"#techhelpwithjeff" { putserv "PRIVMSG $channel :$nick, our website is http://www.techhelpwithjeff.com/" }
"#sams-tech" { putserv "PRIVMSG $channel :$nick, our website is http://www.smartysamscomputerbuilds.com/" }
"#thenerdtv" { putserv "PRIVMSG $channel :$nick, our website is http://www.thenerdtv.com/" }
default { putserv "PRIVMSG $channel :$nick, I do not have a site defined for this channel yet" }
}
return 1
}
|
[switch] makes sense here, as those nested if/elseif/elseif/etc look horrible. You also want to make sure to return 1 from this "pub" procedure. If this were a glob matched "pubm" bind instead, a return of 0 would be used. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|