> For the complete documentation index, see [llms.txt](https://docs.intrepidcs.com/vspy-3-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.intrepidcs.com/vspy-3-documentation/3.9.22/vehicle-spy-main-menus/main-menu-scripting-and-automation/function-blocks/function-blocks-types/script-type-function-block-commands/script-type-function-block-command-wait-until.md).

# Script Type Function Block Command: Wait Until

### Command Description

This command causes the function block script to wait until a specified condition evaluates as **True**, or optionally, until a maximum wait time has been reached.

### Value Field Parameters

Double-click the **Value** field to bring up the dialog box shown in Figure 1.

![Figure 1: Wait Until command parameter dialog box.](/files/yZWqZmsVINVsAaLIsAuf)

### Expression

Press the ![](https://cdn.intrepidcs.net/support/VehicleSpy/assets/Functionbutton.gif) button to launch the [Expression Builder](/vspy-3-documentation/3.9.22/shared-features-in-vehicle-spy/shared-features-expression-builder.md), where you can craft the expression to be used for this command.

Any conditional expression can be entered. For example, you can have a script wait until a particular signal value is seen in a specific message. Message properties are also commonly used here, such as the **Present** flag, as we'll see in the example below.

### Timeout in seconds / Use Timeout

In some situations an expression in a **Wait Until** command may never evaluate as **True**, or it may take more time than is desired. To limit how long the script waits in a particular step, you can specify a *timeout* value in seconds. Vehicle Spy will wait for the selected expression to evaluate as **True**, but only up to a maximum of the specified timeout interval. If that figure is exceeded, then the script will continue despite the expression being **False**.

To use this feature, enter a length of time in the **Timeout in seconds** box, and check the **Use Timeout** box. If the box is not checked, the **Timeout in seconds** value will be ignored, and the script will only continue if the expression evaluates as **True**.

### Example

Figure 1 shows a typical use of the **Wait Until** command: pausing a script until the arrival of a particular message before proceeding, by waiting for its **Present** flag to be set to **True** by Vehicle Spy. Notice that step 2 [resets the Present flag](/vspy-3-documentation/3.9.22/vehicle-spy-main-menus/main-menu-scripting-and-automation/function-blocks/function-blocks-types/script-type-function-block-resetting-the-present-flag.md), which ensures that steps 3 and 4 only occur once for each copy of **Incoming Message** that arrives.

![Figure 1: Example using the Wait Until and Wait For commands.](/files/7VQ5rUI2rQTuTbcfiaLB)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.intrepidcs.com/vspy-3-documentation/3.9.22/vehicle-spy-main-menus/main-menu-scripting-and-automation/function-blocks/function-blocks-types/script-type-function-block-commands/script-type-function-block-command-wait-until.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
