Candy Logo Copyright © 2025-2026 Candy Arts

Exporting and Running
In this tutorial, you will learn to export a finished Dialogue to your project, and to run it from your game's code. While a Dialogue is being written, the Test button writes it to test_dialogue.txt, which every test overwrites. A finished Dialogue is exported to a file of its own, which your game loads. Here, the Dialogue of the previous tutorials is exported to neighbors.txt. Before You Start This tutorial uses the Dialogue of the Playing Media tutorial. It must be open in Candy Dialogue Creator: if you saved it (File > Save) and closed Candy Dialogue Creator since, open it again with File > Load Dialogue... 1. Exporting the Dialogue 1. In Candy Dialogue Creator, open File > Export Dialogue... 2. In the File field, write "neighbors.txt". A file name alone is written to your project's Candy_DE/Dialogues folder. 3. Leave the Mode at Overwrite. 4. Click Export, then Export again in the confirmation window.
Tutorial Export Window
The list displays every Conversation and Block of the Dialogue, all checked: all of them are exported. With the Overwrite mode, the file becomes exactly what is checked, and anything it contained before is replaced. The Dialogue is now in Candy_DE/Dialogues/neighbors.txt. Export it again the same way after every change, so that the file contains it. 2. Running the Dialogue Your game runs a Dialogue with two functions of the Engine: one loads the Dialogue file, the other starts the Dialogue. Call them in your code where the Dialogue should start:
candy_ui.load_scripted_dialogue("neighbors") candy_ui.start_dialogue("Conversation_1", "Block_1", 0)
candy_ui is the Engine of the default dialogue UI: an autoload Candy Dialogue Engine adds to your project. The testing scene runs Dialogues in it too. load_scripted_dialogue() load_scripted_dialogue() loads a Dialogue file of the Candy_DE/Dialogues folder. It accepts one argument: • The file's name, without its .txt extension: "neighbors" loads neighbors.txt. The Dialogue remains loaded after it ends. To start another of its Conversations later, call start_dialogue() again, without loading the file again. start_dialogue() start_dialogue() starts the loaded Dialogue. It accepts three arguments, which set where the Dialogue starts: • The Conversation's name: "Conversation_1". • The Block's name, in that Conversation: "Block_1". • The Line to start at: its number, counted from 0, or the Reference of an LM command of that Block. 0 starts at the first Line. For example, the evening scene starts with:
candy_ui.start_dialogue("Conversation_2", "Block_1", 0)
An Engine runs one Dialogue at a time: start_dialogue() starts nothing while another Dialogue is running in the same Engine. 3. Exporting Your Game
Important: Godot doesn't include .txt files when it exports a game, by default. You need to make a small configuration, or your Dialogues will be missing from the game and won't run.
To include Dialogue .txt files when exporting your game: 1. In the Godot Editor, open Project > Export..., and select your export preset. 2. In the Resources tab, add *.txt to the Filters to export non-resource files/folders field. Add the filter once for each export preset. If It Fails • The Output panel prints "Could not open dialogue file": check that neighbors.txt is in Candy_DE/Dialogues, and that the code names it without the .txt extension. • The Output panel prints "CANNOT START DIALOGUE: target not found": the file doesn't contain that Conversation or Block. Check the names in the code, which are case-sensitive, and export the Dialogue again. • The Output panel prints "Another dialogue is still running": the Engine is still running a Dialogue. Start the next one once it has ended. • The exported game runs no Dialogue: add the *.txt filter to the export preset (step 3). Your Dialogue is now part of your game: your code runs each of its scenes where and when it needs to.