Skip to reading
Actions, Properties & Runtime Updates

Decide what happens on failure

Edition 0.86.4.4 Hotfix 2

Updated through 0.86.4.4 Hotfix 2, with cinematic property, recorded-pose or voice-timing lessons as described in this guide. Earlier examples, screenshots and complete registry figures retain their stated edition context.

Download PDFView illustrations

0.86.4.0 / Read checked property outcomes > p. 32

CHAPTER 06 / CHECKED RESULTS

Suppose a player picks up a power cell. You only want “Got it!” to appear if something actually went into the bag.

Source table from Decide what happens on failure, page 12
On failure settingWhat to expect
continueThe next step runs. Use this when later steps still make sense on their own.
stop this listLater steps are skipped. Put this on the pickup step if the success message follows it.
run other actionsThe recovery actions run, then the original list resumes. Keep any unconditional success message out of that common path.

Scroll to the bottom of a script-capable action for checked calls in four languages. Shown here for Change Scene.

If you are calling the action from a script#

Look up AddInventory in the reference and scroll to Checked calls. Here is the GDScript form filled in for the Prototype Lab’s power cell. Use it in a PCA game script that has access to the action helpers.

Code example
var r = await ActionResult("AddInventory",
Code example
    {"itemId": "cell", "count": 1})
Code example
if r.ok:
Code example
    print(r.result.quantity)
Code example
else:
Code example
    print(r.error, " ", r.message)

On success, quantity says how many fit. Asking for two when only one fits can add one. If the stack is full, inspect the failure code and message. A successful yes-or-no query can also answer false, so check ok before interpreting the result.

Taking payment? Stopping a list leaves earlier steps in effect. Put Remove Inventory and Add Inventory inside Inventory Transaction if the active bag must satisfy both quantities for the purchase to go through.

Page 12 of 39Permalink
Go to page