mIRC Homepage
Posted By: ThE_mASk wait operator & timer question - 21/07/03 09:39 PM
1. How can I make current script to halt for specific time and then starts again. Some king of "wait" operator.
2. Why the next timer doesn't work ?
Code:
 
set %i 0
timer 10 10 {
 echo -a %i
 inc %i
}  

and all that this echoes is:
0
0
0
etc, etc...

10x
Posted By: KingTomato Re: wait operator & timer question - 21/07/03 09:46 PM
Code:
alias myAlias {
  /echo -a Hello
  /wait 5 myalias
}

alias wait {
  .timer 1 $$1 $+(/,$2-)
}


Should work >:D

EDIT: There is a COM object someone made that i believe uses java and takes advantage of the sleep function. Im not sure if its in the forums, but you can check. The only problem with the above statement, is you have to do things in blocks. smirk
Posted By: Knappen Re: wait operator & timer question - 21/07/03 09:48 PM
syntax: timer <how many times an event is gonna happen> <Wait for this amont of seconds> commands

Code:
  
var %i = 0
var %times 10
while (%i &lt; %times) {
.timer 10 10 echo -a %i
 inc %i 
}
Posted By: KingTomato Re: wait operator & timer question - 21/07/03 09:51 PM
Just as a heads up, the above block of code will happen 100 times. >:\ a loop of ten, with each timer executing 10 times..
Posted By: ThE_mASk Re: wait operator & timer question - 21/07/03 09:56 PM
I think you didn't understood my question...
For example:
I have an dialog with 10 radio buttons, which are unchecked. I want to make a loop which will check them one by one with for example 2 sec. dely between every one until all are checked. And this is why I need this kind of wait operator.
Ex.:
Check Radio no.1
wait 2 sec.
Check Radio no.2
wait 2 sec.
etc. etc.
Posted By: codemastr Re: wait operator & timer question - 21/07/03 10:01 PM
Well what they are telling you is mIRC doesn't have a way to do that so they gave you some work arounds to do it.
Posted By: KingTomato Re: wait operator & timer question - 21/07/03 10:13 PM
Code:
[color:green]; do not touch[/color]
var %t = 1, %d = 0
[color:green]; modify these[/color]
%delay = [color:blue]2[/color], %radios = [color:Red]id1,id2,id3,id4,etc[/color]
while ($gettok(%radios, %t, 44) != $null) {
  .timer 1 %d /did -c $dname $ifmatch
  /inc %t
  /inc %d %delay
}


EDIT: made the while "!= $null" so for whatever reason if they use id 0 as an id, it will work.
Posted By: qwerty Re: wait operator & timer question - 22/07/03 08:20 AM
0 is reserved (remember on *:dialog:blah:init:0: ?), you can't use it for a control's ID.
Posted By: Knappen Re: wait operator & timer question - 22/07/03 10:20 PM
Quote:

Just as a heads up, the above block of code will happen 100 times. >:\ a loop of ten, with each timer executing 10 times..


Yes! Of course... :tongue: My bad! Just wasn`t thinking clearly... hehe... Thanks for the correction! smile
Posted By: KingTomato Re: wait operator & timer question - 24/07/03 08:54 PM
Thanks for the correction qwerty, I usually use init:*:, so 0 is not touched in most cases. >:D
© mIRC Discussion Forums