Skip to content

App

Namespace

App

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

Functions

Overview

Logging

LogMessage(message) LogWarning(message) LogError(message)

Editor

CurrentArchive() -> Archive CurrentEntry() -> ArchiveEntry CurrentEntrySelection() -> ArchiveEntry[] CurrentPalette([entryFor]) -> Palette ShowArchive(archive) ShowEntry(entry) MapEditor() -> MapEditor


LogMessage

Writes a message to the SLADE log.

Parameters

  • message (string): The message to print to the log

Example

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

LogWarning

Writes a warning message to the SLADE log. Warning messages are displayed in a yellow colour in the console log window.

Parameters

  • message (string): The message to print to the log

LogError

Writes an error message to the SLADE log. Error messages are displayed in a red colour in the console log window.

Parameters

  • message (string): The message to print to the log

CurrentArchive

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

Returns

  • Archive: The archive for the currently open tab in the main SLADE window

CurrentEntry

Gets the currently open entry in the main SLADE window.

Returns

  • ArchiveEntry: The currently open entry in the main SLADE window

CurrentEntrySelection

Gets the currently selected entries in the main SLADE window.

Returns

  • ArchiveEntry[]: An array of the currently selected entries in the main SLADE window

CurrentPalette

Gets the current palette.

Parameters

  • [entryFor] (ArchiveEntry): If given, the appropriate palette for this entry will be found (if 'Existing/Global' is selected). Default is nil

Returns

  • Palette: The currently selected palette

Notes

If 'Existing/Global' is selected in the main window palette dropdown, this will return the palette from the currently selected base resource archive. Additionally, if entryFor was given, this will check for certain cases where an entry does not use PLAYPAL as its palette, and return the appropriate palette instead.


ShowArchive

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

Parameters

  • archive (Archive): The archive to show

ShowEntry

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

Parameters


MapEditor

Gets the currently open map editor (if any).

Returns