Skip to reading
PCA Script Programming

change_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

Change Variable | Action ID: ChangeVariable

Set or modify a variable using set, arithmetic, append or toggle. The operation determines how Value is used.

Source table from change_variable(), page 79
Option key / fieldMeaning and accepted inputDefault
Variable nameChoose a game variable name.Blank
Operation operationChoose: set, add, subtract, multiply, divide, append, toggle."set"
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
change_variable({"name": "powered", "operation": "set", "value": true})

In use. Choose score, Add, 5 for a five-point reward. Toggle suits a repeatable switch; Set is safer when an event may run twice. Keep arithmetic numeric and avoid dividing by zero.

add_score()#

Add Score | Action ID: AddScore

Increase the runtime variable named score by the given integer amount.

Source table from change_variable(), page 79
Option key / fieldMeaning and accepted inputDefault
Amount amountNumber of points to add to score.1

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

Code example
add_score({"amount": 1})

In use. Award 5 after collecting a unique key. This action does not remember that the key was already collected. Put it behind the same one-time condition as the reward. In a native inspector, Change Variable / score / Add is the direct equivalent.

Page 79 of 357Permalink
Go to page