1. Timers

Hi All,

How can I use more independent timer (6..8) simultaneuosly?
The setTimer(window,timer,ticks) is ok, but how can I make an event if  timer
ellapses? Please do an  example with 2..3 timers.

Thank you for help!

Attila Kondor

new topic     » topic index » view message » categorize

2. Re: Timers

----- Original Message -----
From: "Kondor Attila"
Sent: Thursday, April 06, 2000 2:37 AM
Subject: Timers

> How can I use more independent timer (6..8) simultaneuosly?
> The setTimer(window,timer,ticks) is ok, but how can I make an event if
timer
> ellapses? Please do an  example with 2..3 timers.

-----------------------------------------------------------
-- this is what your timer routine might look like
procedure onTimer_Win( integer timerID )

  if timerID = 1 then
    -- do something every half second
  end if

  if timerID = 2 then
    -- do something every second
  end if

  if timerID = 3 then
    -- do something every 1.5 seconds
  end if

end procedure
onTimer[Win] = routine_id( "onTimer_Win" )
-----------------------------------------------------------
-- somewhere in your program
setTimer( Win, 1, 500 )
setTimer( Win, 2, 1000 )
setTimer( Win, 3, 1500 )

-- that's it...
-- Brian

new topic     » goto parent     » topic index » view message » categorize

3. Re: Timers

I have a crazy win32lib 'timer' program @
http://www.king.igs.net/~wolfritz/nagdemo.zip      (50 k. )

> How can I use more independent timer (6..8) simultaneuosly?
Kondor

new topic     » goto parent     » topic index » view message » categorize

4. Re: Timers

----- Original Message -----
From: "Brian K. Broker" <bkb at CNW.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, April 06, 2000 4:19 AM
Subject: Re: Timers


> ----- Original Message -----
> From: "Kondor Attila"
> Sent: Thursday, April 06, 2000 2:37 AM
> Subject: Timers
>
> > How can I use more independent timer (6..8) simultaneuosly?
> > The setTimer(window,timer,ticks) is ok, but how can I make an event if
> timer
> > ellapses? Please do an  example with 2..3 timers.
>
> -----------------------------------------------------------
> -- this is what your timer routine might look like
> procedure onTimer_Win( integer timerID )
>
>   if timerID = 1 then
>     -- do something every half second
>   end if
>
>   if timerID = 2 then
>     -- do something every second
>   end if
>
>   if timerID = 3 then
>     -- do something every 1.5 seconds
>   end if
>
> end procedure
> onTimer[Win] = routine_id( "onTimer_Win" )
> -----------------------------------------------------------
> -- somewhere in your program
> setTimer( Win, 1, 500 )
> setTimer( Win, 2, 1000 )
> setTimer( Win, 3, 1500 )

So there still isn't a way to call a timer by name, set the timer with a
variable timeout, a variable repitition rate, and assign that timer a task,,
like:

timerName RepetionCount Interval TaskCodeToDo

Working example:
.timer 1 0 /describe %chan waves back at $prunenick($nick) :^)
( i set the interval to zero because this is also a handy way to start a new
thread. )
.timer 1 1 /describe %chan gets all goosebumpy $smile(c)
( this waits one second, then sends the second msg )
( the "." tells the timer to not tell me it's activated or firing )

? The name is useful later, if you wish to do this:

timerName off
or change the interval:
timerName timerName.reps NewInterval timerName.task

What if, since Eu can't execute a variable, that the timer procedure passed
the task variable to the Eu interpreter someone wrote in Eu a while back? It
would be slower, yes, but it would still do the job,, i think. What i can't
figure out is how to script the timers with variables and names. Comments?

Kat

new topic     » goto parent     » topic index » view message » categorize

5. Re: Timers

Kat wrote:

> So there still isn't a way to call a timer by name,
> set the timer with a variable timeout, a variable
> repetition rate, and assign that timer a task, ...

Keep in mind that Euphoria/Win32 doesn't support threads.

It's not difficult to build the sort of mechanism you are talking about. You
could easily set up a lookup table based on the timer's ID, and place a
routine id into it. If you want to be really risky, you could probably use
the routine id as the timer identifer. Keep in mind you couldn't then set up
several timers on the same task.

And once a timer is running, you can kill it and restart it with a
difference repetition rate.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu