Skip to reading
PCA Script Programming

20. Find your game’s records

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 illustrations

A namespace groups designer records. objects.archive_door is an object; characters.elias is a character definition; rooms.lab is a room. A record reference lets the runtime read a property or route a supported change. It is not a raw Godot Node.

Code example
function run()
    let door = objects.archive_door
    if door exists
        log(door.name)
    end
    let room_id = current_scene()
    let who = active_player()
    return [room_id, who]
end

A string ID is usually the safest argument for action dictionaries. Direct references are useful for properties and the small record-method API. The compiler binds recognized project names to IDs; use autocomplete to avoid misspellings.

For names that are not legal simple identifiers, completion can insert backticks. For a computed ID, use the action/helper’s string parameter instead of trying to construct a dotted source expression. Check exists() before using an optional record.

Figure 5. The editor’s completion list helps find actual records and supported property paths.

There are 19 direct namespaces in this build. Project settings, runtime variables and cutscenes use helpers/actions rather than a Project, Variable or Cutscene PCA namespace. Other scripting languages expose a different surface; their examples cannot be pasted into PCA unchanged.

Page 27 of 357Permalink
Go to page