mIRC Homepage
Posted By: JuanAm lagmeter for all - 12/11/14 11:19 PM
This code is used to measure my lag, I would have to be modified to work for everyone?
Try changing $me for $2 or the nick and not work.
.lag fulanito

Code:
ON 1:INPUT:*:{ 
  if ($1 == .lag) { .ctcp $me sping $ticks $chan } 
}
#lagmeter on
ctcp *:sping:*:{ 
msg $3  2[4Lag2] 2[ $+ $calc($calc($ticks - $2) / 1000) $+ 2] }
#lagmeter end
Posted By: JuanAm Re: lagmeter for all - 13/11/14 10:53 PM
191 views and no answers frown
It is so difficult to modify this code?
Posted By: westor Re: lagmeter for all - 13/11/14 11:12 PM
Try use this code:

Code:
ON *:INPUT:*:{ 
  if ($1 == .lag) { .enable #lagmeter | .ctcp $me sping $ticks $chan } 
}

ON *:TEXT:.*:#: {
  tokenize 32 $strip($1-,burci)
  if ($1 == .lag) {
    if (!$2) { .msg $chan [ $+ $nick $+ ]: Error, Not enough parameters, try again and enter an nickname! | return }
    if ($2 !ison $chan) { .msg $chan [ $+ $nick $+ ]: Error, Cannot find, the $qt($2) nickname is NOT on the channel! | return }
    if (%ctcp_nick) { .msg $chan [ $+ $nick $+ ]: Error, Already in use, try again later! | return }
    set -eu10 %ctcp_nick $2
    set -eu10 %ctcp_user $nick
    set -eu10 %ctcp_chan $chan
    .enable #lagmeter
    .ctcp $2 PING
  }
}
#lagmeter off
ctcp *:sping:*: { 
  msg $3  2[4Lag2] 2[ $+ $calc($calc($ticks - $2) / 1000) $+ 2]
  .disable #lagmeter
}
ON *:CTCPREPLY:PING*: {
  if (%ctcp_nick) && (%ctcp_nick == %ctcp_user) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: Your Ping is  $+ $calc($ctime - $2) $+  second(s). | goto end | return }
  if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $calc($ctime - $2) $+  second(s). }
  :end
  unset %ctcp_*
  .disable #lagmeter
}
#lagmeter end
Posted By: JuanAm Re: lagmeter for all - 14/11/14 01:04 PM
Originally Posted By: westor
Try use this code:

Code:
ON *:INPUT:*:{ 
  if ($1 == .lag) { .enable #lagmeter | .ctcp $me sping $ticks $chan } 
}

ON *:TEXT:.*:#: {
  tokenize 32 $strip($1-,burci)
  if ($1 == .lag) {
    if (!$2) { .msg $chan [ $+ $nick $+ ]: Error, Not enough parameters, try again and enter an nickname! | return }
    if ($2 !ison $chan) { .msg $chan [ $+ $nick $+ ]: Error, Cannot find, the $qt($2) nickname is NOT on the channel! | return }
    if (%ctcp_nick) { .msg $chan [ $+ $nick $+ ]: Error, Already in use, try again later! | return }
    set -eu10 %ctcp_nick $2
    set -eu10 %ctcp_user $nick
    set -eu10 %ctcp_chan $chan
    .enable #lagmeter
    .ctcp $2 PING
  }
}
#lagmeter off
ctcp *:sping:*: { 
  msg $3  2[4Lag2] 2[ $+ $calc($calc($ticks - $2) / 1000) $+ 2]
  .disable #lagmeter
}
ON *:CTCPREPLY:PING*: {
  if (%ctcp_nick) && (%ctcp_nick == %ctcp_user) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: Your Ping is  $+ $calc($ctime - $2) $+  second(s). | goto end | return }
  if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $calc($ctime - $2) $+  second(s). }
  :end
  unset %ctcp_*
  .disable #lagmeter
}
#lagmeter end


the line "if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $calc($ctime - $2) $+  second(s). }

returns:
[peter] The james Ping is 1408357463 second(s).
Posted By: westor Re: lagmeter for all - 14/11/14 02:33 PM
Try replace that line with this:

Code:
  if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $2 $+  second(s). }
Posted By: JuanAm Re: lagmeter for all - 14/11/14 04:35 PM
Originally Posted By: westor
Try replace that line with this:

Code:
  if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $calc($ctime - $2) $+  second(s). | halt }


It did not work.
I solved it by adding the halt command at the end of the line.

Code:
 The correct line is:

[code]if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $calc($ctime - $2) $+  second(s). | halt }
[/code]

Thank westor for your contribution.

Posted By: westor Re: lagmeter for all - 14/11/14 04:54 PM
Yes, i fix the bug try use this code:

Code:
ON *:INPUT:*:{ 
  if ($1 == .lag) { .enable #lagmeter | .ctcp $me sping $ticks $chan } 
}

ON *:TEXT:.*:#: {
  tokenize 32 $strip($1-,burci)
  if ($1 == .lag) {
    if (!$2) { set -eu10 %ctcp_nick $nick | goto start | return }
    if ($2 !ison $chan) { .msg $chan [ $+ $nick $+ ]: Error, Cannot find, the $qt($2) nickname is NOT on the channel! | return }
    if (%ctcp_nick) { .msg $chan [ $+ $nick $+ ]: Error, Already in use, try again later! | return }
    set -eu10 %ctcp_nick $2
    :start
    set -eu10 %ctcp_user $nick
    set -eu10 %ctcp_chan $chan
    .enable #lagmeter
    .ctcp %ctcp_nick PING
  }
}
#lagmeter off
CTCP *:sping:*: { 
  haltdef
  msg $3  2[4Lag2] 2[ $+ $calc($calc($ticks - $2) / 1000) $+ 2]
  .disable #lagmeter
}
ON *:CTCPREPLY:PING*: {
  haltdef
  if (%ctcp_nick) && (%ctcp_nick == %ctcp_user) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: Your Ping is  $+ $calc($calc($ctime - $2) / 1000) $+  second(s). | goto end | return }
  if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $calc($calc($ctime - $2) / 1000) $+  second(s). }
  :end
  unset %ctcp_*
  .disable #lagmeter
}
#lagmeter end
Posted By: JuanAm Re: lagmeter for all - 14/11/14 04:56 PM
I edited previous post and solved.
The correct line is:

Code:
if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $calc($ctime - $2) $+  second(s). | halt }
Posted By: westor Re: lagmeter for all - 14/11/14 04:58 PM
Oh i didn't refresh it :P anyway try the new one.
Posted By: JuanAm Re: lagmeter for all - 14/11/14 05:00 PM
The correct line is:

Code:
if (%ctcp_nick) { .msg %ctcp_chan [ $+ %ctcp_user $+ ]: The  $+ %ctcp_nick $+  Ping is  $+ $calc($ctime - $2) $+  second(s). | halt }
Posted By: JuanAm Re: lagmeter for all - 14/11/14 05:19 PM
Sorry for previous editing and double post.

Your first code was fine, just needed to add the halt command at the end of that line.

Thank you !! smile
© mIRC Discussion Forums