Creating Timelines in Code

As timelines and events are just resources, you can create new timelines in code.

📜 Content

How do I create timelines via code?

Creating an empty timeline would look like this:

var timeline : DialogicTimeline =

Of course, the timeline created here doesn't contain events yet. To add events, you can do two things:

  • Create an array of event resources:
var events : Array = []
var text_event =
text_event.text = "Hey, this was made in code!"
text_event.character = load("res://characters/Emilio.dch")

var timeline : DialogicTimeline = = events
# if your events are already resources, you need to add this:
timeline.events_processed = true
  • Create an array of Strings:
var events : Array = """
Jowan (Surprised): Wow this is interesting!
- Yes
    [background path="res://icon.png"]
    [wait seconds="1"]
    set MyAutoload.exitement += 20
- No
    set MyAutload.exitement -= 10 """.split('\n')

var timeline : DialogicTimeline = = events

In this case, you have to follow the syntax explained in this tutorial.