LUIDA Docs

CONDITION

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.

CONDITIONStableAvailable Variables
Fires
On State Start · During State · On State Exit

Description

CONDITION is a plain JavaScript object — not a function — exposing the active values of your experiment's variables for the current trial. Keys are variable names you declared in the Configure experiment automation › Variables tab; values are the matching strings (or arrays, for compound types). Use it to make state-listening behavior depend on within-subjects or between-subjects design.

Parameters

Not a function. Indexed as CONDITION["yourVariableName"].

Side effects

  • Reads only — no writes, no signals, no $.groupState mutations. Reading CONDITION doesn't disturb experiment state.
  • Backed internally by $.groupState.currentCondition, refreshed by the state machine at the start of each trial.
  • Lifecycle: within-subjects values swap at the boundary between Trial - Rest and the next Trial - Start. Between-subjects values are set once per session and don't change for its duration.
  • Outside trial states (e.g., during End or before the first Trial - Start), CONDITION may be empty or stale. If you need post-trial values, read them from $.groupState.currentCondition directly, or capture them into COLLECTED_DATA before the trial ends.
  • A misspelled key returns undefined — there's no compile-time check. All values are strings unless your variable definition uses an array type.

Example

In Tutorial 3 (Stroop), the Stimulus × Trial - Start cell reads several within-subjects keys in a single Customized Action to drive both the visible text and its position:

// On State Start of Trial - Start
const fontColor = CONDITION["fontColor"];     // "red" or "blue"
const textMeaning = CONDITION["textMeaning"]; // "RED" or "BLUE"
const depth = CONDITION["depth"];             // "near" or "far"

SetText(textMeaning);
SetChildPosition("Stimulus", 0, depth === "near" ? 1.5 : 3.0, 0);
ShowItem();

The same value is also passed alongside collected data so each row of the eventual CSV carries the condition it came from:

SendDataToCollector("fontColor", CONDITION["fontColor"]);
SendDataToCollector("textMeaning", CONDITION["textMeaning"]);

Source

Assets/Doc/LUIDA-StateListeningItemScriptDoc.md

Original markdown body
- Only available if **LUIDA experiment progress automation feature is enabled and during the trial states** (e.g., `Trial - Start`, `Trial - Rest`).
- Contains values from your configured experimental variables for the current trial.
- Use `CONDITION["your_variable_name"]` to retrieve a specific condition value within the current trial.