LUIDA Docs

Signals & state keys

The inter-object protocol that LUIDA uses to wire scenes, items, and global state together.

These pages are not yet fully reviewed. The LUIDA team is continuing to review and improve them. If you find anything wrong on these pages, or have questions that aren't resolved by reading them, please ask or report to the LUIDA team.

LUIDA's runtime uses CCK signals and state keys to coordinate between scripts, items, and gimmicks. This page is one big table you'll Cmd-F. This is admin-level reference material — most experiment authors never need it because LUIDA's CCK components, state-listening actions, and customized actions wrap these primitives.

Global state keys

These are read/written via $.setStateCompat("global", <key>, <type>, <value>) and $.getStateCompat("global", <key>, <type>).

KeyTypeSet byRead byMeaning
state_currentIDintegerStateMachine prefab on transitionAll state-listening itemsActive state index (0-based)
exp_trialIDintegerConditionManager.js at trial-rest-to-start boundaryConditionManager, data calculator scriptsCurrent trial number (0-based)
state_enterbooleanStateMachine on transitionStateListeningItemBase.jsPulse to fire on-enter actions
state_exitbooleanStateMachine on transitionStateListeningItemBase.jsPulse to fire on-exit actions
exp_showItemboolean"Show item" / "Hide item" actionsCCK Show/Hide gimmicks attached to the itemVisibility toggle for state-listening items
exp_recordCustomDataboolean"Process and Save" actionCustomDataUploader.jsPulse to snapshot a record
exp_uploadCustomDataboolean"Upload" actionCustomDataUploader.jsPulse to flush queue
luida_avatar_cmdintegerLuidaAssignAvatarGimmickAvatarManager.js polling> 0 = assign avatar at index N-1; -1 = unassign; 0 = no-op
luida_avatar_participantintegerLuidaAssignAvatarGimmickAvatarManager.js pollingTarget participant (1-based) for current avatar command
someCckState (and other arbitrary keys)variousResearcher-defined CCK gimmicksCustom data calculator via getStateCompatResearcher-defined state for experiment-specific logic

Item state keys

These are read/written via $.setStateCompat("this", <key>, <type>, <value>) (or with an item reference for cross-item).

KeyTypeSet byRead byMeaning
qIDintegerLuidaQuestionnaire.cs editor markerFormController.jsBound questionnaire ID for this Questionnaire item
pIDintegerForm controller setupForm runtimeParticipant assigned to this questionnaire copy

Player state keys

Per-participant scoped state. Set via $.setPlayerScriptableValue(playerHandle, <key>, <type>, <value>).

LUIDA does not currently use player-state keys for first-class features. Common in custom code for per-participant flags (e.g., "this participant has completed the practice round").

Signals (sendSignalCompat)

Signals are pulse events — fired with $.sendSignalCompat(<scope>, <signal-name>). Listeners react.

SignalSent byReceived byEffect
state_triggerTransition"To next state" action; LuidaToNextStateGimmick; participant interactions wired to advance stateStateMachine prefabAdvance state_currentID
exp_playersAreEnoughParticipantManager.js when joined count ≥ pNumStateMachine init logicBegin first state transition
exp_StartStateTransitionParticipantManager.js after between-subjects conditions are savedStateMachine init logicKick off state_currentID = 0
exp_readyToLeaveTrialsConditionManager.js when trialID >= trialCount - 1Optional listener (researcher-wired)Signal end of trial loop; usually wires to UI prompt
exp_resetTrialsConditionManager.js (manual reset, debug only)Trial loop logicReset exp_trialID = 0
exp_recordCustomData"Process and Save" action; LuidaProcessDataAndSaveToCollectionGimmickCustomDataUploader.jsSnapshot collected data into queue
exp_uploadCustomData"Upload" action; LuidaUploadCollectedDataGimmickCustomDataUploader.jsFlush queue to Web Console
luida_avatar_cmd_resetAvatarManager.js after processing a commandLuidaAssignAvatarGimmick (resets state to 0)Reset avatar command flags
form_allPlayersCompletedFormController.js when all participants in session have submittedOptional state-machine listenerTriggers state advance after questionnaire
form_show_start_hintFormController.js while waiting for participantsForm prefab UI elementsUI hint visibility
form_show_loading_barFormController.js during questionnaire data fetchForm prefab UI elementsLoading indicator

Player-script messages

These are sent via playerHandle.send(<messageType>, <payload>) from the server-side script to the participant's local player script (LuidaBasicPlayerScript.js).

messageTypePayload shapeEffect
haptics{ target: "left" | "right" | null, frequency, amplitude, duration }Plays haptic on local controller
sendOsc{ address: string, values: array }Sends OSC message from local client
initializeParticipant{}Triggers per-participant init handshake
setQuestionnaireUI{ uiElementName, props }Updates one questionnaire UI element
setQuestionnaireUIs{ updates: array }Batched update
clearQuestionnaireAnswerUIs{}Disable answer-option labels

$.groupState keys

Server-side per-instance object cache (not the same as state keys above; this is a JavaScript object, not Cluster's typed state).

FieldTypeSet byRead by
$.groupState.participantsPlayerHandle[]ParticipantManager.js on each joinEverywhere (PARTICIPANTS[i] is a thin wrapper)
$.groupState.sessionIDstringParticipantManager.js after eligibilityData calculator scripts
$.groupState.currentCondition{ varName: value, ... }ConditionManager.js at trial-boundariesCONDITION[varName] lookups in actions and data calculator
$.groupState.stateNamesstring[]Generated state-machine codeMostly for debugging
$.groupState.collectedDataobjectSendDataToCollector actioncalculateData() in your data calculator
$.groupState.isParticipantsEnoughbooleanParticipantManager.jsLogic gating session start
$.groupState.qCompletedCountintegerFormController.jsTrack questionnaire completion progress

See also