Background for Skyrim SE
Member of the SkyMessage script
intfunctionShowArray_NonBlocking(stringbodyText, string[]buttons)NativeGlobal

Description

Documentation Comment

This created a messagebox, displays it, and returns immediately (while the message is still being displayed on the screen)

To discover when the player has selected an option, you are expected to 'poll' using the function IsMessageResultAvailable:

Useful for when you are not hard-coding the names of the buttons!

Button names

Any string array should work for button names.

string[] buttons = new string[2]
buttons[0] = "Ok"
buttons[1] = "Cancel"

Example

int messageBoxId = SkyrMessage.Show_NonBlocking("body text", buttons)
while ! SkyMessage.IsMessageResultAvailable(messageBoxId)
  Utility.WaitMenuMode(1.0)
endWhile

Once IsMessageResultAvailable returns true, you can then find out which option the player selected via GetResultText() or GetResultIndex()

Get name of selected button

string buttonName = SkyMessage.GetResultText(messageboxId)

Get index of selected button

string buttonIndex = SkyMessage.GetResultIndex(messageboxId)

Gotcha!

After calling either GetResultText() or GetResultIndex(), the messageBoxId will become invalid, so you cannot get BOTH the index and the text. Unless you use deleteResultOnAccess = false

; Get the index -but- keep the messageBoxId valid!
string buttonIndex = SkyMessage.GetResultIndex(messageboxId, deleteResultOnAccess = false)

; So now you can get the name as well
string buttonName = SkyMessage.GetResultText(messageboxId)

If you ever have a reason to delete the messageBoxId without getting the result, you can call SkyMessage.Delete(messageBoxId)


Parameters

  1. stringbodyText

  2. string[]buttons


Examples

Auto-Generated Example

string myString__bodyText
string[] myStringArray__buttons

int returnedValue = SkyMessage.ShowArray_NonBlocking(myString__bodyText, myStringArray__buttons)
Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.