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 

!ping script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
mAxP
Voice


Joined: 13 Feb 2006
Posts: 8

PostPosted: Mon Feb 13, 2006 9:40 am    Post subject: !ping script Reply with quote

hu xperts Very Happy
im looking for a tcl script for my BOTNET

i tipe "!ping" in public chan
and ALL bots should response with "ping : 90ms" -> pinging the irc server they are connected on

i searched for it a long time Sad

can somebody help me?

Very Happy

THX A LOT

-> ex.
(14:39:33) (@MAXP) !ping
(14:39:34) (@warb0t1) ping 83ms
(14:39:35) (@warb0t2) ping 73ms
(14:39:35) (@warbot3) ping 120ms
Back to top
View user's profile Send private message
GeeX
Voice


Joined: 19 Sep 2005
Posts: 29

PostPosted: Mon Feb 13, 2006 12:14 pm    Post subject: Reply with quote

Code:

#
#
#  __      __  __                  ______     
# /\ \    /\ \/\ \                /\  _  \   
# \ \ \/'\\ \ `\\ \    ___     ___\ \ \_\ \   
#  \ \ , < \ \ , ` \  / __`\  /'___\ \  __ \ 
#   \ \ \\`\\ \ \`\ \/\ \_\ \/\ \__/\ \ \/\ \
#    \ \_\ \_\ \_\ \_\ \____/\ \____\\ \_\ \_\
#     \/_/\/_/\/_/\/_/\/___/  \/____/ \/_/\/_/
#
#   __ __    ______          __      ____                 ____                 ___     
#  _\ \\ \__/\__  _\        /\ \    /\  _`\    __        /\  _`\           __ /\_ \     
# /\__  _  _\/_/\ \/     ___\ \ \___\ \ \_\ \ /\_\    ___\ \ \_\_\     __ /\_\\//\ \   
# \/__\ \\ \__ \ \ \    /'___\ \  _ `\ \  _ <'\/\ \ /' _ `\ \ \  __  /'__`\/\ \ \ \ \   
#   /\_   _  _\ \_\ \__/\ \__/\ \ \ \ \ \ \_\ \\ \ \/\ \/\ \ \ \/, \/\  __/\ \ \ \_\ \_
#   \/_/\_\\_\/ /\_____\ \____\\ \_\ \_\ \____/ \ \_\ \_\ \_\ \____/\ \____\\ \_\/\____\
#      \/_//_/  \/_____/\/____/ \/_/\/_/\/___/   \/_/\/_/\/_/\/___/  \/____/ \/_/\/____/
#
#
#                   kNocA #IchBinGeil @ QuakeNet irc.quakenet.org
#
#
#
# -------------------------------------------------------------------------------
# Usage:
# -------------------------------------------------------------------------------
#
# !lag
#
# -------------------------------------------------------------------------------

bind pub n !lag    lag:pub
bind ctcp - lag    lag:ctcp

set lag(version)   1.0

proc lag:pub { nick host hand chan arg } {

   global lag

   set lag(start)    [clock clicks]
   set lag(chan)      $chan

   putquick "PRIVMSG $::botnick :\001LAG\001"
}

proc lag:ctcp { nick host hand dest key arg } {

   global lag

   if {$nick != $::botnick} { return }

   set lag(end) [clock clicks]

   if {[expr $lag(end) - $lag(start)] > 1000000} {
      set time    "[expr ($lag(end) - $lag(start)) / 1000 / 1000.]sec"
   } else {
      set time   "[expr ($lag(end) - $lag(start)) / 1000.]ms"
   }

   putquick "PRIVMSG $lag(chan) :My lag on $::server: $time"
}

putlog "Lag-Script v$lag(version) by kNocA loaded."
Back to top
View user's profile Send private message
mAxP
Voice


Joined: 13 Feb 2006
Posts: 8

PostPosted: Tue Feb 14, 2006 2:59 pm    Post subject: Reply with quote

hey cool thx

is it possible to change
(19:53:22) (@MAXP) !ping
(19:53:23) (@warb0t1) Ping 167.991ms
to

(19:53:22) (@MAXP) !ping
(19:53:23) (@warb0t1) Ping 167ms


i dont need the ping so exact

is it normal that the ping is that bad?
i tested 5 irc servers and all pings were >150ms -.-

max
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Feb 14, 2006 3:04 pm    Post subject: Reply with quote

change all occurances of 1000. to just 1000 (without the decimal point).
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
mAxP
Voice


Joined: 13 Feb 2006
Posts: 8

PostPosted: Tue Feb 14, 2006 6:14 pm    Post subject: Reply with quote

<3 THX

but is this script realy exact?
the pings are very high i hink i get over 180ms usualy Sad
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Feb 15, 2006 1:08 pm    Post subject: Reply with quote

That's not exactly the 'server' lag is it?

Eventhough ascii in a script is nice, when the actual ascii gets bigger then the code it's time to consider if it's really needed.


(UNTESTED!)
Code:

bind PUB  n   !ping     pub:lag

proc pub:lag {nick host hand chan args} {
  global time tmpchan
  set time [clock clicks]; set tmpchan $chan
  bind RAW - 391 raw:catchlag
  putquick "TIME"
}

proc raw:catchlag {from key info} {
  global time tmpchan
  unbind RAW - 391 raw:catchlag
  putquick "PRIVMSG $tmpchan :[expr ([clock clicks] - $time)/1000] ms lag on [lindex [split $::server :] 0]"
}
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Feb 15, 2006 7:31 pm    Post subject: Reply with quote

Something like this will work as well
Code:
bind pub n !lag lag:pub
bind raw - PONG lag:raw

proc lag:pub {nick uhost hand chan arg} {
 global sping
 if {![info exists sping([set chan [string tolower $chan]])]} {
  putserv "ping [clock clicks]"
  set sping($chan) 1
 }
}

proc lag:raw {from kw arg} {
 global sping
 set lag [expr {([clock clicks]-[string trimleft [lindex [split $arg] e] :])/1000}]
 foreach {c v} [array get sping] {
  puthelp "privmsg $c :Reply from $from: $lag ms"
 }
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
GeeX
Voice


Joined: 19 Sep 2005
Posts: 29

PostPosted: Thu Feb 16, 2006 4:35 pm    Post subject: Reply with quote

It is the real server ping Wink
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 Requests 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