/lag

By SplitFire on Jan 15, 2011

nothing much to tell, just a very basic yet accurate lag checker.
(yes i meant to use $nick, it's 2 bytes shorter than $server :p)

alias lag { set %lag $ticks | .quote PING $ticks }
on ^*:PONG:{
  if (%lag) {
    echo -a * Lag: $calc($ticks - $iif($2 isnum,$2,%lag)) ms ( $+ $nick $+ )
    unset %lag
    haltdef
  }
}

Comments

Sign in to comment.
Jethro   -  Jan 16, 2011

Why is it evil? Just because Scakk's avatar is one doesn't mean the use of groups is. ;/ Edit: it's the devil, to be exact.

 Respond  
SplitFire   -  Jan 16, 2011

UGH! grpups are teh evil.

 Respond  
Scakk   -  Jan 16, 2011

If y ou only want it to work when you do /lag you could use a group as below.

alias lag { .enable #lag | .quote PING $ticks }
#lag off
on ^*:PONG:{
  var %lag $ticks
  echo -a * Lag: $calc($ticks - $iif($2 isnum,$2,%lag)) ms ( $+ $nick $+ )
  haltdef
  .disable #lag
}
#lag end
 Respond  
SplitFire   -  Jan 16, 2011

I've set the var before the PONG event so that it only displays lag if it was requested using the alias (hence the if (%lag) part), not just show lag everytime a PONG event triggers randomly. But yeah, both ways work :)

 Respond  
Scakk   -  Jan 15, 2011

No need to set a variable. The below does the same.

alias lag { .quote PING $ticks }
on ^*:PONG:{
  var %lag $ticks
  echo -a * Lag: $calc($ticks - $iif($2 isnum,$2,%lag)) ms ( $+ $nick $+ )
  haltdef
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.