Procedures Puzzles

Procedure (aka function) is a named group of puzzles that performs a specific task. By organizing your puzzles in procedures you can make your scenarios more compact and maintainable.

A new procedure can be created by dragging out the procedure definition puzzle from the toolbox:

A newly created procedure puzzle can be renamed and filled up with other puzzles to perform some task:

To be able to trigger (to call) a procedure, drag out the corresponding puzzle from the toolbox:

A procedure can be triggered several times and from several places of a Puzzles scenario. This may allow for re-using puzzles rather than straight-copying similar set of puzzles several times. For example, an animation can be launched whenever the user clicks the object itself or an HTML button (thus securing duplicate controls).

A procedure may have additional input parameters (aka arguments). To add an input to your procedure, click the gear icon and drag out a parameter puzzle from the toolbox on the left, sticking it in the inputs puzzle:

To be able to use an input parameter inside a procedure, drag out the corresponding "get" variable puzzle created automatically in "Variables":

This variable can be used as a substitute for actual data (such as object names) to perform some task with.

When triggering a procedure with inputs, provide the data for each trigger puzzle.

You can jump from a trigger puzzle to the corresponding procedure definition puzzle using the right-click menu:

"procedure with return"

A procedure may output a computed value to its caller (aka return value). To create such a procedure, from the toolbox drag out the variant of the procedure puzzle with the return slot.

"if return"

A procedure may return a value upon some condition before all inside puzzles are interpreted. In this case the procedure stops running prematurely.