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.

hide CTCP reply PING (Solved)

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
DarkRaptor
Voice
Posts: 36
Joined: Sat Apr 15, 2006 2:39 am
Location: Trois-Rivières, Qc

hide CTCP reply PING (Solved)

Post by DarkRaptor »

Hi

I make a script to check X's lag and I would like to hide the reply from partyline.

Code: Select all

[13:11] CTCP reply PING: 1191172279 from X (cservice@undernet.org) to Botnick
My code

Code: Select all

proc ctcr { nick host hand dest keyword text } {
           if {$nick == "X" && [isbotnick $dest]} {
                     setuser X XTRA ping [expr [unixtime] - $text]
           }
}
I'm not a TCL Scripter expert. Any help will be appreciate.

Thanks in advance.
Last edited by DarkRaptor on Thu Oct 04, 2007 12:00 pm, edited 3 times in total.
DarkRaptor @ irc.undernet.org
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I guess you could try to add "return 1" at the end of the code to prevent further processing..
NML_375
User avatar
DarkRaptor
Voice
Posts: 36
Joined: Sat Apr 15, 2006 2:39 am
Location: Trois-Rivières, Qc

Post by DarkRaptor »

Doesn't work. I always get the reply.
DarkRaptor @ irc.undernet.org
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Ahh, true...

Actually, as I recall now, the only thing you could do is to turn off msg-logging in your console, which might not be preferrable; or use raw bindings to catch the notice, and prevent it from being processed further by eggdrop. Using raw bindings could, however, cause your bot to behave in unexpected ways if you are not careful.
NML_375
User avatar
DarkRaptor
Voice
Posts: 36
Joined: Sat Apr 15, 2006 2:39 am
Location: Trois-Rivières, Qc

Post by DarkRaptor »

Thx nml375. It's working now with bind RAW and return 1.

Code: Select all

bind RAW - NOTICE FreeOP_ping_reply

proc FreeOP_ping_reply { from keyword text } {
        set nick [lindex [split [lindex [split $from] 0] "!"] 0]
        set unixtime [regexp -all -inline {[0-9]} [lindex $text 2]]
        set unixtime [regsub -all { } "$unixtime" ""]
        if {[nick2hand $nick] == "X"  && [string match "*PING" [lindex $text 1]]} {
                setuser X XTRA ping [expr [unixtime] - $unixtime]
                putloglev d * "Ping Reply of [expr [unixtime] - $unixtime] seconds from X"
                return 1
        }
}
DarkRaptor @ irc.undernet.org
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Just a word of advice, don't use lindex directly on $text, as it is a string (from an untrusted source aswell). Considder split:ing it into a list first...
NML_375
Post Reply