28. Subscribe to PCA events
func on_scene_loaded(event: Dictionary = {}) -> void:
if str(event.get("sceneId", "")) != "lab":
return
Log("The workshop is ready.")func on_trigger_entered(event: Dictionary = {}) -> void:
if str(event.get("triggerId", "")) == "welcome_trigger":
Log("The player crossed the welcome area.")Write the matching on_* function, then check the corresponding Event Functions box in the GDScript editor. Writing a handler name alone is not a subscription to every runtime broadcast.
The event argument is a Dictionary. OnSceneLoaded provides the room ID; trigger events provide triggerId and related context. Filter a broad listener before doing local work. A local door response and a global interaction listener can both run, so guard one-time rewards.
Figure 10. The subscriptions tell PCA which event functions to dispatch to this record.
on_global_ready is a special startup call for a global native record that defines it. You do not need a second ordinary subscription merely to initialize that global instance.
