Skip to content
Fabrizio Nunnari edited this page Jun 21, 2021 · 1 revision

How to configure a project with a reset loop

In this small tutorial we show how to structure a project in order to support a High Priority reset event.

We take advantage of Super Nodes and Interruptive Edges.

Project Settings

We show a project using a keyboard input to interrupt a running project and restart from the beginning.

First, open a project and load the KeyRunTimePlugin, and add an instance for that device, as in the following image.

Setup the keyboard plugin

Project Configuration

Setup a project using the structure depicted in this image.

The top level default project

Remember to set the variable PressedKey as property of the top level project (not in a state). This variable will be set by the KeyRunTimePlugin with the value of the last key pressed on the keyboard.

The squared state is a super node. You can double click on the super node to enter it. Here, you can edit whatever your want. As a simple delayed loop.

The dummy subproject

Notice the top bar showing the path default --> ProjectContainer, which helps you in keeping track of your edit location.

Explanation

The idea is to setup your project inside the Super Node ProjectContainer. Whenever the user pressed P (panic!) we interrupt the sub-project (all state activations are cancelled) and loop to the start again. The KeyReleaseDelay is needed to give time to the user to release the button, as the variable PressedKey will be left with the value of the last pressed key. In the next state RecoverFromPain, first of all we reset the PressedKey variable, then we can do whatever we need to breath out (thanks to the Timeout Edge), and finally jump back to TheStart node.

If, instead of a PressedKey, you activate the interruption with another type of event (as an external panic red button), you might not need the extra key release delay and use one less node.

Clone this wiki locally