mIRC Homepage
Posted By: LethPhaos lag meter - 29/08/04 11:15 AM
I think it could be nice to have a lag meter somewhere where it is always visible in mIRC. I know you can ping someone and what you get is the lag in seconds. But a bar that shows the lag to the server could be nice.
Posted By: Mentality Re: lag meter - 29/08/04 11:23 AM
Personally, I think they are so easily available at scripting websites that it's unnecessary for mIRC to have this incorporated. There are four listed here. You might also want to search Google.

Regards,
Posted By: LethPhaos Re: lag meter - 29/08/04 11:41 AM
thanx
Posted By: electrik Re: lag meter - 30/08/04 05:55 AM
I think this is a wonderful idea. Not everyone wants to figure out how to load a script with backdoors.

Hello zack.
Posted By: KingTomato Re: lag meter - 30/08/04 07:06 AM
A "lag detector" is not the most ideal script in the world. Not only is is fairly pointless (from the stand point of you should be chatting when you have your client on, and can tell what your lag is by doing so), but is also an extreme strain on the server. Think of the 100's of thousands of people on a server, all with a ping script. Individualaly, it's only, what, something like 100bytes. Now multiply that by each user. Now again, by every 30 seconds, 45 seconds, minute, or even every 5 minutes.

Look at a simple 500 person server:

100bytes -> 1 ping
* 500 users -> 50,000bytes (= 48.82Kb)
* once per minute (for an hour) -> 2929.68Kb (= 2.86Mb)
* 24 for one day -> 68.66Mb
* 30 days (avg month) -> 2059.93Mb (= 2.01Gb)

That's 2 gigs of bandwidth a month just because someone wants to have a neat little statistic built into their client. Personally, if you want your ping time, get it as needed. Could be a popup, an alias, or whatever. You don't need to make a nice gui bar graph or line graph or even progress bar just because you want to leave your mIRC running while you play a game or go out for dinner.
Posted By: nalAAlan Re: lag meter - 30/08/04 11:28 PM
Why would you want to send 100 bytes?
Code:
notice $me $ticks

That's like 20 bytes.
Posted By: DekuHaze Re: lag meter - 31/08/04 12:13 AM
Hmm. I wonder... could the "ping? pong!" event be somehow utilised for the lag bar? Does the server always ping at a set amount of time?

If mIRC kept track of the server pings and timed how long there was between each one, couldn't some kind of lag time be deduced form that?

Sure it's crude, but it doesn't eat up the server's bandwidth any more than normal mIRC usage.

Edited: for grammar reasons
Posted By: Collective Re: lag meter - 31/08/04 01:22 AM
You're only counting one direction.. I suspect KingTomato is thinking of there and back again, which for me produced a total length of 123 bytes (excluding cr/lfs).

//raw ping $ticks tends to use less bandwidth, for what it's worth.
Posted By: KingTomato Re: lag meter - 31/08/04 02:55 AM
I was actually calculating the following:

ping <server> (Estimating server to be 15 characters)
pong <server> <nick> (nick about 9 characters)

Now we're at 30 characters * 2 = 60, plus packet header info. (20 bytes each packet)

then 20 just for s&g's

We're at 100.
Posted By: nalAAlan Re: lag meter - 31/08/04 02:57 AM
in reply to Collective

That wouldn't work if you were using a bouncer.
Posted By: LethPhaos Re: lag meter - 31/08/04 06:10 AM
In case of the //notice $me $ticks, what do you get?

From mIRC help:
$ticks
Returns the number of ticks since your operating system was first started.

What does this have to do with LAG?
Posted By: KingTomato Re: lag meter - 31/08/04 07:47 AM
When you get the reply, you subtract current ticks from the number you sent previously, and get the "lag". Ex:

//notice $me $ticks
on $*:NOTICE:/([0-9]+)/:*: {
if ($nick == $me) /echo Lag: $calc($ticks - $1)
}
Posted By: LethPhaos Re: lag meter - 01/09/04 02:49 PM
when i do
Code:
 //notice $me $ticks 


and have
Code:
 on $*:NOTICE:*:*: {
  if ($nick == $me) /echo Lag: $calc($ticks - $1)
}  


in a clean mIRC 6.16 it doesn't work.
Posted By: dr_Eamer Re: lag meter - 01/09/04 06:00 PM
You're doing something wrong...
Are remotes on?
Are you connected to a server?
No error messages of any kind?
Is it a completely clean mIRC for sure or is there another on notice above this one in the remotes file?

Just speculations...
Apart from the code being simple and straightforward, I c/p'ed the code and it works like a charm (mIRC 6.16)!
Posted By: LethPhaos Re: lag meter - 01/09/04 06:28 PM
remotes are on, I'm connected to Quakenet, I don't see any error message by doing this, it's in a clean mIRC 6.16

But the result is shown in the server window and not in the channel window where I typed it, so it works...

blush blush blush blush shame on me, thanx for finding solutions for a problem that was in reality not there.
Posted By: dr_Eamer Re: lag meter - 01/09/04 09:20 PM
No worries!
Be cool! cool
Posted By: nalAAlan Re: lag meter - 02/09/04 01:28 AM
Code:
on me:*:NOTICE:*:*: {
  echo Lag: $calc($ticks - $1)
}


much better
Posted By: LethPhaos Re: lag meter - 02/09/04 05:54 AM
I suppose this result is in milliseconds?
Posted By: Iori Re: lag meter - 02/09/04 09:10 AM
You suppose correctly. :[/b])
Posted By: FiberOPtics Re: lag meter - 02/09/04 10:29 AM
That's not better at all. Now the code doesn't make any distinction between a notice with ticks and whatever other notice you send yourself.

Greets
Posted By: dr_Eamer Re: lag meter - 02/09/04 12:40 PM
Here's the one I use:
(it's quite old and I haven't checked back at it for a looooong time. The output is really simple...)

Code:
ctcp ^*:LAG:?:{ 
  if $nick == $me {
    set %delay [ $+ [ $cid ] ] $round( $calc( ( $ticks - $2 ) / 1000 ) , 2 ) 
    ;[color:grey]The following line simply calculates the time till the next count depending on your awaystatus and you current lag: 
    ;You might as well ignore it and set %newlag to a fixed amount of seconds
    var %newlag = $calc( $iif(%awaynick [ $+ [ $cid ] ],1,0) * 20 * 60 + ( 10 - $urange(0,%delay [ $+ [ $cid ] ],8) ) * 30 )[/color]
    .timernextlagcount $+ $cid 1 %newlag lagcount $cid
    echo $color(info2) -st Lag:  $+ $iif(%delay [ $+ [ $cid ] ] == 1,1sec,%delay [ $+ [ $cid ] ] $+ secs) $+  (Next at:  $+ $asctime($calc($ctime + %newlag), HH:nn:ss) $+ )
    halt 
  }
}
on *:CONNECT:{ .timerconnectlag $+ $cid 1 2 lagcount $cid }
on *:DISCONNECT:{ unset %delay [ $+ [ $cid ] ] }

alias lagcount { scid $iif($1 isnum,$1,$cid) | .ctcp $me LAG $ticks }  
Posted By: FiberOPtics Re: lag meter - 02/09/04 01:05 PM
I assume you wanted to reply to the original requester?

Note that when you click on reply, it will actually reply to that specific person.

Greets
Posted By: dr_Eamer Re: lag meter - 02/09/04 02:22 PM
Ok you're right I'm sorry, it's more of a general post in the thread. Is it that bad it was posted as a reply to you?

In any case it contains a reply to what you said as the ctcp remote checks for self ctcps starting with the word LAG, thus minimizing the chances of catching a wrong self-ctcp message. This control can be made even stricter but then again why should anyone send a ctcp like this to himself?

Sorry once again if it bothered you.
Be well
Posted By: FiberOPtics Re: lag meter - 02/09/04 02:54 PM
Hi,

my original reply was to nalAAlan, who only used an on NOTICE event, not a ctcp.

Anyway, don't worry, I didn't mean to be offending, but I've seen quite a few people recently, who seem to keep replying to the wrong people, which I find rather confusing and awkward.

All is good,

Cya
Posted By: nalAAlan Re: lag meter - 03/09/04 03:04 AM
Quote:
That's not better at all. Now the code doesn't make any distinction between a notice with ticks and whatever other notice you send yourself.

So I suppose you send lots of notices to yourself, and pmsgs also. There is nothing like talking to yourself, I do it all the time.
Posted By: Iori Re: lag meter - 03/09/04 09:21 AM
You forgot the urange alias :[/b])

Play pingpong laugh

on ^*:pong:echo -stc info2 Lag: $calc(($ticks - $2)*.001) $+ s | halt
on *:CONNECT:.timerlag $+ $cid 0 60 .raw ping $!ticks

Posted By: dr_Eamer Re: lag meter - 03/09/04 10:11 AM
Darn... Sorry!
urange is an alias that constraints a variable in a range of values.
Code:
alias urange { if $$1 &gt; $$2 { return $$1 } | if $$2 &gt; $$3 { return $$3 } | return $$2 } 

It was in another script file cause I use it here and there.

Edit: echo -c is cool! I hadn't noticed it I admit...
Posted By: FiberOPtics Re: lag meter - 03/09/04 06:47 PM
You are missing the point.

Whether you send notices to yourself or not, you should always make sure your code doesn't contain holes in it, and yours does, because it assumes that ANY notice you send yourself, will be one that sends a $ticks.

Your argument is based on what a regular user will never do (/notice anything else but a $ticks to himself), but that assumption is weak. People do the weirdest things that one would never expect, and that can involve sending yourself notices. Which is exactly why I said what I said, that it would be wiser to make a distinction.

I've coded a role playing game, and it is amazing how many unexpected and unforeseen things people perform when playing the bot. The most bugs that my bot suffered from, were those that arose in unusual situations, and it is those situations that you should foresee.

Good day.
Posted By: Watchdog Re: lag meter - 04/09/04 12:04 AM
You are connected to Quakenet? Do you think the owners of that network would be impressed with all 150,000 users sending un-necessary bytes to the server often enough to get a satisfactory resolution from a lagmeter?

I have a scripted one and I set the request/reply frequency to a fairly 'friendly' level but because this can be abused to the point where a server can be laboured by thousands of people with inappropriate settings I feel this function should not become part of mIRC itself.
© mIRC Discussion Forums