Difference between revisions of "MessageBox"
imported>Haama |
imported>DragoonWraith |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 16: | Line 16: | ||
This function sends the value -1 to the GetButtonPressed function while the window is still open, until the player selects a button. | This function sends the value -1 to the GetButtonPressed function while the window is still open, until the player selects a button. | ||
==Notes== | |||
*For info on how to create working menus see [[MessageBox Tutorial]]. | |||
*When creating menus for mods it can be helpful to standardize how information and choices are displayed. See [[Standard Menu UI]] for some helpful suggestions. | |||
== Displaying Variables == | == Displaying Variables == | ||
{{ | {{MessageFormatting}} | ||
====Examples==== | |||
===Examples=== | |||
MessageBox "Var1:% 5.2f / Var2:% 5.2f" Var1 Var2 | MessageBox "Var1:% 5.2f / Var2:% 5.2f" Var1 Var2 | ||
'''"Var1: 123.45 / Var2: -123.45"''' | Displays: '''"Var1: 123.45 / Var2: -123.45"''' | ||
MessageBox "Var1:%05.2f / Var2:%05.2f" Var1 Var2 | MessageBox "Var1:%05.2f / Var2:%05.2f" Var1 Var2 | ||
'''"Var1: 00123.45 / Var2:-00123.45"''' | Displays: '''"Var1: 00123.45 / Var2:-00123.45"''' | ||
MessageBox "Var1:%+-5.0f / Var2:%+-5.0f" Var1 Var2 | MessageBox "Var1:%+-5.0f / Var2:%+-5.0f" Var1 Var2 | ||
'''"Var1:+123 / Var2:-123 "''' | Displays: '''"Var1:+123 / Var2:-123 "''' | ||
MessageBox "Var1:% .3e / Var2:% .3e" Var1 Var2 | MessageBox "Var1:% .3e / Var2:% .3e" Var1 Var2 | ||
'''"Var1: 1.234E+2 / Var2:-1.234E+2"''' | Displays: '''"Var1: 1.234E+2 / Var2:-1.234E+2"''' | ||
==See Also== | ==See Also== | ||
[[Message]] | * [[MessageBoxEX]] | ||
[[GetButtonPressed]] | * [[Message]] | ||
* [[MessageEx]] | |||
* [[PrintToConsole]] | |||
* [[GetButtonPressed]] | |||
* [[MessageBox Tutorial]] | |||
* [[Standard Menu UI]] | |||
[[Category:Functions]] | |||
[[Category:Functions (CS)]] | |||
[[Category:Functions (CS 1.0)]] | |||
[[Category:Output Functions]] | |||
[[Category:Output Functions (CS 1.0)]] | |||
<!-- Begin Search Terms | |||
message | |||
box | |||
End Search Terms --> |
Latest revision as of 23:23, 7 August 2010
Description[edit | edit source]
Syntax:
MessageBox "Message", [var1], ..., [var9], ["button01"], ..., ["button10"] MessageBox "Message" [var1] ... [var9] ["button01"] ... ["button10"]
Example:
MessageBox "This is a Message" MessageBox "Shall I start to spin? GameHour = %.2f", GameHour, "OK", "No Way" MessageBox "How much gold do you have?" "0" "100" "500" "1000" "5000" "10000"
Displays a message on the screen, which can be formatted, as well as user-definable buttons that the player can choose. The message box stops time and displays itself in the center of the screen until the player chooses an option. This option can be captured in a script by using the GetButtonPressed function.
Up to 10 buttons may be specified. If no button is specified, a default button of "Done" will be displayed on the message box.
Up to 9 variable names can also be passed into the message box. These are displayed in the order they are used as parameters. The message must specify how the variable is to be displayed.
This function sends the value -1 to the GetButtonPressed function while the window is still open, until the player selects a button.
Notes[edit | edit source]
- For info on how to create working menus see MessageBox Tutorial.
- When creating menus for mods it can be helpful to standardize how information and choices are displayed. See Standard Menu UI for some helpful suggestions.
Displaying Variables[edit | edit source]
Formatting notation[edit source]
%.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[edit source]
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[edit source]
%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[edit | edit source]
MessageBox "Var1:% 5.2f / Var2:% 5.2f" Var1 Var2
Displays: "Var1: 123.45 / Var2: -123.45"
MessageBox "Var1:%05.2f / Var2:%05.2f" Var1 Var2
Displays: "Var1: 00123.45 / Var2:-00123.45"
MessageBox "Var1:%+-5.0f / Var2:%+-5.0f" Var1 Var2
Displays: "Var1:+123 / Var2:-123 "
MessageBox "Var1:% .3e / Var2:% .3e" Var1 Var2
Displays: "Var1: 1.234E+2 / Var2:-1.234E+2"
See Also[edit | edit source]