mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 9
V
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
V
Joined: Dec 2002
Posts: 9
Is it possible to add a new propery (.msecs) to the $timer identifier for use with timers that have millisecond lengths (the -m or -h flag) so that it is possible to view the remaining time in milliseconds?

Joined: Jan 2006
Posts: 61
C
Babel fish
Offline
Babel fish
C
Joined: Jan 2006
Posts: 61
yeah it is possible combined with your own alias who return $time() and you property.

that all

*


The practice do the Master...
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
i suggest you show him then eh?

Joined: Jan 2006
Posts: 61
C
Babel fish
Offline
Babel fish
C
Joined: Jan 2006
Posts: 61
I use this feature once, and if im not forget it, you can use the identifier $prop who in fact is your condition, like the below example:

Code:
alias props {
  if ($1 == Color && $prop == Blue) { .return Blue }
  elseif ($1 == Color && $prop == Green) { .return Green }
}
 


You can test this rotine put it on remotes and writeing
//echo -a $props(Color).blue on the editbox.

Explanation: we create an alias called props (in your case could be Timee, to be diferent from the real $time identifier), and we tell the rotine if the first word inside of our custum identifier ($props()) is "color" go ahead with the rotine.
The next part is more important, if you put the condition .Green on our custom identifier ( $props(color).Green) then willl return the message "Green"; if you choose other color like blue just try $props(color).blue and will return "blue". that is because we tell the rotine if the unbilt indetifier $prop ($prop == blue) (our condition), the rotine will do the commds you expecify for our condition, in our case they are Green or blue.

if you take this example, and use to the $time identifier I think that he is possible...

P.s- sorry ma bad english or confused explanation, if was in portuguese language its more easy, but i try =P lo0l0ol

Thats all

*


The practice do the Master...
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
what but what does this have to do with getting a milliseconds remaining on highresolution timers ?!?!??!

Joined: Jan 2006
Posts: 61
C
Babel fish
Offline
Babel fish
C
Joined: Jan 2006
Posts: 61
Quote:

if you take this example, and use to the $time identifier I think that he is possible...


I was showing how to do a similar thing...

Thats all

*


The practice do the Master...
Joined: Dec 2002
Posts: 9
V
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
V
Joined: Dec 2002
Posts: 9
I apologise, but i do not see how using custom properties will allow me to return the remaining time in milliseconds.

I do have considerable knowledge of mircscript, but i do not know how that will work because even if i made my own custom property, i have nowhere inside the script languange to derive the value to return. The best i could do would be to call $timers(1).secs and multiply by 1000.

What i am asking for is an extension of the built-in mirc identifier $timers so that i can retrieve the remaining time in milliseconds instead of seconds.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
That was the essence of what i asked him, I doubted you ever needed instructiuon on how to return a value, rather that you cant find a method of getting the value

I came up with this, its no good for other peoples multimedia timers, but i assume there your ones, becuase its actually hard to tell if a timer is multimedia, since the .mmt property relates to -h and not -m frown

Ok so anyway, assume you make a multimedia timer such as ... /timerBLAH -m 1 2345 echo BLAH
You replace that with (note the space before BLAH) ... /timer.msecs BLAH -m 1 2345 echo BLAH
Before it goes off you can do //echo -a $timer.msecs(BLAH) which should return a close to accurate remaining delay in ms

Code:
alias timer.msecs {
  if (!$isid) {
    $iif(!$show,.timer,timer) $+ $1 $2-
    hadd -m timer.msecs $1 $ticks
  }
  elseif (($0) && ($timer($1)) && ($hget(timer.msecs,$1))) {
    return $calc($timer($1).delay - (($ticks - $v1) % $timer($1).delay))
  }
}


* The code is a bit garbagey in that it leaves data in the hashtable after the timer has completed, I couldnt think of a nice way to clear this out, and as long as your not trying overly hard to confuse it, i doubt it well ever return an invalid result.

The princable i have used is to record the $ticks at the time the timer is created, then apon someone using $timer.msecs it retrieves this value subtracts it from the current $ticks (giving ticks since the timer was created) then MODS (remaineders) it giving ticks already passed in this occurance, and lastly subtract that from the ticks per occurance. Giving remaining ticks.

--edit--

of course an actual real property to $timer would be much nicer aka .msecs

Last edited by DaveC; 14/03/06 09:45 AM.
Joined: Jan 2006
Posts: 61
C
Babel fish
Offline
Babel fish
C
Joined: Jan 2006
Posts: 61
What to say...? Who knows knows! Thanks DaveC*

Thats all

*


The practice do the Master...

Link Copied to Clipboard