From ZDoom Wiki
void Print(item(s));
Usage
Print will print something to the screen. This can be text or variables or any combination of the two. Note that Print is fairly inflexible (there's no way to modify the position on screen or the time the message stays up) so you're better off using HudMessage.
- Item syntax
- <cast type>:<expression>
The string can be built up of any number of these items, seperated by commas. The cast type is used to differentiate what type of data is being displayed. The table below shows the available options.
| cast type | description |
|---|---|
| a | character array |
| c | character |
| d | decimal number |
| f | fixed point number |
| i | decimal |
| k | prints the key(s) (up to 2) that the player has bound to the specified command. (Ex: k:"+use") |
| l | localized string from LANGUAGE |
| n | name of the thing (if expression is 0 then it prints the name of the activator, if expression is greater than 0 then it prints the name of the N-th player (one-based)). For things it prints a class name. |
| s | string |
The other special characters to note are escaped characters. A new line is started with \n. A backslash character is placed with \\, except there is no graphic for backslash by default in Doom.
Print will only display for the activator of the script, so if an enemy (or another player) activates a script with a Print statement in it then you won't see it. For printing to all players, see PrintBold.
Colors
You can add color to lines of text by using the "\cX" escape code. Replace X with the following letter to produce the desired color:
| code | color |
|---|---|
| a | reddish brick |
| b | tan |
| c | white |
| d | green |
| e | brown |
| f | gold |
| g | red |
| h | blue |
| i | orange |
| j | white |
| k | yellow |
| l | use original colors |
| m | black |
| n | light blue |
| o | cream |
| p | olive |
| q | dark green |
| r | dark red |
| s | dark brown |
| t | purple |
| u | dark gray |
The color will revert back to the default message color at the end of every line, therefore a "\cX" escape must be on every line where color is needed.
For example,
print(s:"\caThis is red, \chThis is blue\n\ccThis is white\nand this is the default color");
Would print
This is red, This is blue this is white and this is the default color
In the correct colors.
As of 2.1.5, you can use the new syntax "\c[colorname]", where colorname is a name of a color as defined in textcolors lump.
For example,
print(s:"\c[Green]This is green");
Would print
This is green
Examples
Some basic uses of print.
script 1 (void)
{
int x = 10;
Print(s:"This is a string"); //prints "This is a string"
Delay(35*5);
Print(d:x); //prints "10"
Delay(35*5);
Print(s:"This is x: ", d:x); //prints "This is x: 10"
Delay(35*5);
Print(s:"I need ", d:x, s:" shells"); //prints "I need 10 shells"
}
Another example of a (potentially) useful debugging script which continually updates the player on their current game coordinates:
script 1 ENTER
{
While(TRUE)
{
Print(f:GetActorX(0), s:" : ",
f:GetActorY(0));
Delay(10);
}
}
This example tells the user to press whatever key they have bound to +use:
script 1 (void)
{
print(s:"Press ", k:+use, s:" to use this ladder.");
}

