Intro
Let's create a simple textbox for NPC dialogs to replace our ugly on-screen text.
Adding the textbox panel
We'll begin by creating a panel, with a group (just for better looks!) and a text element. The panel will be initially hidden, and the text will be empty:
Adding a typist for the text
In order to animate the actual text and make it look even nicer, we're adding the setTypist method, that allows us to assign a Scribble typist to the text that will animate it in a typewriter style. For this to work though, we need to create and configure that typist in the Create event of the Game controller. We will set the typist speed, and we'll assign a function on animation complete that, after 3 seconds, resets the typist and hides the panel (you can take a look at the official Scribble documentation to learn more):
| Game / Draw GUI | |
|---|---|
Creating a helper to set the text
Let's also create a helper method that sets the text. This will set the actual UIText's text value, it will also dynamically determine the width in order to resize the panel (and group) to the required size (note that getTextWidth is a method only available in 2025.11+) and it will set the panel as visible:
| Game / Draw GUI | |
|---|---|
Setting the textbox when the NPC talks
We're almost ready to make it work. We just need to modify the NPC's process_quest method to use the aforementioned method instead of its current message logic:
| obj_NPC / Create / process_quest method | |
|---|---|
| obj_NPC / Create / process_quest method | |
|---|---|
| obj_NPC / Create / process_quest method | |
|---|---|
The final result
With this simple code, we've created a fantastic looking textbox for our NPC!