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 

Help please I'm lost

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


Joined: 11 Sep 2007
Posts: 7

PostPosted: Tue Oct 09, 2007 3:10 pm    Post subject: Help please I'm lost Reply with quote

I have the code I want to use for the project I'm working on, but, I want it to be displayed only when the person types it in a certain channel. I dont want it in any other channel but that. I have all the code but I can't figure out how to make it like this

if (word isin channel) { putmsg $chan :Hi! } { else halt }

So if the word, word is not in "channel", dont do anything, but if it is. tell them the bot said hi.

Am I making any sense, I dont know if I make any sense?
Back to top
View user's profile Send private message
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Wed Oct 10, 2007 4:23 am    Post subject: Reply with quote

I'm not quite sure what you want.
Maybe this will help you:

Code:
set urchan "#chan"
set word "word"
set msg "Hi!"

bind pub - $word my:example

proc my:example {nick uhost hand chan text} {
global urchan msg

if {$chan != $urchan} { return }

putserv "PRIVMSG $chan :$msg"

#
#place additional code here
#

}
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed Oct 10, 2007 1:06 pm    Post subject: Reply with quote

Here's a typical way of limiting which channels a script runs in:

Code:

# Channels where we allow public use:
set moviechans "#mychan #chan2 #etc"

bind pub - .movies proc:movies
bind msg - .movies proc:msgmovies

proc proc:msgmovies {nick uhost hand text} {
   if {![onchan $nick]} {return}
   proc:movies $nick $uhost $hand privmsg $text
   return
}

proc proc:movies {nick uhost hand chan text} {
   set command [lindex [split $text] 0]
   if {([lsearch -exact $::moviechans $chan] == -1) && ($chan != "privmsg")} {return}
   if {([lsearch -exact $::moviequiet $chan] != -1) || ($chan == "privmsg")} {set chan $nick}

# and so on
}

Note that using $:: is equivalent to using a global declaration. So, you can use either a line like:

global moviechans

or just use $::moviechans to refer to global variables (outside of the proc)
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