Skip to content

Creating a TextBox

Ji-Rath edited this page Sep 17, 2020 · 9 revisions

Creating a textbox will allow you to create a textbox with the specified text and portrait.


The first thing is understanding the format. Using the example below as a reference will help with readability.

  • The first line is to show what is displayed to the player, enclosed in quotes.
  • Next, TextInitial is used to define the initial values of the textbox.
  • Finally, TextExt is used for special effects such as running scripts, changing the color of the text, and even speed.

Example

var Text = "", TextInitial, TextExt = [], Line = 0;

Text[Line] = "Hey its a %ccrab";
TextInitial[Line] = new TextInit(0.05, c_black, 0, oDog);
TextExt[Line] = [c_red];

As you may have noticed, there is a strange '%c' in the middle of a seemingly normal text. In this case, it is used to change the color of the text of 'crab' to red. We know it is changing to red because of what is in the TextExt array. Next is understanding the 'new TextInit()' section. In summary, it is an array but with better structuring. For example, the format for it would be

new TextInit(TextSpeed, Color, AutoNext, Speaker);

NOTE: The speaker of the text box must have the following variables in order to function properly!

//Textbox variables
Voice				= sndSelect;
Font				= fnt_dialogue;
Name				= "OldMan";

Current special formats possible:

  • '%f' - Text Speed
  • '%c' - Text Color
  • '%s' - Script

Example

var Text = "", TextInitial, TextExt = [], Line = 0;

Text[Line] = "Hey its a crab";
TextInitial[Line] = new TextInit(0.05, c_black, 0, oDog);
TextExt[Line] = [];

Line++;
Text[Line] = "%slook ok we get it, u were bullied as a kid, %fi really dont %ccare";
TextInitial[Line] = new TextInit(0.05, c_red, 0, oCrab);
TextExt[Line] = [[show_debug_message, "test!"],0.1, c_green];

TextBoxExample


That is it. To execute the textbox, create a textbox using the 'CreateTextEvent()' script and insert the 3 arguments. In addition, the same can be done in cutscenes when you want a text event, except you would use scrCutSceneTextBox().

Example

CreateTextEvent(Text, TextInit, TextExt);

Clone this wiki locally