Skip to main content

How Conditional Transitions Work

Here’s the sequence:
  1. Event occurs (learner taps, moves, chooses, etc.)
  2. Condition is evaluated (e.g., “score >= 80”, “selectedOption == ‘correct’”)
  3. If condition is TRUE: Transition fires, moving to the next state
  4. If condition is FALSE: Transition is skipped; the system checks the next transition
  5. Actions run during the transition and in onEntry/onExit of states

Setting Up a Conditional Transition

Transition card showing Conditions field with 'Score > 60' expression, Insert Variables, Actions, and Destination Step

A conditional transition — the Conditions field contains an AXL expression (Score > 60) with Insert Variables and Actions sections below

1

Select a state and go to the Transitions tab

Click a state, then open the Transitions tab in the Properties panel.
2

Create or select a transition

Click Add Transition or expand an existing one. Each transition shows Events, Conditions, Actions, and Destination Step.
3

Add an event to the transition

Click the + button next to Events to choose what triggers this transition (Tap, Move, Rotate, etc.).
4

Expand the Conditions section and write your expression

Enter an AXL expression like Score > 60. Use Insert Variables to reference available variables.
5

Set the Destination Step

Choose the target state from the dropdown.
6

Optional: Add transition actions

Expand the Actions section and click + to add actions that run during the transition (between onExit and onEntry).

Transition Priority: Multiple Conditions

When multiple transitions exist from the same state for the same event, they are checked in order (from top to bottom, or as defined in your UI). The first transition whose condition evaluates to TRUE fires. Important: All other transitions are skipped once one fires.

Example: Multiple Choice Paths

State: “Safety Quiz” → Event: Choice
If the learner picks option A:
  • Transition 1’s condition is true → fire to “Correct Answer State”
  • Transitions 2 and 3 are never checked
If the learner picks option B:
  • Transition 1’s condition is false → skip
  • Transition 2’s condition is true → fire to “Incorrect Answer State”
  • Transition 3 is never checked

Unconditional Fallback Transitions

A transition with no condition (or an empty condition field) always fires. Use this as a default path. Best practice: Place specific conditions first, then add an unconditional fallback at the end.

Example: Fallback for Unexpected Input

The third transition acts like an “else” clause. If the learner picks something unexpected, this transition fires.

Transition Actions

In addition to onEntry and onExit actions, transitions themselves can have actions — things that run during the move from one state to another. Execution order:

Common Transition Actions

Example: Transition Actions

Scenario: Learner taps the correct object. Before moving to “Success” state, increment the score.
When the learner taps the correct valve:
  • onExit of current state runs (if any)
  • Transition actions run (score increases)
  • onEntry of “Success State” runs (plays congratulatory audio)

Branching Example: Score-Based Paths

Here’s a realistic multi-state branching flow: State 1: “Safety Quiz”
Transition 1 → State 2: “Correct Answer”
Transition 2 → State 3: “Incorrect Answer”
State 2: “Correct Answer”
State 3: “Incorrect Answer”
State 4 & 5: Final states This flow creates a branching experience where:
  • Correct answers give points and move forward
  • Incorrect answers allow retries (up to 3 attempts)
  • After 3 incorrect attempts, show a different ending

Complex Conditions in Transitions

Use the Altoura Expression Language (AXL) to build sophisticated conditions:

Example: Time-Based Branching

Example: Multi-Variable Conditions

Example: State Tracking

Testing Conditional Transitions

Before launching, test all your branches:
Use the Preview feature. Manually set variable values and verify that each transition fires correctly based on its condition.
Make sure every conditional transition works. Try different values for each condition.
If a condition is score >= 80, test with score = 79 and score = 80 to verify the boundary.
Verify that unconditional (fallback) transitions fire when expected.
Make sure transition actions (like setting variables) actually happen. Check values in the Variable Inspector after transitions.
If you use && / ||, test all combinations. For example, if the condition is (A && B) || C, test when only A is true, only B is true, only C is true, etc.

Best Practices for Conditional Transitions

Put your most specific conditions first, then broader ones, then a fallback. This prevents unintended paths.
Add an unconditional transition at the end to catch unexpected cases. Prevents learners from getting stuck.
Avoid overly complex AXL expressions. If a condition is hard to understand, break it into smaller pieces using variables.
Instead of v1 or temp, use score, correctAnswers, isComplete. Makes conditions self-documenting.
Add state descriptions or comments explaining why transitions exist and what conditions control them.

Common Mistakes to Avoid

Forgetting the fallback: If all conditions are false and there’s no unconditional transition, learners get stuck. Always add a fallback.
Overlapping conditions: If two transitions both evaluate to TRUE for the same event, only the first fires. Make sure your conditions don’t overlap unintentionally.
Not testing edge cases: A condition like score > 80 works differently than score >= 80. Test both sides of boundaries.

Next Steps

Learn how to: