Page 1 of 1

Changes don't appear on the screen while a loop is running

Posted: Tue Dec 14, 2010 11:03 pm
by MichaelBluejay
When I do something simple like this:

Code: Select all

set lockscreen to false
   repeat forever
   put the seconds into field 1
end repeat
...the changes don't appear on the screen. As soon as I abort the script I can see the updated time.

How can I get the changes to show?

Re: Changes don't appear on the screen while a loop is running

Posted: Wed Dec 15, 2010 1:50 am
by mwieder
/home/mwieder/Desktop/MetaCard/Toolset/mchome.mc
First of all, I would never do that. Ever.

You need to give yourself a way out of the repeat loop (mouseDown is one way)
Second, you're not giving the screen time to update. Your tight repeat loop is taking up all the cpu cycles. You need to tell it to free up some time for other tasks, and the "with messages" part of the otherwise do-nothing call below will do just that.

Try this

Code: Select all

   set the lockscreen to false
   repeat while the mouse is up
      put the seconds into field 1
      wait 0 seconds with messages
   end repeat

Re: Changes don't appear on the screen while a loop is running

Posted: Wed Dec 15, 2010 11:24 am
by Klaus
mwieder wrote:
/home/mwieder/Desktop/MetaCard/Toolset/mchome.mc
??? :shock:

:D

Re: Changes don't appear on the screen while a loop is running

Posted: Wed Dec 15, 2010 4:55 pm
by mwieder
Um.

Note to self: Copy *before* Paste...

Re: Changes don't appear on the screen while a loop is running

Posted: Wed Dec 15, 2010 5:33 pm
by Klaus
mwieder wrote:Um.
Note to self: Copy *before* Paste...
Sounds like a good idea :D

Re: Changes don't appear on the screen while a loop is running

Posted: Thu Dec 16, 2010 8:31 am
by MichaelBluejay
Great, thanks for the help!