mIRC Homepage
Posted By: schism $pause - 11/06/06 10:24 PM
Anyone know an effective way of creating a variable like this? Something you could just put in the script like $pause(3) would would pause the script for 3 seconds?
Posted By: FiberOPtics Re: $pause - 11/06/06 11:15 PM
/pause

Don't forget about timers though (/help /timer).
Posted By: schism Re: $pause - 12/06/06 05:23 AM
Quote:
/pause

Don't forget about timers though (/help /timer).


Thanks, it doesn't seem to work everytime with s, but it does with miliseconds....
Posted By: FiberOPtics Re: $pause - 12/06/06 10:42 AM
Quote:
Thanks, it doesn't seem to work everytime with s, but it does with miliseconds....


That would be the first time that happens for anyone. Could you give me the code you have used to reproduce this?
Posted By: schism Re: $pause - 12/06/06 05:21 PM
Quote:
Quote:
Thanks, it doesn't seem to work everytime with s, but it does with miliseconds....


That would be the first time that happens for anyone. Could you give me the code you have used to reproduce this?


Sure, did a test when first started using it,

Code:
 alias blah { echo -t w00t | pause s 5 | echo -t w0000t } 


returns this:

12:15:15PM w00t
12:15:15PM w0000t

again when I try it

12:15:38PM w00t
12:15:39PM w0000t

again...

12:17:49PM w00t
12:17:49PM w0000t

etc.

Code I use as copied:
Code:
alias pause {
  var %e = !echo $color(info) -a * /pause:
  if ($version < 5.91) {
    %e this snippet requires atleast mIRC version 5.91
  }
  elseif (!$regex(pause,$1-,/^m?s \d+$/Si)) {
    %e incorrect/insufficient parameters. Syntax: /pause <s|ms> <N>
  }
  elseif ($1 == ms) && ($istok(95 98 ME,$os,32)) {
    %e cannot use milliseconds parameter on OS'es beneath Win2k
  }
  elseif ($2 !isnum 1-) {
    %e must specify a number within range 1-
  }
  else {
    var %wsh = wsh $+ $ticks, %cmd
    if ($1 == s) %cmd = ping.exe -n $int($calc($2 + 1)) 127.0.0.1
    else %cmd = pathping.exe -n -w 1 -q 1 -h 1 -p $iif($2 > 40,$calc($2 - 40),$2) 127.0.0.1
    .comopen %wsh wscript.shell
    .comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c %cmd >nul,uint,0,bool,true)
  }
}


I doubt this will help much, not sure what to say, it just doesn't seem to work with s. I'd be happy to give you my system info if you need.
Posted By: FiberOPtics Re: $pause - 12/06/06 05:58 PM
The problem can be narrowed to ping.exe definitely.

Can you do: /run ping.exe -n 5 127.0.0.1

and tell me what you see happening on your screen when you do that. I would be surprised if you don't have ping.exe on your system, as that program comes installed by default in all windows versions from 98 all the way up to XP.
Posted By: schism Re: $pause - 14/06/06 01:25 AM
Quote:
The problem can be narrowed to ping.exe definitely.

Can you do: /run ping.exe -n 5 127.0.0.1

and tell me what you see happening on your screen when you do that. I would be surprised if you don't have ping.exe on your system, as that program comes installed by default in all windows versions from 98 all the way up to XP.


Now it's making sense, I'm using a wireless ISP and for some reason I get inconsistant pings returned regularly, for example:

C:\Documents and Settings\Admin.XP3800>ping -n 10 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time=-7664ms TTL=128
Reply from 127.0.0.1: bytes=32 time=-7664ms TTL=128
Reply from 127.0.0.1: bytes=32 time=-7664ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=-7664ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=-7664ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=-7664ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = -7664ms, Average = 429492131ms

I'm not sure what causes it, and it doesn't seem to cause any problems outside of inconsistent ping reports.
Posted By: FiberOPtics Re: $pause - 14/06/06 05:46 PM
Try:

ping -n 5 -w 1 127.0.0.1

Your results are really weird, it's saying the time taken for the reply was a negative value o.O confused lol

Anyway, since it already works with the milliseconds property just fine, it's irrelevant for you as you can just choose 5000 instead of 5, but since I had never heard of problems such as in your case, naturally I'm interested in finding out how to solve it best with ping.exe as well, for the Windows 98/ME users out there.
Posted By: hmtX Re: $pause - 15/06/06 12:41 PM
You can try this aswell
alias /wait

/edit: note i made a mistake and pasted old code, it's not .remove %a but .remove %tmp obviously
Posted By: schism Re: $pause - 15/06/06 04:00 PM
Quote:
Try:

ping -n 5 -w 1 127.0.0.1

Your results are really weird, it's saying the time taken for the reply was a negative value o.O confused lol


C:\Documents and Settings\Admin.XP3800>ping -n 10 -w 1 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=9531ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=-9531ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=-9531ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = -9531ms, Average = 429495776ms

same type of result.
Posted By: FiberOPtics Re: $pause - 15/06/06 04:45 PM
That uses a file (disk access) and let's you specify milliseconds which is something that already works fine for this guy using /pause. Read before posting please.

Like said, the only thing that for him isn't working is the seconds property (using ping.exe), but it is irrelevant because you can specify the amount of milliseconds if you want seconds (just multiply by 1000).

The only reason this thread is still going on, is because I'm interested in finding a solution for people on Windows 98/ME who cannot use pathping.exe.

In regards to the code you linked to, that's an old snippet by Online called /sleep, and you can improve it as follows:

Code:
alias wait {
  var %a = $ticks $+ .vbs
  write %a wscript.sleep $$1
  .comopen %a wscript.shell
  .comclose %a $com(%a,Run,3,bstr,%a,uint,0,bool,true) 
  .remove %a
}


In other words, no use to make it a .wsf file and specify that the scripting language is jscript inside the code. The correct scripting engine (jscript/vbscript) will be selected thanks to the extension (I'm using .vbs here).

The most important reason against using this approach is ofcourse, that many anti-virus programs will block the script from executing or pop up a warning box, as Windows scripting files are often seen as malicious code, something /pause doesn't suffer from. On the other hand, in case it doesn't get flagged by AVG and the likes, it should work even on Windows 98/ME.
Posted By: FiberOPtics Re: $pause - 15/06/06 04:55 PM
Well, I don't know, I can't motivate myself enough to look into it, so just use the "ms" property instead of the "s" property.
© mIRC Discussion Forums