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
→ TriggerAction.message(_:speak:speaker:)
| text | required | string — empty string is explicitly allowed, for a deliberately silent structural anchor (nothing shown or spoken, but the trigger still fires and still grades). |
| speak | optional, default false | bool — whether this is actually voiced, not just shown as a cue card. |
| speaker | optional, 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
→ 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.
| text | required | string. |
| buttons | required | array, non-empty — each { "label": string, "navigate_to_section": string?, "fires_ui_action": string? }. |
| speak | optional, default false | bool. |
| speaker | optional, 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
→ 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_kind | required | one of heading / direct / altitude / speed — picks which value field below is read. |
| heading_deg | required if instruction_kind is heading | number. |
| direct_fix | required if instruction_kind is direct | string. |
| altitude_ft | required if instruction_kind is altitude | number. |
| speed_kts | required if instruction_kind is speed | number. |
| show_cue | optional, default true | bool — 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
→ 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.
| channel | required | one of lateral / altitude / speed. |
{ "kind": "end_instruction", "channel": "altitude" }
clearance ATC, CRAFT-rendered
→ 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_limit | required | string. |
| route | required | string. |
| altitude_ft | required | number — the initial altitude. |
| expect_altitude_ft | optional | number — paired with expect_minutes. |
| expect_minutes | optional | number. |
| departure_freq | optional | string. |
| transponder | optional | string. |
| void_time | optional | string. |
{ "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
→ 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_deg | required | number — intercept heading. |
| altitude_ft | required | number — maintain until established. |
| approach_name | required | string. |
| position_fix | optional | string. |
| position_distance_nm | optional | number. |
| crosses_final | optional | bool. |
| crosses_final_reason | optional | string. |
{ "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
→ 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_type | required | string — a real FailureType case. |
| engine | optional, default 0 | integer. |
| engine_selection | optional | "random" — coin-flips engine 0/1 at import time, overriding engine. |
| probability | optional, default 1.0 | number 0–1 — rolled once at import time; a miss drops the trigger with a warning (not an error). |
| delay_min_sec / delay_max_sec | optional | number — see above. |
| arm_message | optional | string. |
| grade_against | optional | string — 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
→ 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.
| probability | required | number 0–1. |
{ "kind": "preset_failure_settings", "probability": 1.0 }
unusual_attitude simulator
→ 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_attitude | optional 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
→ TriggerAction.exactUnusualAttitude(pitchDeg:bankDeg:iasKts:throttle:)
| pitch_deg | required | number. |
| bank_deg | required | number. |
| ias_kts | required | number. |
| throttle | required | number. |
{ "kind": "exact_unusual_attitude", "pitch_deg": -25, "bank_deg": 50, "ias_kts": 160, "throttle": 0.6 }
weather simulator
→ TriggerAction.weather(_:)
| weather_preset | required | string — a real WeatherPreset case. |
{ "kind": "weather", "weather_preset": "clear" }
move_aircraft simulator
→ 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_nm | required | number. |
{ "kind": "move_aircraft", "distance_nm": 5 }
present_sign_in app UI
→ TriggerAction.presentSignIn(reason:)
| reason | required | string — 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
→ TriggerAction.setChartLayer(_:)
| chart_layer | required | string — a real ChartLayer case, e.g. ifrLow. |
{ "kind": "set_chart_layer", "chart_layer": "ifrLow" }
navigate app UI
→ 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.)
| section | required | string — an AppSection raw value, e.g. "Map", "Help", "Setup". |
{ "kind": "navigate", "section": "Map" }
spotlight app UI
→ 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_ids | optional, 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
→ 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
→ 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
→ 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_ids | required | array 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
→ TriggerAction.incrementCounter(_:)
Bumps a named counter by 1 — the matching half of counter_at_least.
| counter_id | required | string. |
{ "kind": "increment_counter", "counter_id": "s3_crash_count" }
complete_mission mission lifecycle
→ 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.
| outcome | required | string — 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.