MessageBoxExAlt

From GECK
Jump to: navigation, search


A function added by the JIP NVSE Plugin.

Description

An improved version of the NVSE function MessageBoxEx.

  • Does not require using GetButtonPressed for message boxes with multiple buttons, but instead passes the selected button index via a UDF script, which is invoked when a button is pressed.
  • Allows up to 255 buttons (instead of 10 max).
  • Allows setting the message box title (optional). The title text must be passed at the beginning of the formatted string, enclosed by circumflexes: ^title^ (see example, below).

The function takes two(+) arguments:

  • callbackScript - A UDF Script (as explained above. Also see example script, below).
  • msgStrings - A formatted string containing the message box title, text and buttons (all optional). Up to 20 variables may be passed for format specifiers.

Syntax

[help]
MessageBoxExAlt callbackScript:ref msgStrings:formattedString formatVars(up to 20)

Example

MessageBoxExAlt MsgButtonPressUDF "^Awesome Menu^Select an option:|Option #1|Option #2|Option #3|Option #4|Option #5"

Will display the message box shown below:

MessageBoxExAlt.jpg

Callback Script

A skeleton script for a callback:

scn	MsgButtonPressUDF

int	iButton

begin Function {iButton}

(code)

end

Notes

  • Clicking a button returns it's integer value, it is 0 based.
  • In the example above:
    • Option #1 will set iButton to 0
    • Option #2 will set iButton to 1

See Also