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.

add Bind time to bping.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

add Bind time to bping.

Post by Nor7on »

Code: Select all

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: Select all

[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? :roll:

Thanks
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

some1 ?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Nor7on wrote:some1 ?
the junkyard perhaps?
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

and how fix this?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
Post Reply