Guide:Internal scripting/Text box construction

This guide explains exactly how text boxes can be constructed, and tweaked, in internal scripting.

The basics (showing and removing, color, position, sound)
This is the most basic version of a text box: text(player,50,60,1) This is some text! speak_active

This creates a cyan-colored text box 50 pixels from the left and 60 pixels from the top, with 1 line. The  command just stores the text and position in memory, but doesn't display it yet; when you're finished, use   to actually display it. The color can be /  (it doesn't matter which of the two you use),   (or anything that doesn't exist), ,  ,  ,  ,  ,   or.

But it'd be nice if we could position it above the player or in the center, instead of at some coordinates... text(player,0,0,1) This is some text! position(player,above) speak_active text(gray,0,0,1) This is a terminal text box! position(center) speak_active

The  command replaces the coordinates that are given in the   command, and there are different combinations possible, such as ,  ,  , et cetera. There are also  and , for only centering on the X and Y axis respectively. (You can then also, for example, set a numeric coordinate in the  command, and then override only the X axis.)

How about the sound that someone/a terminal makes when a text box appears? There's the  command for that: squeak(player) text(player,0,0,1) This is some text! position(player,above) speak_active squeak(terminal) text(gray,0,0,1) This is a terminal text box! position(center) speak_active

This combination of commands is by far the most commonly used for text boxes.

But the last text box will not go away! squeak(player) text(player,0,0,1) This is some text! position(player,above) speak_active squeak(terminal) text(gray,0,0,1) This is a terminal text box! position(center) speak_active endtext

The  command should be used to dismiss text boxes before any kind of delay and before ending the script, basically whenever it isn't followed by another text box.

That's basically everything you need to know to get started, but there's more advanced stuff that you can use.

Multiple text boxes
removes old text boxes that were already on the screen, but you can avoid that by using  instead of  : squeak(player) text(player,0,0,1) This is some text! position(player,above) speak_active squeak(terminal) text(gray,0,0,2) The previous text box is still on the screen now! position(center) speak endtext

In other words,  simply displays a text box, while   displays a text box and removes all previous text boxes.

You can even make multiple text boxes appear at once. Normally  and   wait until you press the action key before the script continues, but not if you put   before it: squeak(player) text(player,0,0,1) This is some text! position(player,above) backgroundtext speak_active squeak(terminal) text(gray,0,0,2) Two text boxes at the same time! position(center) speak endtext

The same example with three text boxes that will appear at the same time: squeak(player) text(player,0,0,1) This is some text! position(player,above) backgroundtext speak_active squeak(player) text(player,0,0,1) This is more text! position(player,below) backgroundtext speak squeak(terminal) text(gray,0,0,2) Three text boxes at the same time! position(center) speak endtext

No text box fadeout
Sometimes you may want to remove a text box immediately without fading it out. For that,  exists, you can just use it instead of.

Flip mode positioning
There's a command  that will correct text box positions in flip mode (for if you have a terminal that puts multiple text boxes on the screen). Level creators usually don't use this command in custom levels. It also didn't work properly before VVVVVV 2.3.

Removing all but the last text box
There's also a command, which removes all text boxes from the screen except for the last one. is actually a combination of  and , so   doesn't really have much use (unless you want to show multiple text boxes and then, after a delay, only leave the last one).

Centering via coordinates
There's also a hidden way of centering a text box without using / /  that was especially useful when needing to maintain compatibility with 2.0, which is to write -500 for x and/or y coordinates. It saves a line, but it makes the script a bit less readable.

Unusual colors
There's a trick that allows you to access a couple more colors for text boxes.

(TODO: include that trick on this page instead of linking)

The End
Apart from the  command (which probably doesn't have a use in player levels at all), that should be everything there is to know about text boxes in internal scripting!