PDA

View Full Version : About 'Wait'



terrygillooly
07-14-2011, 05:51 PM
Huzzah! New forum, new question:


<Events>
real rSeconds = 5.5

MessageBox("constant")
Wait: 5

MessageBox("variable")
Wait: (rSeconds)

MessageBox("Finished")


Why does the first 'Wait' directive work, but not the second?

AndyRage
07-14-2011, 10:38 PM
Actually it's that neither of them are waiting for the right amount of time. :)

Firstly, the Wait: directive pauses for the amount of time since the last wait: command was started. In this case, it's the message box. So while you're reading the message box the seconds are already counting down.

The reason for this is so stroke events happen at the rate they were recorded, not the rate they can play back on a fast or slow computer.

To make the script work correctly you should insert a Wait: 0 immediately after the message box (which will be hit immediately), then a Wait: 5 after that:



MessageBox("constant")
Wait: 0
Wait: 5
MessageBox("variable")
Wait: 0
Wait: (rSeconds)
MessageBox("Finished")


Unfortunately.... there's a bug in the scripting engine with Wait: (rSeconds)
I made a late change to the way bracketted expressions are parsed, which fixed a couple of bugs and added that one. So for the moment Wait: (variable) wont work, but it will in the next build.
With such a large update, there are bound to be some other bugs show up, so we'll be doing a point release fairly quickly to catch them.

terrygillooly
07-15-2011, 09:30 AM
Actually it's that neither of them are waiting for the right amount of time. :)

Ha ha, I should have known it wasn't going to be that straightforward.

Thanks for the explanation. Very enlightening :cool: