You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By clicking the `Create New Extension` button, you can set up an extension folder and a custom event script. Enter a name for the new module and select what you would like to add. Then click `Create`.
31
+
By clicking the `Create New Extension` button, you can set up an extension folder and a custom event script. Enter a name for the new module and select what you would like to add. Then click `Create`. This should create a folder inside your extensions folder with two scripts: `index.gd` and `event_(module name here).gd`.
32
32
33
33
```admonish warning
34
34
Existing files will be overwritten!
35
35
```
36
36
37
37
---
38
38
39
-
##2. The essential part: `index.gd`
39
+
# 2. The essential part: `index.gd`
40
40
41
41
The central piece of any extension is the `index.gd` script. It is the only thing your extension is required to have. It has to extend `DialogicIndexer` and can overwrite that class's methods to let Dialogic know what things to add.
42
+
42
43
For example, this code registers a custom event:
43
44
44
45
```gdscript
@@ -64,16 +65,16 @@ The Extension Creator allows you to get a basic event script. It has already set
64
65
65
66
These are the things you need to do to make your event fully functional:
66
67
67
-
#### 1. Event settings:
68
+
###3.1 Event settings/parameters/properties:
68
69
69
-
All options for your event should be stored in variables. Define these at the top.
70
+
All options for your event (i.e. parameters you can "pass" to your event) should be stored in variables. Define these at the top.
70
71
71
72
```gdscript
72
73
var print_text: String = ""
73
74
var in_game: bool = false
74
75
```
75
76
76
-
####3.1 Execution code:
77
+
### 3.2 Execution code:
77
78
78
79
Add whatever should happen when your event is reached in the `_execute()` method:
79
80
@@ -89,7 +90,7 @@ func _execute() -> void:
89
90
90
91
*The `finish()` method lets Dialogic know to continue with the next event.*
91
92
92
-
####3.2 General settings:
93
+
### 3.3 General settings:
93
94
94
95
In the `_init()` method, you can set some base settings of your event:
95
96
@@ -100,7 +101,7 @@ func _init() -> void:
100
101
event_category = "Godot"
101
102
```
102
103
103
-
####3.3 Saving & Loading
104
+
### 3.4 Saving & Loading (i.e. parsing, representation in timeline's text editor)
104
105
105
106
We will cover working with shortcodes now. They are pretty much the text view of an event inside the timeline.
106
107
The following is the shortcode for the Background event.
*The above event might be saved as `[print text="Some text to print" in_game="true"]`*
126
127
127
-
### 3.34 My Variables are not changing
128
+
####3.4.1 Troubleshooting
128
129
129
130
If your variables are not changing despite setting values in your custom event in the timeline editor, here is a little checklist:
130
131
@@ -150,16 +151,17 @@ If your variables are not changing despite setting values in your custom event i
150
151
151
152
After all of these values match, the visual and text modes will both change the variables in your event, and you can access them in the `_execute`.
152
153
154
+
#### 3.4.2 Custom Saving & Loading Syntax
153
155
154
-
## 4.1 Custom Saving & Loading Syntax
155
-
156
-
You can implement custom saving syntax by overriding the function `to_text() -> String` and `from_text(timeline_event: String)`.
156
+
You can also implement custom saving syntax by overriding the function `to_text() -> String` and `from_text(timeline_event: String)`.
157
157
The `is_valid_event(event_name: String) -> bool` needs to be override too, if you want to quickly check if the event name is correct.
158
158
159
159
When is custom saving and loading useful? If your shortcode has a special text syntax or is converting between values, map a word to an integer.
160
160
This is what the text-, character-, choice-, condition-, and variable events do, so take a look at them if this is something you are interested in.
161
+
A good example of this is the Comment event, which you can find under `addons/dialogic/modules/comment`.
162
+
161
163
162
-
#### 5. Editor fields:
164
+
###3.5 Visual Editor fields:
163
165
164
166
Your event is now fully functional, but in the visual editor, it is still blank. You will need to override the `build_event_editor()` method to define the fields/texts that will appear on the event.
If you would like to learn more about events, I strongly suggest looking at the built-in events.
175
177
178
+
#### 3.5.1 Troubleshooting
179
+
180
+
If your custom event does not show up in the visual editor, but functions when written in the text editor, considering restarting Godot for changes to take hold.
181
+
176
182
---
177
183
178
-
# 5. Custom Subsystems
184
+
# 4. Custom Subsystems
179
185
180
186
## What is a subsystem?
181
187
@@ -198,7 +204,7 @@ If you want to save persistent data, store it in the `Dialogic.current_state_inf
198
204
199
205
---
200
206
201
-
# 6. Custom animations
207
+
# 5. Custom animations
202
208
203
209
## What is an animation?
204
210
@@ -254,7 +260,7 @@ Importantly, the name of your animation file will determine if it is a Join, Lea
254
260
255
261
---
256
262
257
-
# 7. Custom dialogic nodes
263
+
# 6. Custom dialogic nodes
258
264
259
265
## What are dialogic nodes?
260
266
@@ -265,7 +271,7 @@ They are generally managed by a subsystem and are found because they are automat
265
271
266
272
---
267
273
268
-
# 8. Custom Settings Pages
274
+
# 7. Custom Settings Pages
269
275
270
276
An extension might want to add a dialogic settings editor. This is just a UI scene that has a script inheriting `DialogicSettingsPage`.
0 commit comments