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 

How to use a tcl script on two #channels?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
N30
Voice


Joined: 16 Jun 2009
Posts: 2

PostPosted: Tue Jun 16, 2009 9:53 am    Post subject: How to use a tcl script on two #channels? Reply with quote

How to edit "Set Chan " so i can use 2 #channels?
Script =
set listenport ""

# port for your script you want to listen on (you need to set same port in php script)

set password ""

# password (you need to set same password in php script)

set chan ""

# channel you want to send output to

listen $listenport script botlisten

proc botlisten {idx} {
control $idx botlisten2
}

proc botlisten2 {idx args} {

set args [join $args]
set password1 [lindex [split $args] 0]
set message [join [lrange [split $args] 1 end]]

if {[string match $::password $password1]} {
putquick "PRIVMSG $::chan :$message"
} else {
putlog "Unauthorized person tried to connect to the bot"
}
}
Back to top
View user's profile Send private message
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Tue Jun 16, 2009 11:16 am    Post subject: Reply with quote

usually that one should do the trick, untested though:

Code:

Script =
set listenport ""

# port for your script you want to listen on (you need to set same port in php script)

set password ""

# password (you need to set same password in php script)

set multichannels [list #channel1 #channel2]

# channel you want to send output to
# add more channels if you want using the same way as above

listen $listenport script botlisten

proc botlisten {idx} {
   control $idx botlisten2
}

proc botlisten2 {idx args} {
   set args [join $args]
   set password1 [lindex [split $args] 0]
   set message [join [lrange [split $args] 1 end]]
   if {[string match $::password $password1]} {
# NEW FROM HERE
      foreach cchannel $::multichannels {
         putquick "PRIVMSG $cchannel :$message"
# NEW END HERE
      }
   } else {
      putlog "Unauthorized person tried to connect to the bot"
   }
}


correct syntax ftw!
Back to top
View user's profile Send private message
N30
Voice


Joined: 16 Jun 2009
Posts: 2

PostPosted: Tue Jun 16, 2009 12:49 pm    Post subject: Reply with quote

Thank you!Smile. Worked perfectly!
Back to top
View user's profile Send private message
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Wed Jun 17, 2009 12:54 am    Post subject: Reply with quote

my pleasure, fine it works out Smile

please also add [SOLVED] to your threads topic as a prefix if it has been solved Wink
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 -> Script Requests 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