Skip to reading
PCA Script Programming

22. Gameplay calls and readable commands

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

PCA Script offers two useful spellings for many jobs. Readable commands are quick for common adventure work. The shared action functions cover the full catalog and put their settings in one dictionary. Both routes reach the gameplay runtime.

Code example
function run()
    say "The mechanism is silent."
    give key to player
    hide object key_pickup
    play sound chime
    set camera to wide
end
Code example
function run()
    add_inventory({"itemId": "key", "count": 1})
    set_object_visible({"entityId": "key_pickup", "visible": false})
    play_sound({"assetId": "chime", "channel": "puzzle"})
    action("CameraShake", {"duration": 0.3, "power": 0.1})
end

Function names use snake_case. Dictionary field names keep the catalog’s spelling: characterId, not

character_id; assetId, not asset. A typo inside a dictionary can silently leave the action using a default. Copy the field key from the reference.

A direct action call normally waits for the action routine to return. That does not mean the visible effect has ended. Playing an animation or music can return after playback starts. A camera blend or fade may wait, and some actions expose a wait option. Each reference entry includes the timing rule.

Use a quoted ID such as "archive_door" in an options dictionary. An omitted dictionary uses the catalog defaults; it does not discover the object you meant.

Page 29 of 357Permalink
Go to page