createMap

From RPTools Wiki
Revision as of 06:28, 11 December 2023 by Taustin (talk | contribs)
Jump to navigation Jump to search

createMap() Function

Introduced in version 1.14.0
Creates a map from the information in the required JSON object parameter. The JSON object must have name, and has optional config key/value pairs.

Usage

createMap(name)
createMap(name,config)

Parameters

  • name - A string with the name of the new map.
  • name - A JSON object as described for the config options parameter of copyMap().

config parameter

config is a JSON Object that can contain any of the following fields. Field names are case-sensitive, and all fields are optional:

  • display name: - defaults to none
  • player visible: - defaults to user preferences
  • vision type: - defaults to user preferences
  • vision distance: - defaults to user preferences
  • lighting style: - defaults to "OVERTOP"
  • background paint: - defaults to built-in Grass
  • fog paint: - defaults to black
  • has fog: - defaults to user preferences (TODO Implement it)
  • map asset: - defaults to none
  • grid: - JSON object, see below

The grid value is another JSON object, with these optional keys:

  • type: - defaults to user preferences
  • color: - defaults to user preferences
  • units per cell: - defaults to user preferences
  • size: - defaults to user preferences
  • x offset: - defaults to 0
  • y offset: - defaults to 0

Examples

Create a map called New Map.
[h: id = createMap("New Map)]

Returns: The ID of the created Map.

Create a map called New Map with config options set.

See Also

Version Changes

  • 1.11.0 - First released.