egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

add Bind time to bping.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Wed Jun 04, 2008 5:40 am    Post subject: add Bind time to bping. Reply with quote

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? Rolling Eyes

Thanks
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Thu Jun 05, 2008 12:42 pm    Post subject: Reply with quote

some1 ?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Thu Jun 05, 2008 1:11 pm    Post subject: Reply with quote

Nor7on wrote:
some1 ?

the junkyard perhaps?
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Thu Jun 05, 2008 1:13 pm    Post subject: Reply with quote

and how fix this?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Jun 05, 2008 1:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber