At 20:04 +0100 07/11/2002, Lee Harper wrote:
>Basically I want to find out the elapsed time between the start of a movie
>and a mouseDown event.
>I am using the following script, but the variable 'difference' is being set
>to odd values -
>(I was expecting the format to be the same as that of 'the long time').
The long time is HH:MM:SS and not quite what you want here. You'd
probably be happier with the ticks, which are increments of time 1/60
second in length. You can then take the total ticks and with division
and modulus operations get the hours, mins and secs from movie start
to mosuedown:
GLOBAL gnStartTime, gnMouseTime
on startMovie
gnStartTime = the ticks
gnMouseTime = gnStartTime
-- set up a 'mouse trap'
the mouseDownScript = "GetMouseTime()"
END startMovie
on stopMovie
-- show the time
DisplayDelay()
END stopMovie
on GetMouseTime
gnMouseTime = the ticks
the mouseDownScript = ""
DisplayDelay()
END GetMouseTime
on DisplayDelay
if gnMouseTime <> 0 then
nDelayTicks = gnMouseTime - gnStartTime
nSecondsTotal = nDelayTicks / 60
nMinutesTotal = nSecondsTotal / 60
nHoursTotal = nMinutesTotal / 60
-- the modulus is the remainder after an operation; this
-- will give us the "real" values in h m and s for the
-- time we got just above
nActualSeconds = nSecondsTotal mod 60
nActualMinutes = nMinutesTotal mod 60
nActualHours = nHoursTotal mod 60
sTime = nActualHours && "hours," && nActualMinutes && "minutes," \
&& nActualSeconds && "seconds elapsed from startMovie to" \
&& "mouseDown."
put sTime
gnMouseTime = 0
end if
END DisplayDelay
--
Warren Ockrassa | http://www.nightwares.com/
Director help | Free files | Sample chapters | Freelance | Consulting
Author | Director 8.5 Shockwave Studio: A Beginner's Guide
Published by Osborne/McGraw-Hill
http://shop.osborne.com/cgi-bin/osborne/0072195622.html
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/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!]