LUIDA Docs

SendDataToCollector

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.

SendDataToCollector(label, value)StableData Logging
Fires
On State Start · During State · On State Exit · Always-on events

Description

Pushes a single (label, value) pair into LUIDA's Data Collector scratchpad. Displayed in the State-listening Items editor as Push data to collector. The CCK equivalent is the Push data phase on LuidaDataCollectionGimmick.

Parameters

NameTypeDescription
labelstringShould match an entry from Section A of the Configure data collector window. Off-registry labels work but won't appear in the gimmick inspector or auto-populate downstream field dropdowns.
valueanyAny JSON-serializable value. For Bool/Int/Float/Vector2/Vector3, the gimmick + CCK sync header round-trip the value; for String, only this action path works (CCK has no string state).

Side effects

  • Writes $.groupState.collectedData[label] = value. Lazily initializes $.groupState.collectedData = {} if it doesn't exist.
  • This is in-memory only, scoped to the current Cluster instance, not persisted to network. The value sits in the data scratchpad until ProcessAndSaveCollectedData() snapshots it via the data calculator into a queued record.
  • No signals, no callExternal. Within the calculator script, the same value is later readable as COLLECTED_DATA[label].
  • Subsequent calls with the same label overwrite the previous value — the scratchpad is a single-slot key/value store, not an append log.

Example

In Tutorial 3 (Stroop), the TimeRecorder item records each trial's reaction time on Trial - Start exit:

// On State Exit (Customized Action)
$.state.isInTrial = false;
SendDataToCollector("timer", $.state.timer);

Then the data calculator script (LUIDA-DataCollector Script Asset) reads the value back as COLLECTED_DATA["timer"] when assembling each record:

return {
  stateLog: COLLECTED_DATA["stateLog"],
  cond: CONDITION || {},
  ans: $.getStateCompat("this", "isRed", "boolean") ? "R" : "B",
  time: COLLECTED_DATA["timer"],
};

Source

Assets/Doc/LUIDA-StateListeningItemScriptDoc.md