Difference between revisions of "MessageBox"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Stryfe
m (Stupid spelling mistake. Previous version specified number of buttons to 10.)
imported>JOG
(Added syntax for formating variable-output)
Line 1: Line 1:
== Description ==
'''Syntax:'''
'''Syntax:'''
  MessageBox "Message", [var1], ..., [var9], ["button01"], ..., ["button10"]
  MessageBox "Message", [var1], ..., [var9], ["button01"], ..., ["button10"]
Line 15: 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.


Formatting notation:


%.2f  
 
== Displaying Variables ==
 
===Formatting notation===
 
'''%.2f'''


This means format the variable with 2 decimal places.  
This means format the variable with 2 decimal places.  


%.0f  
 
'''%.0f'''


This will format the variable with 0 decimal places, so is the normal choice for integers.  
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 '%'
{|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)
===Examples===
'''Messagebox "Var1:% 5.2f / Var2:% 5.2f"'''
"Var1:  123.45 / Var1:  -123.45"
'''Messagebox "Var1:%05.2f / Var2:%05.2f"'''
"Var1: 00123.45 / Var1:-00123.45"
'''Messagebox "Var1:%+-5.0f / Var2:%+-5.0f"'''
"Var1:+123  / Var1:-123  "
'''Messagebox "Var1:% .3e / Var2:% .3e'''
"Var1: 1.234E+2 / Var2:-1.234E+2"


==See Also==  
==See Also==  

Revision as of 17:02, 7 May 2006

Description

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.


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

%d

This one works just like "%.0f", displaying 0 decimal places.


%.3e

Shows numbers in scientific formation (123000 = 1.23E+5)


Examples

Messagebox "Var1:% 5.2f / Var2:% 5.2f"

"Var1:   123.45 / Var1:  -123.45"

Messagebox "Var1:%05.2f / Var2:%05.2f"

"Var1: 00123.45 / Var1:-00123.45"

Messagebox "Var1:%+-5.0f / Var2:%+-5.0f"

"Var1:+123   / Var1:-123  "

Messagebox "Var1:% .3e / Var2:% .3e

"Var1: 1.234E+2 / Var2:-1.234E+2"


See Also

Message
GetButtonPressed