bind msgm - "*" proc:echo
bind pub n !pmon proc:on
bind pub n !pmoff proc:off
bind pub o !pm proc:send
proc proc:on {nick chan uhost hand arg} {
global qwerty
set qwerty 1
puthelp "notice $nick :PM Relay Enabled!"
}
proc proc:off {nick chan uhost hand arg} {
global qwerty
set qwerty 0
puthelp "notice $nick :PM Relay Disabled!"
}
proc proc:send {nick chan uhost hand text} {
global qwerty
if {$qwerty == 1} {
set pmnick [lindex $text 0]
set message [lrange $text 1 end]
if {$message == ""} {
puthelp "notice $nick :To correctly use this feature type: !pm <nick> message."
}
putserv "PRIVMSG $pmnick :$message"
}
}
set chan "#Chan"
proc proc:echo {nick uhost hand text} {
global chan qwerty
if {$qwerty == 1} {
set line [string trim $text]
putserv "PRIVMSG $chan :\002<$nick>\002 $line"
}
}
return 0
putlog "pm echo loaded"
This is my first attempt at a PM relay script, i only got my eggdrop a few days ago and am still new to all this tcl scripting, i've done the best i can (which is probably sloppy scripting) and the above seems to work perfectly but i have been trying to implement a process that will relay a persons ACTIONS to channel, but fail miserably everytime.
Please help me.
Thanks in advance.
Dave.
Last edited by spudgun on Sun Nov 09, 2003 8:00 am, edited 1 time in total.
bind ctcp - ACTION echo:act
proc echo:act {nick uhost hand dest key arg} {
global chan qwerty
if {$qwerty == 1} {
set line [split $arg]
putserv "PRIVMSG $chan :\002<$nick>\002 $line"
}
}
this will relay actions.
Just for advise: use [lindex [split $text]...] and [join [lrange [split $text].....] to me more secure, and remove the "return 0" at the end of the script, it has no use.
I just want it to relay actions done to the bot in PM (private message) and not those in the channel.
Please help me with this small complication because i am so close to finishing this (my first tcl script) and would happily release the whole code for other to use.
Thanks in advanced.
Dave
p.s. thanks for the advice: "[lindex [split $text]...] and [join [lrange [split $text].....]" i used this instead of my original code and it now doesn't have strange results when special characters are used.
Thanks for that, i couldn't seem to find how to use the sample piece of code you provided...but i did manage to get it working correctly after looking at what you supplied, thanks.
bind msgm - "*" echo:msg
bind ctcp - ACTION echo:act
bind pub n !pmon proc:on
bind pub n !pmoff proc:off
bind pub o !pm proc:smsg
bind pub o !apm proc:sact
### Specify the PM relay channel ###
set chan "#ChannelName"
proc proc:on {nick chan uhost hand arg} {
global status
set status 1
puthelp "notice $nick :PM Relay Enabled!"
}
proc proc:off {nick chan uhost hand arg} {
global status
set status 0
puthelp "notice $nick :PM Relay Disabled!"
}
proc proc:smsg {nick chan uhost hand text} {
global status
if {$status == 1} {
set pmnick [lindex [split $text] 0]
set message [join [lrange [split $text] 1 end]]
putserv "PRIVMSG $pmnick :$message"
if {$message == ""} {
puthelp "notice $nick :To correctly use this feature type: !pm <nick> message."
}
}
if {$status == 0} {
puthelp "notice $nick :The PM Relay Function Is Currently Disabled."
}
}
proc echo:msg {nick uhost hand text} {
global chan status
if {$status == 1} {
set line [string trim $text]
putserv "PRIVMSG $chan :\002<$nick>\002 $line"
}
}
proc echo:act {nick uhost hand dest key arg} {
global chan status
if {$status == 1} {
if {$dest == $::botnick} {
set line [split $arg]
putserv "PRIVMSG $chan :\002* $nick\002 $line"
}
}
}
proc proc:sact {nick chan uhost hand text} {
global status
if {$status == 1} {
set pmnick [lindex [split $text] 0]
set message [join [lrange [split $text] 1 end]]
putserv "PRIVMSG $pmnick :\001ACTION $message\001"
if {$message == ""} {
puthelp "notice $nick :To correctly use this feature type: !apm <nick> action."
}
}
if {$status == 0} {
puthelp "notice $nick :The PM Relay Function Is Currently Disabled."
}
}
putlog "PM EcHo By DiStUrBeD LoaDeD!"
##############################
# Commands #
##############################
# #
# !pm <nick> message #
# sends the given message #
# to the specified nickname #
# #
# !apm <nick> action #
# sends the given action #
# to the specified nickname #
# #
# !pmon turns the pm relay #
# function on #
# #
# !pmoff turns the pm relay #
# function off #
# #
##############################
That's the final version of the script i'm using.
Thanks Sir_Fz for all your help.