HyperCard: Varying Script Speed to Match Processor Speed (4/93)

Because the various Macintosh models operate at different clock speeds,
some HyperTalk scripts may not execute correctly.

This is especially true regarding visual effects, animated icons,
animations in general, searches, going to various cards, etc. And with each
new Macintosh varying in speed and performance, the art of writing a
"universal" HyperCard script that execute at various speeds depending on
the CPU is getting trickier.

This article provides a handler that varies the execution of HyperTalk
scripts depending on the CPU.

on determineTiming
global fastCPU
put the ticks into startTicks
repeat with i = 1 to 50
put i into tempCounter
end repeat
put the ticks into endTicks
if endTicks - startTicks < 40 then
put true into fastCPU
else
put false into fastCPU
end if
end determineTiming

You can also add a line such as:
if CPUSpeed then wait 10 ticks

This will delay the execution of the script for 1/6 second. Remember to
declare the fastCPU global in any handlers that use it.


This article is adapted from the Claris Tech Info database.
Published Date: Feb 19, 2012