App

The App scripting namespace contains a set of functions for general interaction with the SLADE application.

Functions

logMessage

Parameters

  • string message: The message to print to the log

Writes a message to the SLADE log.

Example

App.logMessage('This is a log message')

globalError

Returns string

Returns the most recently generated error message


messageBox

Parameters

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

Shows a simple message dialog


messageBoxExt

Parameters

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

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


promptString

Parameters

  • string title: The dialog caption
  • string message: The message to display
  • string default_value: The initial default value

Returns string

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


promptNumber

Parameters

  • string title: The dialog caption
  • string message: The message to display
  • number default_value: The initial default value
  • number min: The minimum value allowed
  • number max: The maximum value allowed

Returns number

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


promptYesNo

Parameters

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

Returns boolean

Shows a dialog prompt with 'Yes' and 'No' buttons, returning true for yes or false for no


browseFile

Parameters

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

Returns string

Shows a file browser dialog allowing the user to select a file and returns the full path to the selected file. If no file was selected it will return an empty string.

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 = App.browseFile('Select a File', 'Wad Files (*.wad)|*.wad|All Files|*.*', '')
App.logMessage('Selected file ' .. path)

browseFiles

Parameters

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

Returns string[]

Shows a file browser dialog allowing the user to select multiple files and returns an array of full paths to the selected files. If no file was selected it will return an empty array. See browseFile above for the formatting of the extensions parameter.


currentArchive

Returns Archive

Returns the archive for the currently open tab in the main SLADE window.


currentEntry

Returns ArchiveEntry

Returns the currently open entry in the main SLADE window.


currentEntrySelection

Returns ArchiveEntry[]

Returns an array of the currently selected entries in the main SLADE window.


showArchive

Parameters

  • Archive archive: The archive to show

Shows the tab for the given archive in the main SLADE window.


showEntry

Parameters

Shows the given entry in a tab in the main SLADE window.


mapEditor

Returns MapEditor

Returns the currently open map editor