Difference between revisions of "MessageBox"

1,172 bytes added ,  00:23, 8 August 2010
no edit summary
imported>Mmmpld
m (Max var changed from 10 to 9 based on testing)
imported>DragoonWraith
 
(26 intermediate revisions by 10 users not shown)
Line 1: Line 1:
== Description ==
'''Syntax:'''
'''Syntax:'''
  MessageBox "Message", [var1], [var2], ["button1"], ["button2"]  
  MessageBox "Message", [var1], ..., [var9], ["button01"], ..., ["button10"]
MessageBox "Message" [var1] ... [var9] ["button01"] ... ["button10"]
'''Example:'''
'''Example:'''
  MessageBox "This is a Message"  
  MessageBox "This is a Message"
  MessageBox "Shall I start to spin? GameHour = %.2f", GameHour, "OK", "No Way"  
  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.  
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.  


If no button is specified, a default button of "Done" will be displayed on the message box.  
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.  
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.


Formatting notation:
This function sends the value -1 to the GetButtonPressed function while the window is still open, until the player selects a button.


%.2f
==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.


This means format the variable with 2 decimal places.
== Displaying Variables ==
{{MessageFormatting}}
====Examples====


%.0f
MessageBox "Var1:% 5.2f / Var2:% 5.2f" Var1 Var2
Displays: '''"Var1:   123.45 / Var2:  -123.45"'''


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


[[Category: Functions]]
<!-- Begin Search Terms
[[Category: Miscellaneous Functions]]
message
box
End Search Terms -->