egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IF / ELSEIF Help??

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
CharlesZink
Voice


Joined: 28 Feb 2010
Posts: 12
Location: The Interweb

PostPosted: Sat Apr 10, 2010 4:26 pm    Post subject: IF / ELSEIF Help?? Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Apr 10, 2010 5:09 pm    Post subject: Re: IF / ELSEIF Help?? Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber