>From what I've been able to gather, there's been a fair amount of confusion
generated over the seeming amibiguities of the timer, the timeOut, and
timeOut objects. They are all horses of a different color, but the
nomenclature arrived at by the Director team for these bits of Lingo leaves
a bit to be desired.

TimeOut objects are, indeed, not really time-outs. You can't realistically
call an object that generates repeating events at a prescribed interval a
time-out. It effectively becomes a time-out only when you "forget" the
timeOut object at the end of its first interval. Anyone in the framework
development arena would calls this type of class a "timer." But, I suppose,
since there was already a "timer" in Lingo prior to D8, "timeOut" was
chosen.

TimeOut objects are great for those repeating actions that you don't
necessarily want to drive from an iteration counter in a frame script or a
stepFrame handler in a child object added to the actorList. So look to
timeOut objects for that repeating 30-second interval you need. Creating one
to do that would look like this:

goTimer30 = timeOut("Timer30").new(30 * 1000, #halfMinuteHandler, me)

It's not absolutely necessary to place the timeOut object into a variable
(unless you have a specific reason to) because every timeOut object created
is added to the timeOutList. You can access them by index from there:

the timeOutList[1].forget()

But with the timeOut object also stored in a variable, you can access it's
properties and methods directly off the object in the variable:

goTimer30.forget()

If you have multiple active timeOut objects, a global handler would always
know which timeOut object sent the message because a reference to the
timeOut object is sent to the handler as an argument, and you can query its
name property:

on timeOutHandler me, poTimeOut
  case poTimeOut.name of
    "Timer30":
      -- blah, blah, blah
    "Timer60"
      -- blah, blah, blah
  end case
end

So, you create timeOut objects and add them to the timeOutList with new(),
and delete them from the timeOutList (so that they no longer send out
messages) with forget(). You can query several properties of timeOut objects
to get information from them: the "period" is the number of milliseconds for
the timeOut object's interval; the "timeOutHandler" is the symbol which
represents the handler to be called at each interval; the "target" is the
child object that contains the handler to be called (VOID if no child object
was specified, in which case a handler in a movie script is called); the
"time" is the system time, in milliseconds, when the next timeOut message
will be sent (not the number of millisecond remaining before the current
interval ends); and the "persistent" indicates whether or not the timeOut
object will remain active and in the timeOutList when the current movie
stops playing or is exited (like when one movie braches to another).

For your 10-minute inactivity time-out, that really would be best served by
the global timeoutScript. This is a feature that became available prior to
D8. Set the "timeoutScript" to a line of Lingo that should execute at the
end of the prescribed time. That can be a handler name for a handler in a
movie script, if you want, or it can be a self-contained Lingo statement.
Then, when you want to start the time-out running, set the timeoutLength
property.

the timeoutScript = "HandleInactivity"
the timeoutLength = 10 * 60 * 60

The timeoutLength property is expressed in ticks this time around, not in
milliseconds. Every time a movie starts, the timeoutLength is initialized to
10800, or 3 minutes. Setting the property starts a new time-out with your
new interval. The specified Lingo is executed (or the named handler is
called) when the time runs out.

Hope this helps.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Christopher Watson
Sr. Software Engineer
Lightspan, Inc.
http://www.lightspan.com/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to