| View previous topic :: View next topic |
| Author |
Message |
mAxP Voice
Joined: 13 Feb 2006 Posts: 8
|
Posted: Mon Feb 13, 2006 9:40 am Post subject: !ping script |
|
|
hu xperts
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
can somebody help me?
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 |
|
 |
GeeX Voice
Joined: 19 Sep 2005 Posts: 29
|
Posted: Mon Feb 13, 2006 12:14 pm Post subject: |
|
|
| 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 |
|
 |
mAxP Voice
Joined: 13 Feb 2006 Posts: 8
|
Posted: Tue Feb 14, 2006 2:59 pm Post subject: |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Feb 14, 2006 3:04 pm Post subject: |
|
|
change all occurances of 1000. to just 1000 (without the decimal point). _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
mAxP Voice
Joined: 13 Feb 2006 Posts: 8
|
Posted: Tue Feb 14, 2006 6:14 pm Post subject: |
|
|
<3 THX
but is this script realy exact?
the pings are very high i hink i get over 180ms usualy  |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Wed Feb 15, 2006 1:08 pm Post subject: |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Feb 15, 2006 7:31 pm Post subject: |
|
|
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 |
|
 |
GeeX Voice
Joined: 19 Sep 2005 Posts: 29
|
Posted: Thu Feb 16, 2006 4:35 pm Post subject: |
|
|
It is the real server ping  |
|
| Back to top |
|
 |
|