Skip to content

UI

Namespace

UI

The UI scripting namespace contains functions for interacting with and displaying anything UI related.

Constants

Name Value
MB_ICON_INFO 0
MB_ICON_QUESTION 1
MB_ICON_WARNING 2
MB_ICON_ERROR 3

Functions

Overview

Message Boxes

MessageBox(title, message, [icon]) MessageBoxExt(title, message, detail) PromptString(title, message, defaultValue) -> string PromptNumber(title, message, defaultValue, min, max) -> integer PromptYesNo(title, message) -> boolean

File Dialogs

PromptOpenFile(title, extensions, filename) -> string PromptOpenFiles(title, extensions) -> string[] PromptSaveFile(title, extensions, [defaultFilename]) -> string PromptSaveFiles(title, extensions) -> string, string

Splash Window

ShowSplash(message, [showProgress]) HideSplash() UpdateSplash() SplashProgress() -> float SetSplashMessage(message) SetSplashProgressMessage(message) SetSplashProgress(progress)


MessageBox

Shows a simple message dialog.

Parameters

  • title (string): The dialog caption
  • message (string): The message to display
  • [icon] (integer): The icon to display on the message box, see the MB_ICON_ constants above. Default is MB_ICON_INFO

MessageBoxExt

Shows an extended message box with an extra scrollable text box displaying detail.

Parameters

  • title (string): The dialog caption
  • message (string): The message to display
  • detail (string): The detailed message to display

PromptString

Shows a dialog prompt for the user to enter a string value.

Parameters

  • title (string): The dialog caption
  • message (string): The message to display
  • defaultValue (string): The initial default value

Returns

  • string: The text entered by the user

PromptNumber

Shows a dialog prompt for the user to enter a numeric value.

Parameters

  • title (string): The dialog caption
  • message (string): The message to display
  • defaultValue (integer): The initial default value
  • min (integer): The minimum value allowed
  • max (integer): The maximum value allowed

Returns

  • integer: The number entered by the user

PromptYesNo

Shows a dialog prompt with 'Yes' and 'No' buttons.

Parameters

  • title (string): The dialog caption
  • message (string): The message to display

Returns

  • boolean: true if the user clicked 'Yes'

PromptOpenFile

Shows a file browser dialog allowing the user to select a file to open.

Parameters

  • title (string): The dialog caption
  • extensions (string): A formatted list of selectable file extensions (see description for format)
  • filename (string): The name of the file to browse for

Returns

  • string: The full path to the selected file, or an empty string if none selected

Notes

The extensions parameter must be in the following format:

[Type Name 1]|[Extension 1]|[Type Name 2]|[Extension 2]|...

Where Type Name X is the name to display in the type selection dropdown, and Extension is the wildcard file extension for that type. For an example see below.

Example

local path = UI.PromptOpenFile('Select a File', 'Wad Files (*.wad)|*.wad|All Files|*.*', '')
App.LogMessage('Selected file ' .. path)

PromptOpenFiles

Shows a file browser dialog allowing the user to select multiple files to open.

Parameters

  • title (string): The dialog caption
  • extensions (string): A formatted list of selectable file extensions

Returns

  • string[]: An array of full paths to the selected files

Notes

See PromptOpenFile above for the formatting of the extensions parameter.


PromptSaveFile

Shows a file browser dialog allowing the user to select a path+filename to save a single file to.

Parameters

  • title (string): The dialog caption
  • extensions (string): A formatted list of selectable file extensions
  • [defaultFilename] (string): The default name to put in the browser dialog 'file name' text box. Default is ""

Returns

  • string: The full selected path, or an empty string if the dialog was cancelled

Notes

See PromptOpenFile above for the formatting of the extensions parameter.


PromptSaveFiles

Shows a file browser dialog allowing the user to select a path to save multiple files to.

Parameters

  • title (string): The dialog caption
  • extensions (string): A formatted list of selectable file extensions

Returns

  • string: The directory path to save the files to
  • string: The file extension that was selected (not the full wildcard, just the extension - eg. wad or *)

Notes

See PromptOpenFile above for the formatting of the extensions parameter.


ShowSplash

Shows the splash window with message.

Parameters

Example

-- Show with no progress bar
UI.ShowSplash('This is a splash window message')

-- Show with progress bar
UI.ShowSplash('Doing some things...', true)

HideSplash

Hides the splash window if it is currently showing.


UpdateSplash

Updates and redraws the splash window.


SplashProgress

Returns

  • float: The current progress bar progress. This is a floating point number between 0.0 (empty) and 1.0 (full)

SetSplashMessage

Sets the splash window message.

Parameters

  • message (string): The message to show

SetSplashProgressMessage

Sets the small message within the progress bar.

Parameters

  • message (string): The message to show in the progress bar

SetSplashProgress

Sets the progress bar progress amount.

Parameters

  • progress (float): The progress amount. This is a floating point number between 0.0 (empty) and 1.0 (full)