Stage Behaviours
stage_behavioursInspect and reload scene object behaviours to see each object's actions, state, sound, and errors, letting you fix JavaScript so the room responds on its own.
Instructions
What the things in a scene do on their own: the objects with a behaviour in scenes//behaviours.js, what
each can do (press, its menu items, its inputs), its state now, its sound, and every load error and warning
(page command: behaviours). reload=True reads the file again first: after writing or changing it, call this with
reload and read the errors (each {object, phase, action, error, line}; line is in behaviours.js).
The file is plain JavaScript, no imports: export default { object_name: { sound, state, apply(s), press(s), menu: {label: (s) => ...}, inputs: {name: (s, value) => ...} } }. The page runs these itself when the person
pinches or triggers the object in VR (or picks a menu item), so the room answers with no agent in the loop: turn
anything you did by hand (lights, moves, visibility, music, any page command through s.do) into such a function.
s is the object's handle: get, set, state, send (wire to another object's input), light, show, move, sound,
emit (a message to agents: object_message), do, after, every, clock, where (an object, 'person' or a body's joint
':': location, rotation, forward), place (a pose at once) and follow (soft-follow a target every
frame: a chase or drone camera; stage_follow tries one without code, and its options are the same). A frame(s, dt) in an object's definition runs every frame. apply(s) runs at load and after every state change:
put the state-to-room mapping there, so a reload or a scene switch shows the right room. Every interaction needs
its own sound (sound: a file under the scene folder, rendered with ismail); without one the page clicks and
warns. Every error, at load or at run time, also goes out as behaviour_error {object, phase (load, apply, press,
menu, input, after, every, frame, follow), action, error, line}; listen for it. In VR a press that fails buzzes and shows a short
note at the object, and an object whose code did not load (broken) does the same instead of opening the edit
menu. Page replies {file, objects: [{object, actions, state, sound}], errors, warnings, broken: {object: why},
following: [{object, target, by, waiting?}]}.
Emits: behaviours_loaded, behaviour_error, behaviour_warning.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene | Yes | ||
| reload | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |