Difference between revisions of "MessageBox"

571 bytes removed ,  00:23, 8 August 2010
no edit summary
imported>JOG
m (→‎Other Functions: Added %%)
imported>DragoonWraith
 
(19 intermediate revisions by 8 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====


===Formatting notation===
MessageBox "Var1:% 5.2f / Var2:% 5.2f" Var1 Var2
Displays: '''"Var1:   123.45 / Var2:  -123.45"'''


'''%.2f'''  
MessageBox "Var1:%05.2f / Var2:%05.2f" Var1 Var2
Displays: '''"Var1: 00123.45 / Var2:-00123.45"'''


This means format the variable with 2 decimal places.  
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"'''


'''%.0f'''
==See Also==
 
* [[MessageBoxEX]]
This will format the variable with 0 decimal places, so is the normal choice for integers.
* [[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)]]


'''%5.0f'''
<!-- Begin Search Terms
 
  message
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:
  box
Number    12 wins
End Search Terms -->
Number  1234 wins
 
===Formating switches===
 
The following formatting switches can be used in Oblivion. Put them in any sequence right after the '%'
{|border="1" cellpadding="5" cellspacing="0"
|-
! style="background:#efefef;" | Switch
! style="background:#efefef;" | Function
|-
|<nowiki>+</nowiki>
|Display + in front of positive numbers
|-
|<nowiki><Space></nowiki>
|Leave a leading space in front of positive numbers
|-
|<nowiki>-</nowiki>
|Use left-aligned formation instead of right alligned.
|-
|<nowiki>0</nowiki>
|The filling-char used for formatting is '0' instead of ' '
|}
 
 
===Other Functions===
 
'''%d'''
 
This one works just like "%.0f", displaying 0 decimal places.
 
 
'''%.3e'''
 
Shows numbers in scientific formation (123000 = 1.23E+5)
 
 
'''%%'''
 
Use this to display a percent-sign in the messagebox
 
===Examples===
 
'''Messagebox "Var1:% 5.2f / Var2:% 5.2f"'''
  "Var1:  123.45 / Var2:  -123.45"
 
'''Messagebox "Var1:%05.2f / Var2:%05.2f"'''
  "Var1: 00123.45 / Var2:-00123.45"
 
'''Messagebox "Var1:%+-5.0f / Var2:%+-5.0f"'''
"Var1:+123  / Var2:-123  "
 
'''Messagebox "Var1:% .3e / Var2:% .3e'''
"Var1: 1.234E+2 / Var2:-1.234E+2"
 
 
==See Also==
[[Message]]<br>
[[GetButtonPressed]]
 
[[Category: Functions]]
[[Category: Miscellaneous Functions]]