Category: Messages
Since engine version: 1.0 OC


Displays a message.


bool CustomMessage(string message, object obj, int plr, int offset_x, int offset_y, int color, id deco, proplist portrait, int flags, int width);


Message to be displayed
[opt] If not nil, the message is displayed above the specified object.
[opt] Player number for which the message should be displayed. Defaults to NO_OWNER which will display the message globally.
[opt] x offset of the message position. For global messages this refers to the viewport center. For object messages this is relative to the standard message position above the object. For portrait messages (portrait!=0) the offset is relative to the upper left viewport corner.
[opt] y offset of the message position.
[opt] Color of the message. Default is 0xffffff (white).
[opt] ID of the object definition which is used for decoration of the message. If given the message will be surrounded by a border. Only valid for given portrait.
[opt] Definition, object or image specification prop list to take the graphics from as a portrait.
Image specification prop lists can contain the following members:
Property Description
Source Definition to draw graphics of.
Name Name of graphics to draw from definition. Can be used to show a message e.g. of a skinned clonk. Default graphics are used if not specified.
Color Color in which ColorByOwner surfaces of definition are drawn.
[opt] Bit mask specifying additional options. Possible values:
Bit Constant Description
0 MSG_NoBreak If set no automatic line breaks are inserted for long messages.
1 MSG_Bottom Global messages only. For portrait messages with decoration frame: The message offset specifies the displacement relative to the bottom of the screen instead of relative to the top. For non-portrait messages the flag displaces the message a bit to the bottom.
2 MSG_Multiple If set previous messages of the same type will not be removed.
3 MSG_Top Similar to MSG_Bottom. The y-offset is relative to the top of the viewport.
4 MSG_Left Similar to MSG_Bottom. The y-offset is relative to the left of the viewport.
5 MSG_Right Similar to MSG_Bottom. The y-offset is relative to the right of the viewport and the text is aligned to the right.
6 MSG_HCenter Similar to MSG_Bottom. The x-offset is relative to the center of the viewport.
7 MSG_VCenter Similar to MSG_Bottom. The y-offset is relative to the center of the viewport.
8 MSG_DropSpeech Currently not supported.
9 MSG_WidthRel The message width is a percentage of the viewport (0-100).
10 MSG_XRel The x-offset is a percentage of the viewport (0-100).
11 MSG_YRel The y-offset is a percentage of the viewport (0-100).
12 MSG_Zoom The message will be affected by ingame zoom.
[opt] Width of the message. The unit is pixels if MSG_WidthRel is not set as a flag.


This function unifies the functionalities of Message and PlayerMessage and offers additional options. To be able to add more parameters in future without having to define a new function it intentionally does not have additionaly format parameters. Instead they can be used via the function Format.
The usual message formating rules apply. If the message starts with an "@" then the message is displayed permanently until it is replaced by another message. The character "|" causes a line break. The message can be formatted using the tags <i> (italic) or <c> (colored).
Messages are displayed until a certain time which depends on the length of the message has passed, or the message is replaced by another message of the same class. A global message (i.e. obj=0) replaces all other global messages, and an object message (obj!=0) replaces all other object messages. To display multiple messages of the same class the flag MSG_Multiple can be used.


CustomMessage("This is <i>madness</i>!",nil,0);
Shows the message "This is madness!" for player 0 only with the word "madness" being written in italic.
CustomMessage("<c ffff00>Tonki:</c> Hello, world", nil, NO_OWNER, 100,100, 0, GUI_MenuDeco, Clonk);
Displays a message with a decoration frame. The name Tonki is colored yellow. On the left hand side of the message a clonk picture will be shown. The decoration definition GUI_MenuDeco needs to be loaded.
See also: Message, PlayerMessage
Sven2, 2008-07