The SkyMessage script is a part of Skyrim SE’s Papyrus scripting ecosystem. This script is not present in the vanilla game, but can be found in modded sources like Papyrus MessageBox (MessageBox).
For this script, the Papyrus index knows about:
- 8 functions
Inheritance Tree
No indexed scripts extend this script.
Properties
No properties found.
Events
No events found.
Functions
- Found in:
- MessageBox
VS Code has a bug where the documentation of the first function isn't shown.
This is that function:- Found in:
- MessageBox
stringfunctionShow(stringbodyText, stringbutton1, stringbutton2="", stringbutton3="", stringbutton4="", stringbutton5="", stringbutton6="", stringbutton7="", stringbutton8="", stringbutton9="", stringbutton10="", boolgetIndex=false, floatwaitInterval=0.1, floattimeoutSeconds=0.0)GlobalOpen a messagebox and return the name of the selected button.
Get name of selected button
string selectedButtonName = SkyMessage.Show("body text of message", "Ok", "Cancel", "More buttons...")Get index of selected button
If you would prefer to get the
intindex of the button:string selectedButtonIndex = SkyMessage.Show("body text of message", "Ok", "Cancel", "More buttons...", getIndex = true)Button names
Show()accepts up to 10 button names. If you would prefer to specify the button names via an array, see:SkyMessage.ShowArray()Advanced
You can also specify a timeout. This is the number of seconds after which the function will return with the text "TIMED_OUT":
string selectedButtonName = SkyMessage.Show("body text of message", "Ok", "Cancel", "More buttons...", timeoutSeconds = 69.0)- Found in:
- MessageBox
stringfunctionShowArray(stringbodyText, string[]buttons, boolgetIndex=false, floatwaitInterval=0.1, floattimeoutSeconds=0.0)GlobalOpen a messagebox and return the name of the selected button, given a string array of button names.
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"Get name of selected button
string selectedButtonName = SkyMessage.Show("body text of message", buttons)Get index of selected button
If you would prefer to get the
intindex of the button:string selectedButtonIndex = SkyMessage.Show("body text of message", buttons, getIndex = true)Advanced
You can also specify a timeout. This is the number of seconds after which the function will return with the text "TIMED_OUT":
string selectedButtonName = SkyMessage.Show("body text of message", buttons, timeoutSeconds = 69.0)- Found in:
- MessageBox
intfunctionShow_NonBlocking(stringbodyText, stringbutton1, stringbutton2="", stringbutton3="", stringbutton4="", stringbutton5="", stringbutton6="", stringbutton7="", stringbutton8="", stringbutton9="", stringbutton10="")NativeGlobalThis 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:Example
int messageBoxId = SkyrMessage.Show_NonBlocking("body text", "button 1", "button 2", ...) while ! SkyMessage.IsMessageResultAvailable(messageBoxId) Utility.WaitMenuMode(1.0) endWhileOnce
IsMessageResultAvailablereturns true, you can then find out which option the player selected viaGetResultText()orGetResultIndex()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()orGetResultIndex(), themessageBoxIdwill become invalid, so you cannot get BOTH the index and the text. Unless you usedeleteResultOnAccess = 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
messageBoxIdwithout getting the result, you can callSkyMessage.Delete(messageBoxId)- Found in:
- MessageBox
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) endWhileOnce
IsMessageResultAvailablereturns true, you can then find out which option the player selected viaGetResultText()orGetResultIndex()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()orGetResultIndex(), themessageBoxIdwill become invalid, so you cannot get BOTH the index and the text. Unless you usedeleteResultOnAccess = 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
messageBoxIdwithout getting the result, you can callSkyMessage.Delete(messageBoxId)- Found in:
- MessageBox
Returns the result text from a message box created using
Show_NonBlocking()orShowArray_NonBlocking()If
IsMessageResultAvailableisfalseor the messageBoxId is invalid, this returns""
else it returns the name of the button which was selected.Note: calling this function cleans up the stored messageBox and it will no longer be available
unless you passdeleteResultOnAccess = false- Found in:
- MessageBox
Returns the result index from a message box created using
Show_NonBlocking()orShowArray_NonBlocking()If
IsMessageResultAvailableisfalseor the messageBoxId is invalid, this returns-1
else it returns theintindex of the button which was selected.Note: calling this function cleans up the stored messageBox and it will no longer be available
unless you passdeleteResultOnAccess = false- Found in:
- MessageBox
Returns true if a messagebox created via
Show_NonBlocking()orShowArray_NonBlocking()has had a button selected.
Returns false in all other scenarios.
