Difference between revisions of "Message"
imported>Bruneauinfo m (Added a better example using variables in a message.) |
imported>Bruneauinfo m (Slight mistake on new example formatting!) |
||
Line 12: | Line 12: | ||
'''Example:''' | '''Example:''' | ||
Message "There are % | Message "There are %.0f arrows and %.0f shields in the crate.", BowVar, ShiledVar, 10 | ||
Displays: There are 3 arrows and 6 shields in the crate. | Displays: There are 3 arrows and 6 shields in the crate. |
Revision as of 13:37, 13 December 2010
Description
Syntax:
Message "Message text", [var1], [var2], DisplaySeconds
Example:
Message "This is a Message" Message "You have %.0f hours to complete your task.", GameHour, 10
Displays a message on the screen.
Example:
Message "There are %.0f arrows and %.0f shields in the crate.", BowVar, ShiledVar, 10
Displays: There are 3 arrows and 6 shields in the crate.
Notes
- The DisplaySeconds parameter is supposed to set how long the message will be displayed for, and it must be an integer (or else the script will fail to compile, stating that it must be in integer), however testing seems to indicate that the parameter has absolutely no effect whatsoever on how long the message is actually displayed. If you have successfully set a message to display for longer or shorter than the default time, please mention it in the talk page!
- Up to 9 variable names can also be passed into the Message. These are displayed in the order they are used as parameters. The message must specify how the variable is to be displayed.
Displaying Variables
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
Formating switches
The following formatting switches can be used in Oblivion. 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 displays 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
Examples
Message "Var1:% 5.2f / Var2:% 5.2f" Var1 Var2
Displays: "Var1: 123.45 / Var2: -123.45"
Message "Var1:%05.2f / Var2:%05.2f" Var1 Var2
Displays: "Var1: 00123.45 / Var2:-00123.45"
Message "Var1:%+-5.0f / Var2:%+-5.0f" Var1 Var2
Displays: "Var1:+123 / Var2:-123 "
Message "Var1:% .3e / Var2:% .3e" Var1 Var2
Displays: "Var1: 1.234E+2 / Var2:-1.234E+2"
See Also
- MessageEx
- MessageBox
- PrintToConsole
- Message Spam for usage and preventing other messages from showing