This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

How to use a tcl script on two #channels?

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
N
N30
Voice
Posts: 2
Joined: Tue Jun 16, 2009 9:51 am

How to use a tcl script on two #channels?

Post by N30 »

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"
}
}
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

Post by raider2k »

usually that one should do the trick, untested though:

Code: Select all

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!
N
N30
Voice
Posts: 2
Joined: Tue Jun 16, 2009 9:51 am

Post by N30 »

Thank you!:). Worked perfectly!
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

Post by raider2k »

my pleasure, fine it works out :)

please also add [SOLVED] to your threads topic as a prefix if it has been solved ;)
Post Reply