Pausing Script Execution

Script execution can be paused, either to wait for some external condition, or to delay for a specified length of time, using one of the wait statements. You can use the breakpoint command to pause script execution and enter debugging mode.

wait while, wait until

The wait until command will pause script execution until a given condition occurs or until a particular date/time arrives. If a time is given which is already in the past, execution proceeds immediately. The wait while command waits until a condition is no longer true. In both commands, the condition expression is evaluated repeatedly, and should be an expression whose value will eventually change to the awaited outcome.

wait until "12:50 PM"

wait until temperature(hell) < 32

wait while the sound is not done=

Tech Talk

Syntax:

wait while condition

wait until condition

wait until timeExpression

wait

The wait command will pause script execution for a specified length of time. The script simply goes to sleep for the time interval indicated, then wakes up and continues with executing the following statement.

The timeInterval is any expression that evaluates to a number of seconds. Since SenseTalk supports time interval expressions which evaluate to seconds, you can express the time in a natural fashion, using the terms weeks, days, hours, minutes, seconds, ticks, milliseconds, and microseconds (see Time Intervals). If a time unit is not specified, seconds are assumed.

Examples

wait 20 ticks -- 1/3 of a second

wait 2 days 7 hours 14 minutes and 28.6 seconds

wait 3 milliseconds

wait 1.5

-- assumes seconds, since no unit was specified

Tech Talk

Syntax: wait timeInterval

breakpoint

What it Does

The breakpoint command, if executed in the context of a debugger, will cause execution of the script to be suspended and control transferred to the debugger.

When to Use It

Call breakpoint at any point in your script where you want it to stop for debugging purposes.

Examples

if count > upperLimit then breakpoint

Tech Talk

Syntax: breakpoint

The breakpoint command has no effect if the script is running in an environment without a debugger. Breakpoints can also be disabled by setting the breakpointsEnabled global property to False. Setting this property to True again (its default value) will reenable breakpoints.

 

This topic was last updated on June 21, 2019, at 02:49:49 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2019 Eggplant