This came up on another list about a year and a half ago. 
Fortunately, I saved my reply.  Here it is:

I don't know of a built in function, but it can be calculated easily 
in Lingo.  Here's a way of displaying it on the screen.  Just create 
a field member, drag it to a channel in the score, put the following 
code into a behavior script and attached it to the field on the stage.

property pMember
property spriteNum
property pLastMilliseconds

on beginSprite me
   pMember = sprite(spriteNum).member
   pLastMilliseconds = the milliseconds
end

on exitFrame me
   nMillisecondsElapsed =  the milliseconds - pLastMilliseconds
   fps = 1000.0 / float(nMillisecondsElapsed)
   member(pMember).text =  fps && " fps"
   pLastMilliseconds = the milliseconds
end


It will constantly update itself with the current frame rate. 
However, if you just want to get the frame rate programmatically, 
then modify it like this, and attach it to anything (e.g. background 
in channel 1):

property pLastMilliseconds
property pFps

on beginSprite me
   pLastMilliseconds = the milliseconds
end

on exitFrame me
   nMillisecondsElapsed =  the milliseconds - pLastMilliseconds
   pFps = 1000.0 / float(nMillisecondsElapsed)
   pLastMilliseconds = the milliseconds
end

on mGetFPS me
   return pFPS
end

And whenever you want to get the framerate, do this:

   theCurrentFPS = sendSprite(1, #mGetFPS)

Irv

At 8:17 PM +0200 4/13/02, Michael von Aichberger wrote:
>Hi and thanks Buzz,
>
>
>>  incorrect.  This is desired tempo, presuming no frameRate lockDown
>has been set.
>
>I don't understand your answer. What's 'frameRate lockDown'? The frameTempo
>actually gives the frame rate which has either been set in the tempo channel
>or with the puppetTempo command. It is not the "actual frame rate", which is
>shown in the control panel.
>
>I know that I can have a look at the 'actual frame rate' area within the
>control panel, but I wanted to let Lingo work with that value, so the
>question was:
>
>Can I get that 'actual frame rate' value with a Lingo function or do I have
>to calculate on my own?
>
>Thanks
>Michael
>
>[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!]


-- 

Lingo / Director / Shockwave development for all occasions. 
          
   (Home-made Lingo cooked up fresh every day just for you.)
[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!]

Reply via email to