script command: Textbox

What this does
This command displays a textbox which is used when characters speak. In the game, the text will quickly appear letter by letter. You can preview this effect in the editor with the play button.

Textboxes have quite a few features. You can drag the textbox itself to where you want it to appear on the screen.
Special codes can be added to the text to alter the way it gets displayed. You can display a face image. The textbox's border can be altered. A sound effect can be played as the letters are displayed. And if you've created your own textbox, then you can specify the SWF file to use.

Editing text
On the right, type your text into the message box, and you'll instantly see how it'll appear in the preview. You can also display the values of variables by typing their names in [] brackets.

Special codes
You can type in special codes along with your text to change the way it displays. Incidentally, you can also type basic HTML codes because of the way Flash handles the text. So you could theoretically embed pictures and links in the middle of your text if you really wanted to. Click the play button to preview the timing and see how the text will type out.

\l (letter L)
Left Alignment. This makes the text appear on the left side of the textbox. This is the default behavior.

\m
Middle Alignment. This centers the text. You can only alter the alignment once per line.

\r
Right Alignment. This makes the text appear on the right side of the textbox. It tends to look a little weird in the game because the text appears letter by letter.

\s0
Typing Speed. This controls how fast the letters appear in the game. The higher the number, the slower is goes. A speed of 0 will make everthing display instantly. The normal speed is 1.
\2
Pause. This will make the typing pause for a brief moment. The higher the number the longer the pause.

\!
Wait For Click. This makes the text pause until the player clicks the mouse or presses the spacebar.


\#ff0022
Text Color. This changes the color of the text after this code. The color is specified by a 6-digit hexadecimal number in Red-Green-Blue format, just like in webpages. In this example, the ff controls how much red the color has, the 00 controls how much green there is, and the 22 controls how much blue. The combination of these three values can create any color.

\##
Default Color. This makes all the text after this code appear in the regular text color.

Face image
A face image is a 48x48 image that can be displayed to the left of the text. It can be a picture or a SWF file. If you use a SWF file, the image can be animated. If not picture is specified, the text will fill the entire width of the textbox.

Background image
The path you enter here refers to an image file, which controls how the textbox looks. The image must be 32x32 pixels. The borders are 8 pixels thick. And the center pattern is 16x16. The borders and pattern repeat to fill the needed areas. Alpha channels are supported.

Typing sound
You can enter a path to an MP3 file to use. This sound effect will play as text is typed out. The timing tends to be a little off, however.  

Textbox SWF
This is for you Flash programmers out there! If you want to use your own textbox, just type the path to its SWF file here. This script commnd will load it and pass these variables to it. Whether you use them or not is up to you.

text
This contains the exact text typed into the "message" box in the editor. If you want to use codes, it'll be up to your textbox to interpret them. Of course, you don't have to use codes at all.

_y
This is the vertical position of the textbox on the screen.

face
This is the path to the image to display as the face graphic.

background
This is the path to the image to use for the textbox's border and background.
typingSound
This is the path to the sound effect to play while typing.

closeOnClick = true
Always set to true. This tells the textbox to close when the player clicks the mouse.

closeOnSpace = true
Always set to true. This tells the textbox to close when you press the spacebar.

skipKey = 16
Always set to 16, which is the keyCode for the shift key. This tells the textbox to insatnt-display the text when the player presses the shift key.

typeDelay = 1
Always set to 1. This is the default typing speed.

Last updated: August 27, 2011