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.
Old posts that have not been replied to for several years.
keeper
Voice
Posts: 2 Joined: Sat Feb 05, 2005 5:50 pm
Post
by keeper » Sat Feb 05, 2005 5:56 pm
I kinda new to tcl coding but by searching this great forum i mangare to almost made it work
Code: Select all
bind pub "-|-" !pp ping_proc
proc ping_proc {nick uhost handle channel arg} {
set nr [lindex $arg 0]
set target [lindex $arg 1]
set i [exec /bin/ping -c $nr $target]
fileevent $i readable "outp $i"
}
proc outp {i channel} {
putquick "PRIVMSG $channel :[gets $i]"
if [eof $i] {close $i}
}
when i type the following in the channel i get this error in the bot..
Tcl error [ping_proc]: can not find channel named "PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.055 ms
--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.055/0.055/0.055/0.000 ms"
anyone know how to fix this ?
cheers!
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Sat Feb 05, 2005 6:18 pm
this wont give you the channel. you have to save it globally and retrieve it again in the proc.
But I wonder anyway in which part ever a command is called requiring a channel (putquick doesnt require a channel name).
Last edited by
De Kus on Sat Feb 05, 2005 6:21 pm, edited 1 time in total.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Sat Feb 05, 2005 6:18 pm
I'd use eval instead
Code: Select all
bind pub "-|-" !pp ping_proc
proc ping_proc {nick uhost handle channel arg} {
set num [lindex [split $arg] 0]
set target [lindex [split $arg] 1]
set command [concat exec /bin/ping -c $num $target]
set return [eval $command]
foreach output [split $return \n] {
putserv "PRIVMSG $channel :$output"
}
}
keeper
Voice
Posts: 2 Joined: Sat Feb 05, 2005 5:50 pm
Post
by keeper » Sat Feb 05, 2005 6:22 pm
Thanks