ShowMessage

Revision as of 21:17, 12 April 2009 by imported>Cipscis (Undo revision 13936 by Rlilewis (Talk))

Description

ShowMessage is used to display messages to the player. The message itself is an editor object that contains all the data: display text, type of message, buttons.

Syntax

ShowMessage MessageID, [var1], ..., [var9] sDuration

Notes

  • This command replaces the "Message" and "MessageBox" functions of Oblivion and Morrowind.
  • Buttons are part of the Message form. If no buttons are specified on a MessageBox type message, a default "OK" button will be displayed.
  • Message Type on the Message determines whether we are displaying a "message" (upper right corner, single line of text, doesn't interrupt the game) or a "message box" (center of the screen, game stops until the player presses one of the buttons).
  • Variables can be inserted into the displayed text (see below). The message will fail to display if the wrong number of variables are passed into the ShowMessage call.
  • Variables cannot be inserted into a message box's buttons.
  • The "sDuration" parameter doesn't actually do anything

Formatting messages

Variable parameters can be used in conjunction with a Message in order to insert variables into the displayed text.

  • Use the formatting notation below in the text of the Message.
  • The number of parameters called by ShowMessage must match the number of variables the message is expecting.

Formatting notation

%.2f - This means format the variable with 2 decimal places.

%.0f - This will format the variable with 0 decimal places, so is the normal choice for integers.

%5.0f - The number in front of the point specifies the minimum width of the number. In this case, there will always be enough space in front of the number for 5 digits:

Number    12 wins
Number  1234 wins

Formatting switches

The following formatting switches can be used in Messages. Put them in any sequence right after the '%'

Switch Function
+ Display + in front of positive numbers
<Space> Leave a leading space in front of positive numbers
- Use left-aligned formation instead of right alligned.
0 The filling-char used for formatting is '0' instead of ' '

Other Functions

%g - This usually works just like "%.0f", displaying 0 decimal places. When the number is 1000000 or larger, though, the game diplays it in scientific notation (1E+006)

%.3e - Shows numbers in scientific notation (123000 = 1.23E+005)

%% - Use this to display a percent-sign in the message

See Also