speedy idle

Richard Gaskin ambassador at fourthworld.com
Fri Mar 19 03:33:41 EST 2004


Andrew wrote:
> Hello.  I have a strange problem.
> I have a "faux" idle sequence built into my script where a handler 
> called "idleStuff" is called on openCard.  Without going into too much 
> detail, "idleStuff" runs some animation, and then at the end of 
> "idleStuff" it says "send idleStuff to me in 50 milliseconds.
> Anyway, I have a button called "reset" that sends "opencard" when 
> clicked.  The funny thing is, when I click on "reset," the animation 
> starts to go faster.  Every time I click on "reset" it runs faster and 
> faster yet.
> Has anyone encountered this problem before?

It sounds like maybe each time you click it you're adding another set of 
50ms-interval messages.

You can avoid that by checking the message queue before adding new ones:

on idleStuff
  -- do idle stuff
  if "idleStuff" is not in the pendingMessages then
    send "iddleStuff" to me in 50 millisecs
  end if
end idleStuff


-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list