Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:CreateWindowFromTemplate

From RoR Wiki
Revision as of 19:41, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Interface functions
Version: WAR 1.4.8

Creates a new window from a window template and puts it under a parent window.

created = CreateWindowFromTemplate(windowName, templateName, parentName)

Arguments

windowName
string – Name of the new window. Child windows named $parent... in the template get their names from it.
templateName
string – Name of a window template defined in a loaded XML file.
parentName
string – Name of an existing window that becomes the parent. Use "Root" for a top-level window.

Returns

created
boolean – true if the window was created (or reused, see below), false otherwise.

Details

  • The parent is checked first. If it does not exist, nothing is created and an error is logged.
  • If a window called windowName already exists, nothing is created and an error is logged. The exception is a window that is waiting for a deferred DestroyWindow: it is taken off the destroy list and kept as it is.
  • If the template cannot be found or built, an error is logged and false is returned.
  • When argument checking fails, nothing is returned.

Errors

These are written to the UI log; the call returns normally.

  • ERROR: Unable to create window: %s, parent window %s is invalid
  • ERROR: Unable to create window: %s, from template %s
  • ERROR: Window with this name already exists: %s

Example

From easystem_glyphdisplay/source/glyphdisplay.lua:

CreateWindowFromTemplate( glyphWindowName, "WorldMapGlyph", self.windowName )

Creating a list row on demand, from ea_tomeofknowledge/source/tomewindow_bestiary.lua:

CreateWindowFromTemplate( taskWindowName, "BestiarySpeciesTaskWindow", parentWindow )
WindowAddAnchor( taskWindowName, "bottomleft", anchorWindow, "topleft", xOffset, yOffset )

See also