Skip to reading
PCA Script Programming

create_variable()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Create Variable | Action ID: CreateVariable

Create a variable only when that name is absent. It is an initializer, so calling it again does not reset an existing value.

Source table from create_variable(), page 78
Option key / fieldMeaning and accepted inputDefault
Variable ID nameText.Blank
Type variableTypeChoose: string, boolean, number, array."string"
Initial Value valueA value of the type required by the selected variable, operation or property.Blank

Timing. The call waits for its runtime routine to return; no additional completion wait is promised by this schema.

Code example
create_variable({"name": "powered", "variableType": "boolean", "value": true})

In use. Create visits with a numeric value of 0, then increment it on room entry. Define long-lived puzzle variables in the Variable Designer so their starting values are easy to find. The variableType field is descriptive; do not rely on it to convert bad input.

Page 78 of 357Permalink
Go to page