ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
LagMeter tutorial
Description: Simple tutorial that teach how to check your lag.
Index:
1ş - Basic knowledge
2ş - Events
3ş - Code Eg
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
1ş - Basic Knowledge
Well to start you must know something about how to store data. Data can be stored on text documents, %vars, hashtables, etc. You can use one of the above mentioned methods to store what you need to check your lag, and make options on it, such as Max lag, Min lag, check delay, etc.
You need to know something about Halting Default Text (check mIRC /help) and some events (on notice, on pong and ctcp).
What is lag?
Lag it the time that a message takes to arrive to someone, and recieve an answer, it can be measured in miliseconds.
How can i measure it?
You can use notice , raw and ctcp , i'll give you some egs:
/notice $me lag
/raw -q ping lag
/ctcp $me lag
when you recieve the signal, you have to analyse the message:
on notice event -
on *:notice:lag:*:{ if ($nick == $me) { haltdef | commands } }
on pong event -
on *:pong:{ if (lag iswm $2) { haltdef | commands } }
ctcp event -
ctcp *:lag:*:{ if ($nick == $me) { haltdef | commands } }
_____________________________________________________________________________________________________________________________
2ş - Events
By this time, you must be wondering, "how can i measure my lag with all this, and what is 'commands'?"
Well, as i said, you must store some data , for that use what you like more, i'll use %vars.
I advise you to create some alias to send the notice/raw/ctcp.
Check up with notice:
alias lagn {
;create the alias
set %ctime $ctime
;set a %var with the $ctime value
.notice $me lag
;sends the notice to you
}
on *:notice:lag:*:{
;checks the notice text
if ($nick == $me) {
;check the nick who sent the notice
haltdef
;halt mIRC default text
echo -s Lag: $calc($ctime - %ctime)
;echo on status window, your lag time
} }
Check up with raw:
alais lagr {
set %ctime $ctime
;set a %var with the $ctime value
.raw -q ping lag
;send the ping using raw, and -q to silent it
}
on *:pong:{
if (lag iswm $2) {
;check the text
haltdef
;halt mIRC default text
echo -s Lag: $calc($ctime - %ctime)
;echo on status window, your lag time
}
}
Ctcp check up:
alias lagc {
.ctcp $me lag
;send the ctcp
haltdef
;halt mIRC default text
set %ctime $ctime
}
ctcp *:lag:*:{
if ($nick == $me) {
;check nick
haltdef
;halt mIRC default text
echo -s Lag: $calc($ctime - %ctime)
;echo on status window, your lag time
}
}
NOTE: For this example i used $ctime, but you also use $ticks value, but when you use $calc on it, you must use it like this:
$calc(($ticks - %var) /1000)
Code without comments:
Check up with notice:
alias lagn {
set %ctime $ctime
.notice $me lag
}
on *:notice:lag:*:{
;checks the notice text
if ($nick == $me) {
haltdef
echo -s Lag: $calc($ctime - %ctime)
}
}
Check up with raw:
alais lagr {
set %ctime $ctime
.raw -q ping lag
}
on *:pong:{
if (lag iswm $2) {
haltdef
echo -s Lag: $calc($ctime - %ctime)
}
}
Ctcp check up:
alias lagc {
.ctcp $me lag
haltdef
set %ctime $ctime
}
ctcp *:lag:*:{
if ($nick == $me) {
haltdef
echo -s Lag: $calc($ctime - %ctime)
}
}
_____________________________________________________________________________________________________________________________
3ş - code eg:
alias lag {
if (!%:lag.m) { set %:lag.m raw }
if (!%lag.max) { set %lag.max 0 }
if (!%lag.min) { set %lag.min 0 }
set %ctime $ctime
if (%:lag.m == notice) { .notice $me lag }
if (%:lag.m == raw) { raw -q ping lag }
if (%:lag.m == ctcp) { ctcp $me lag | haltdef }
}
on *:notice:lag:*:{
if ($nick == $me) {
lag.e
}
}
on *:pong:{
if (lag iswm $2) {
haltdef
lag.e
}
}
ctcp *:lag:*:{ if ($nick == $me) {
haltdef
lag.e
}
}
alias lag.e {
set %lagsec $calc($ctime - %ctime)
if ($calc($ctime - %ctime) > %lag.max) { set %lag.max $calc($ctime - %ctime) | echo -s New Lag Maximum Reached: %lag.max $+ secs }
if ($calc($ctime - %ctime) < %lag.min) { set %lag.min $calc($ctime - %ctime) | echo -s New Lag Minimum Reached: %lag.min $+ secs }
echo -s Lag: $calc($ctime - %ctime) $+ secs
titlebar [LAG: %lagsec $+ secs $+ $chr(93)
}
menu channel {
Lag
.Settings
..Set Method:
...Notice:set %:lag.m notice
...CTCP:set %:lag.m ctcp
...-
...Raw%:set lag.m raw
.Messages
..say Lag:$iif(%ctime,msg $active Current Lag: %lagsec $+ secs,msg $active Current Lag: N/A)
..say Max Lag:$iif(%lag.max,msg $active Maximum Lag: %lag.max $+ secs,msg $active Maximum Lag: N/A)
..say Min Lag:$iif(%lag.min,msg $active Minimum Lag: %lag.min $+ secs,msg $active Minimum Lag: N/A)
..-
..say Stats:msg $active Current Lag: $iif(%ctime,$calc($ctime - %ctime),N/A) ::::: Maximum Lag: $iif(%lag.max,%lag.max $+ secs,N/A) ::::: Minimum Lag: $iif(%lag.min,%lag.min $+ secs,N/A)
}
Note: To run this script, just paste it onto your remote scripts (alt+r) , and type /lag (exectute the lag check up one time), or /timer 0 'check_UP_delay' /lag , will check you lag every "check_UP_delay you" set (in seconds, and without '')
               (
geocities.com/br)