Reference

Actions

What happens when a trigger's condition is met. Source of truth: ScriptImport.makeAction in CoachApp/ATC/ScriptImport.swift, resolving into a real TriggerAction (CoachApp/Pilot/ArmedTrigger.swift).

message cue

message

→ TriggerAction.message(_:speak:speaker:)

textrequiredstring — empty string is explicitly allowed, for a deliberately silent structural anchor (nothing shown or spoken, but the trigger still fires and still grades).
speakoptional, default falsebool — whether this is actually voiced, not just shown as a cue card.
speakeroptional, default "coach""coach" or "atc" — decides cue-card styling and which recorded-voice persona/catalog is tried.
{ "kind": "message", "speak": true, "speaker": "atc",
  "text": "November One Two Tree Four Five, you are cleared to the Sacramento VORTAC, as filed, climb and maintain two thousand." }

Every spoken line with a digit, heading, altitude, frequency, or callsign must have its TTS form pronunciation-substituted (per coach-ios/CLAUDE.md's own digit/heading/altitude rules) — "3" → "tree," headings spoken one digit at a time, altitudes as grouped number words. Write the spoken form directly into text; there's no separate display-vs-speech field.

choice cue + buttons

choice

→ TriggerAction.choice(_:speak:speaker:buttons:)

A cue carrying one or more tappable buttons. A yes/no branch picks this up via two downstream triggers each gated on ui_action with the matching fires_ui_action id.

textrequiredstring.
buttonsrequiredarray, non-empty — each { "label": string, "navigate_to_section": string?, "fires_ui_action": string? }.
speakoptional, default falsebool.
speakeroptional, default "coach""coach" or "atc".
{ "kind": "choice", "speak": true,
  "text": "Do you need help getting that set up?",
  "buttons": [
    { "label": "Yes, show me", "fires_ui_action": "companion_help_yes" },
    { "label": "No, I've got it", "fires_ui_action": "companion_help_no" }
  ] }

instruction ATC, graded

instruction

→ TriggerAction.instruction(_:showCue:)

A real ATC instruction, graded for response time and compliance — the one action kind that actually opens a trackable assignment channel (lateral/altitude/speed), released later by end_instruction.

instruction_kindrequiredone of heading / direct / altitude / speed — picks which value field below is read.
heading_degrequired if instruction_kind is headingnumber.
direct_fixrequired if instruction_kind is directstring.
altitude_ftrequired if instruction_kind is altitudenumber.
speed_ktsrequired if instruction_kind is speednumber.
show_cueoptional, default truebool — false for a silent companion instruction whose real value was already spoken in an adjacent message/clearance (so grading has a real target without a redundant second cue card).
{ "kind": "instruction", "instruction_kind": "altitude", "altitude_ft": 4000, "show_cue": false }

end_instruction grading bookkeeping

end_instruction

→ TriggerAction.endInstruction(_:)

Releases whatever flat-target instruction is open on a channel, nothing replacing it. Silent — never a cue card. Use the moment a procedure's own charted vertical/lateral profile legitimately takes over from a flat ATC assignment (established on an ILS, established on a DME arc). An instruction that's never released grades the aircraft's own correct charted descent afterward as a growing bust — always pair an altitude/heading instruction with a matching release.

channelrequiredone of lateral / altitude / speed.
{ "kind": "end_instruction", "channel": "altitude" }

clearance ATC, CRAFT-rendered

clearance

→ renders to TriggerAction.message(_:) — no dedicated Swift case

Renders a CRAFT-structured clearance (Clearance limit, Route, Altitude, Frequency, Transponder) to a real message action automatically, in CRAFT order, from real fields — not free-form prose. Don't prefix route with "via," the renderer adds it.

clearance_limitrequiredstring.
routerequiredstring.
altitude_ftrequirednumber — the initial altitude.
expect_altitude_ftoptionalnumber — paired with expect_minutes.
expect_minutesoptionalnumber.
departure_freqoptionalstring.
transponderoptionalstring.
void_timeoptionalstring.
{ "kind": "clearance", "clearance_limit": "San José", "route": "direct Sacramento, the PYE Three arrival",
  "altitude_ft": 7000, "departure_freq": "121.0", "transponder": "0200" }

vector_to_final ATC, 7110.65-rendered

vector_to_final

→ renders to TriggerAction.message(_:) — no dedicated Swift case

Renders a FAA Order JO 7110.65 §5-9-1-structured vector-to-final call: position relative to a fix, the intercept heading, the altitude to maintain until established, and the approach clearance.

heading_degrequirednumber — intercept heading.
altitude_ftrequirednumber — maintain until established.
approach_namerequiredstring.
position_fixoptionalstring.
position_distance_nmoptionalnumber.
crosses_finaloptionalbool.
crosses_final_reasonoptionalstring.
{ "kind": "vector_to_final", "heading_deg": 330, "altitude_ft": 4500, "approach_name": "ILS runway 30 left",
  "position_fix": "KLIDE", "position_distance_nm": 5 }

failure simulator

failure

→ TriggerAction.failure(_:engine:)

Injects a real failure into the simulator. A nonzero delay_max_sec expands into TWO real triggers at import time: one that fires on the authored condition and speaks arm_message (so the flight isn't silent while the delay counts down), and the actual delayed failure, chained via a randomly-rolled delay within [delay_min_sec, delay_max_sec] — rolled once, at import time, same as probability's own roll.

failure_typerequiredstring — a real FailureType case.
engineoptional, default 0integer.
engine_selectionoptional"random" — coin-flips engine 0/1 at import time, overriding engine.
probabilityoptional, default 1.0number 0–1 — rolled once at import time; a miss drops the trigger with a warning (not an error).
delay_min_sec / delay_max_secoptionalnumber — see above.
arm_messageoptionalstring.
grade_againstoptionalstring — a ProcedureFlowCatalog id (e.g. abort-take-off-multi, drill-engine-out-multi). Reuses the existing engine-identity-aware ordered-checklist grading mechanism instead of a new declarative rule kind — see grading.html's own intro.
{ "kind": "failure", "failure_type": "full", "engine_selection": "random", "probability": 1.0,
  "grade_against": "abort-take-off-multi" }

preset_failure_settings simulator

preset_failure_settings

→ TriggerAction.presetFailureSettings(probability:)

Forces FailureSettings.probability to an exact value when a mission starts — scenario selection and arming stay the pilot's own clicks; only the odds are preset.

probabilityrequirednumber 0–1.
{ "kind": "preset_failure_settings", "probability": 1.0 }

unusual_attitude simulator

unusual_attitude

→ TriggerAction.unusualAttitude(_:)

Writes a randomized, categorical upset straight to X-Plane — all sub-fields optional, default "ANY". For a specific, repeatable upset, use exact_unusual_attitude instead.

unusual_attitudeoptional object{ pitch, bank_direction, bank_size, airspeed, power }, each a categorical string, default "ANY".
{ "kind": "unusual_attitude", "unusual_attitude": { "bank_size": "BIG" } }

exact_unusual_attitude simulator

exact_unusual_attitude

→ TriggerAction.exactUnusualAttitude(pitchDeg:bankDeg:iasKts:throttle:)

pitch_degrequirednumber.
bank_degrequirednumber.
ias_ktsrequirednumber.
throttlerequirednumber.
{ "kind": "exact_unusual_attitude", "pitch_deg": -25, "bank_deg": 50, "ias_kts": 160, "throttle": 0.6 }

weather simulator

weather

→ TriggerAction.weather(_:)

weather_presetrequiredstring — a real WeatherPreset case.
{ "kind": "weather", "weather_preset": "clear" }

move_aircraft simulator

move_aircraft

→ TriggerAction.moveAircraft(distanceNm:)

Moves the aircraft forward straight down whatever heading it's actually flying the instant this fires — no UI, no long-press.

distance_nmrequirednumber.
{ "kind": "move_aircraft", "distance_nm": 5 }

present_sign_in app UI

present_sign_in

→ TriggerAction.presentSignIn(reason:)

reasonrequiredstring — shown in the real sign-in sheet.
{ "kind": "present_sign_in", "reason": "Sign in to save your progress across devices." }

set_chart_layer app UI

set_chart_layer

→ TriggerAction.setChartLayer(_:)

chart_layerrequiredstring — a real ChartLayer case, e.g. ifrLow.
{ "kind": "set_chart_layer", "chart_layer": "ifrLow" }
navigate

→ TriggerAction.navigate(_:)

Navigates the app to another screen automatically — fires the instant its condition is met, no tap required. (choice's own navigate_to_section button field is the tap-driven half.)

sectionrequiredstring — an AppSection raw value, e.g. "Map", "Help", "Setup".
{ "kind": "navigate", "section": "Map" }

spotlight app UI

spotlight

→ TriggerAction.spotlight(_:)

Highlights zero or more on-screen targets until a later trigger replaces or clears the list. Silent — pair with a sibling message/choice that carries the real instruction.

target_idsoptional, default []array of view ids tagged .tutorialTarget(_:) in the app. [] (or omitted) clears every highlight.
{ "kind": "spotlight", "target_ids": ["hud_connection_dot"] }

open_drawer / close_drawer app UI

open_drawer close_drawer

→ TriggerAction.openDrawer / .closeDrawer

No fields of their own — just open/close the slide-out drawer the hamburger button opens.

{ "kind": "open_drawer" }
{ "kind": "close_drawer" }

noop timing gate

noop

→ TriggerAction.noop

Does nothing at all — a pure timing gate with zero side effects, for a step whose only job is forcing a real wait before a LATER app_state/not_before_trigger_id check re-verifies something. Don't repurpose spotlight (re-asserting the same target) for this — it has a real side effect (re-lighting a highlight something else may have already cleared).

{ "kind": "noop" }

rearm_triggers retry/loop

rearm_triggers

→ TriggerAction.rearmTriggers(_:)

Clears the "already fired" latch for each named trigger, so they can fire again — the crash-and-retry loop's own primitive. A script re-arms its own earlier chain of triggers instead of needing a second, duplicated copy of them. One real ripple: once a trigger can legitimately fire twice, a grading rule's own trigger_id lookup grades the MOST RECENT firing, not the first.

rearm_trigger_idsrequiredarray of trigger ids, non-empty.
{ "kind": "rearm_triggers", "rearm_trigger_ids": [
  "t_ready_3", "t_s3_brief", "t_s3_ptt_ask", "t_ptt_3", "t_fail_3", "t_tpa_reached", "t_crash_3"
] }

increment_counter retry/loop

increment_counter

→ TriggerAction.incrementCounter(_:)

Bumps a named counter by 1 — the matching half of counter_at_least.

counter_idrequiredstring.
{ "kind": "increment_counter", "counter_id": "s3_crash_count" }

complete_mission mission lifecycle

complete_mission

→ TriggerAction.completeMission(outcome:)

Ends the mission right now — the one, generic "this script is done" signal. Routes through the same end-of-recording path a manual STOP RECORDING already uses. Never gates whether the flight is scored — every ended flight is graded exactly as any other, regardless of which outcome fired.

outcomerequiredstring — a free-form, author-chosen key ("success", "gave_up"), stamped onto the saved flight record for debrief copy/analytics.
{ "kind": "complete_mission", "outcome": "success" }

Not yet supported in JSON

Real TriggerAction capabilities with no import form today: dynamicMessage (live-computed spoken lines — a hold-entry briefing, a radar vector heading, a lead-radial callout, all needing position/heading known only at fire time), groundRelease (a ground-start lesson's own non-graded departure clearance taking effect at liftoff), and assignHold (dynamically assigning an ad-hoc hold mid-flight). All three remain Swift-only, authored in IFRLessonLibrary.swift.