[comp.sys.mac.hypercard] Timing loops in Hypercard

WHIOE1@NUSDISCS.Bitnet (10/02/88)

>from the introduction card to an additional info card. A wait command
>shuts things down for a given amount of time. The script dosn't see
>the mousedown while waiting. To get around this I wrote an event loop that
>looks for a mousedown for about 8 seconds then if the event does not happen,
>goes to the central card of the application. The only problem I have
>for the event loop is the time it takes a Mac+ and a IIx to go through
>the loop x times. I want to make x a var whose value depends upon the
>type of CPU {& thus approx speed}.

Regarding your query... I think the better solution would be to use
the Tickcount() function instead of an event loop. You could try the
following :

        put the tickcount into startTime
        repeat forever
                put the tickcount - startTime into interval
                if the mouse is down or (interval / 60) > 8 then exit repeat
        end repeat

I haven't debugged this code... cos I'm far away from my mac, but inside
my head.. that's how I think it should be done. The use of Tickcount would
make your code independent of the clockspeed of the processor that you are
using.

Hope this helps.

/jesse
sngkhoon@nusdiscs
(Jesse Sng,
 National University of Singapore
 Dept of Computer Science & Information Systems )

ps. I'm one of those who got a beta-release of the Hypertalk Reference
by Apple. It was probably the most helpful document on Hypercard that I've
managed to obtain to date. For serious programmers, this is a MUST.