43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
# ============================================================
|
|
# Pattern 2: Jump + Return (Subroutine Pattern)
|
|
# ============================================================
|
|
# This timeline CALLS a sub-timeline (gym_pattern2_subroutine.dtl)
|
|
# which does some work, then RETURNS control back here.
|
|
# ============================================================
|
|
|
|
label start
|
|
|
|
join Miko center
|
|
join Advisor right
|
|
|
|
Miko (neutral): I'm in the caller timeline.
|
|
Advisor (pl5): Let me check something in the subroutine...
|
|
|
|
# Save current position and jump to the subroutine
|
|
jump gym_pattern2_subroutine/start
|
|
|
|
# Execution resumes HERE after the subroutine calls "return"
|
|
label after_return
|
|
|
|
Miko (joy): Welcome back! The subroutine finished.
|
|
Advisor (pl5): Notice how we resumed right where we left off.
|
|
|
|
[wait time="1.0"]
|
|
|
|
# Let's demonstrate: the subroutine set a variable
|
|
if {Gym.sub_value} == 42:
|
|
Miko (smile): The subroutine set `Gym.sub_value` to {Gym.sub_value}!
|
|
Advisor (pl5): Variables set in subroutines persist after return.
|
|
else:
|
|
Miko (doubt): Hmm, the subroutine didn't set the value correctly.
|
|
Advisor (doubt): Something went wrong — `Gym.sub_value` is {Gym.sub_value}.
|
|
|
|
[wait time="1.5"]
|
|
|
|
Miko (neutral): That's the subroutine pattern in a nutshell!
|
|
Advisor (pl5): Jump → work → return. Powerful for reusable dialog chunks.
|
|
|
|
[wait time="1.0"]
|
|
|
|
jump gym_main/menu
|