Files
orzo/docs/gyms/cross-timeline-interactions/gym_pattern8_dynamic_label.dtl

73 lines
2.2 KiB
Plaintext

# ============================================================
# Pattern 8: Dynamic Label Jump (Variable as Jump Target)
# ============================================================
# The value of a variable is used as the label to jump to.
# This creates a state-machine-like flow controlled by data.
# ============================================================
label start
join Miko center
Miko (neutral): This pattern uses a variable's VALUE as the jump target.
Miko (smile): Let me show you with a time-of-day example.
# Set the variable that will drive the jump
# In a real game, this might be set by a clock system
set {Gym.time_of_day} = "morning"
Miko (neutral): The variable `Gym.time_of_day` is set to "{Gym.time_of_day}".
Miko (joy): Now watch: I'll jump to a label with that exact name.
# This jump target is resolved at runtime from the variable
jump {Gym.time_of_day}
# ---- Labels act as states ----
label morning
Miko (joy): Good morning! The sun is rising over the hills.
Miko (smile): Birds are singing, and the air is crisp and fresh.
[wait time="1.5"]
jump after_demo
label afternoon
Miko (neutral): It's a warm afternoon. The sun is high.
Miko (smile): A perfect time for adventuring!
[wait time="1.5"]
jump after_demo
label evening
Miko (doubt): The sun is setting. Shadows grow long.
Miko (neutral): We should find shelter before night falls.
[wait time="1.5"]
jump after_demo
label night
Miko (shock): It's dark out here! The stars are beautiful but eerie.
Miko (doubt): I can barely see the path ahead...
[wait time="1.5"]
jump after_demo
# ---- Wrap-up ----
label after_demo
join Advisor right
Advisor (pl5): The jump target was `{Gym.time_of_day}` — resolved at runtime!
Advisor (pl5): This is incredibly powerful for:
Advisor (doubt): • Time-of-day systems
Advisor (doubt): • Quest state machines
Advisor (doubt): • Chapter/scene routing
Advisor (doubt): • Any narrative that follows a data-driven flow
[wait time="2.0"]
Miko (smile): You can also combine it with timeline names.
Advisor (pl5): Use one variable for the timeline and another for the label.
Advisor (surprise): Making it possible to route ANYWHERE from a variable.
[wait time="1.5"]
jump gym_main/menu