Skip to content

Globals

This page documents how your mod script can interface with Dungeondraft. You can pass and receive data using the Globals such as the Tools or the World to perform tasks.

Core

Functions and properties in this section are available to all scripts.

Properties

Array<Tool> Global.Editor.Tools
Provides access to every tool in Dungeondraft by name. For example, you can access the Object Tool by indexing the variable in this manner Global.Editor.Tools["ObjectTool"].

Valid tool names are:

Editor

Functions and properties in this category are related to the tools and user interface of Dungeondraft. They are accessed through Global.Editor.VariableName.

World

Global.World Functions and properties in this category are related to the map. They are accessed through Global.World.VariableName.

WorldUI

Global.WorldUI The class where many of the on map UI elements are accessed. They are accessed through Global.WorldUI.

Exporter

Global.Exporter The class used to export maps to various image and data formats.

Level

Global.World.GetCurrentLevel()
The class used to hold and modify the map itself. Most easily accessible through Globa.World.GetCurrentLevel() and other Global.World properties.

Root

This name is base directory of the mod a script is packaged in. It is helpful for locating other files inside a mod, like a PNG file for icons. For example, you can assign a variable to a PNG filename by combining the Root name with a known relative path like so:

var icon = Global.Root + "icons/example_tool.png"

Camera

Global.Camera The object that frames the area of the map to display to the window.

Global.Header The object that holds meta information about each map.

Functions

ToolPanel Global.Editor.Toolset.CreateModTool(Reference script_instance, String category, String id, String name, String icon)
Creates a new tool inside Dungeondraft and automatically generates a Tool Panel as the return.

The category is the set of tools the new tool will show under. Valid options are:

  • Design
  • Terrain
  • Objects
  • Effects
  • Settings

The id is the internal tool name, while the name is displayed to the end user.

The icon is the path to a PNG to use as the button.

Script

Functions in this category are specialized for modding Dungeondraft. They are accessed through Script.VariableName.

Functions

Array<String> Script.GetActiveMods()
Returns an Array of Strings of unique IDs of all active mods.

Tool Script

Functions and properties in this section are available only to tool scripts.

Script

Functions

Array<String> Script.GetAssetList(String category)
Returns an Array of Strings populated by the path to all the assets of that category.

Valid categories are Asset Categories