Skip to content

Commit 2b9624b

Browse files
authored
Add Documentation for Jump, Label, and Return Event
1 parent f64cfb1 commit 2b9624b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

documentation/jump-event.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<div class="header-banner tropical">
2+
<div class="header-label tropical">Jump, Label & Return Event</div>
3+
</div>
4+
5+
*The Jump event is used for changing the flow of the timeline and changing to another timeline. It's naturally tied to the Label event.
6+
The jump flow is closely knit to the Label event and the Return event.*
7+
8+
## 📜 Content
9+
[toc]
10+
11+
12+
## 1. Text Syntax
13+
14+
Using `jump` without any target will set the next event to the beginning of this current timeline.
15+
16+
```dtl
17+
# Using "jump" returns to the beginning of this timeline.
18+
character: Hello, this is the start.
19+
character: This is the second message.
20+
jump
21+
```
22+
23+
Let's introduce labels using the Label event. This will print `Hello 1`, `Hello 2`, and `Hello 3`. After this, the jump will print `Hello 2` and `Hello 3`.
24+
25+
```
26+
dtl
27+
character: Hello 1
28+
label your_label_name
29+
character: Hello 2
30+
character: Hello 3
31+
jump your_label_name
32+
```
33+
34+
---
35+
36+
## 2. The Jump Stack
37+
Whenever you use the Jump event, it will track where you are before changing the flow. This allows using the Return event, which reverses the flow back to the last jump point.
38+
If you jump from timeline A to timeline B's start point and use the Return event in timeline B, it will revert to timeline A. This logic behaviour is implemented using a stack.
39+
40+
## 3. Jump Flow via Code
41+
42+
### 3.1 Starting at a Label
43+
If you want to start at a specific label, you can provide this to your start event: `Dialogic.start(timeline, "your_label_name")`.
44+
45+
### 3.2 Jump Signals
46+
Have a look at our signals here: [List of all signals](../classes/subsystem_jump.html#signals).
47+
48+
## 3.3 Jumping directly
49+
If starting at a label is not enough, you can use `Dialogic.Jump.jump_to_label(label: String)` as well. This does not use the jump stack.
50+
Alternatively, you can use `Dialogic.Jump.resume_from_last_jump()`.
51+

0 commit comments

Comments
 (0)