> 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/vehicle-spy-main-menus/main-menu-scripting-and-automation/function-blocks/function-blocks-types/script-type-function-block-resetting-the-present-flag.md).

# Script Type Function Block: Resetting the Present Flag

### The Present Flag

One of the most common actions in a function block script is to wait for receipt of a message before executing a block of code. To aid in this, each message has associated with it a property called the **Present** flag. This variable is set to **False** (**0**) when Vehicle Spy starts, and then changed to **True** (**1**) when a message is received, indicating that the message is now present.

Many actions need to be triggered only once for each copy of a particular message that is received. However, once the **Present** flag is set, it will remain set as long as Vehicle Spy stays online (because a received message remains "present"; it doesn't disappear on its own.) To ensure that a script section runs only once for each message copy, it is necessary to reset (or clear) the **Present** flag after each time it is seen as **True**, so that only a new message will set it again.

There are two common ways of resetting the **Present** flag.

### Resetting the Present Flag using the Set Value command

The most precise method is to directly target the **Present** flag itself, simply setting its value to **0** using a [Set Value](/vspy-3-documentation/vehicle-spy-main-menus/main-menu-scripting-and-automation/function-blocks/function-blocks-types/script-type-function-block-commands/script-type-function-block-command-set-value.md) command. This allows you to clear the **Present** flag without affecting other message properties. An example is shown in Figure 1.

![Figure 1: Using the Set Value command to reset the present flag.](/files/3yVZkYajXycdAHLTNqu9)

You can also use Set Value If in a similar fashion, when that would be more useful.

### Resetting the Present Flag using the Clear Stats command

A secondary method is to use the [Clear Stats](/vspy-3-documentation/vehicle-spy-main-menus/main-menu-scripting-and-automation/function-blocks/function-blocks-types/script-type-function-block-commands/script-type-function-block-command-clear-stats.md) command targeting a message. An example of this can be seen in Figure 1.

**Important Note:** Using **Clear Stats** in this manner resets not only the **Present** flag, but also all other information related to the message, including its data. If you will need to work with other properties or data in the message, it is recommended that you instead use **Set Value** as described above.

![Figure 1: Using the Clear Stats command to reset the Present flag of a receive message.](/files/eCpQ9BI41ufzr9TDvdht)


---

# 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/vehicle-spy-main-menus/main-menu-scripting-and-automation/function-blocks/function-blocks-types/script-type-function-block-resetting-the-present-flag.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.
