| View previous topic :: View next topic |
| Author |
Message |
Nor7on Op

Joined: 03 Mar 2007 Posts: 185 Location: Spain - Barcelona
|
Posted: Wed Jun 04, 2008 5:40 am Post subject: add Bind time to bping. |
|
|
| Code: |
proc ping_send {hand idx text} {
global pingidx tcl_version
set pingidx $idx
set bots [string tolower [bots]]
set pingbot [string tolower [lindex $text 0]]
if {$tcl_version >= 8.3} {
set time [clock clicks -milliseconds]
} else {
set time [unixtime]
}
if {$pingbot != ""} {
if {[lsearch $bots $pingbot] != "-1"} {
putbot $pingbot "BOTPING $time"
putdcc $idx "Pinging $pingbot."
} else {
putdcc $idx "That bot isn't on the botnet."
return 0
}
} else {
putallbots "BOTPING $time"
putdcc $idx "Pinging the entire botnet."
}
return 1
}
proc ping_echo {bot command text} {
global replied_ping
if {$command == "BOTPING" && ![info exists replied_ping]} {
set replied_ping yes
utimer 20 {unset replied_ping}
putbot $bot "BOTPING_RPLY $text"
putlog "Pinged by $bot"
}
}
proc ping_reply {bot command text} {
global pingidx tcl_version
if {$command == "BOTPING_RPLY"} {
if {$tcl_version >= 8.3} {
set replytime [expr [expr [clock clicks -milliseconds] - [split $text]] / 1000.0]
} else {
set replytime [expr [unixtime] - [split $text]]
}
putdcc $pingidx "Ping reply from $bot\: $replytime secs"
}
}
bind time - "?0 * * * *" ping_send
bind time - "?5 * * * *" ping_send
bind dcc m bping ping_send
bind bot - BOTPING ping_echo
bind bot - BOTPING_RPLY ping_reply
|
hi i add two bind times, but i get this error.
| Code: |
[09:35] Tcl error [ping_send]: wrong # args: should be "ping_send hand idx text"
[09:35] #Nor7on# set errorInfo
Currently: wrong # args: should be "ping_send hand idx text"
Currently: while executing
Currently: "ping_send $_time1 $_time2 $_time3 $_time4 $_time5"
|
so, whats wrong?
Thanks |
|
| Back to top |
|
 |
Nor7on Op

Joined: 03 Mar 2007 Posts: 185 Location: Spain - Barcelona
|
Posted: Thu Jun 05, 2008 12:42 pm Post subject: |
|
|
| some1 ? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
|
| Back to top |
|
 |
Nor7on Op

Joined: 03 Mar 2007 Posts: 185 Location: Spain - Barcelona
|
Posted: Thu Jun 05, 2008 1:13 pm Post subject: |
|
|
| and how fix this? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Jun 05, 2008 1:23 pm Post subject: |
|
|
Simply put, ping_send is written to be used with dcc bindings, not time...
If you wish to use time bindings, you'll have to write a separate proc for it...
A more advanced explanation; dcc bindings call the command with the added arguments handle, idx, and text. Hence ping_send is written to expect three arguments, where the second one should be the idx of an active dcc connection, and the third one the name of the bot to be pinged. Time bindings however, calls the command with the added arguments minute, hour, day, month, year. This means that you try to call ping_send with two arguments too many, and the second argument obviously isn't an idx, but the current hour, and the third isn't a name of a bot, but the current day. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|