createMap: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=createMap | |name=createMap | ||
|trusted= | |trusted=true | ||
|version=1.14.0 | |version=1.14.0 | ||
|description= | |description= | ||
Line 42: | Line 42: | ||
Create a map called {{code|New Map}}. | Create a map called {{code|New Map}}. | ||
<syntaxhighlight lang="mtmacro" line> | <syntaxhighlight lang="mtmacro" line> | ||
[ | [r: id = createMap("New Map")]</syntaxhighlight> | ||
Returns: | Returns: | ||
The ID of the created Map. | The ID of the created Map. | ||
Line 49: | Line 49: | ||
<syntaxhighlight lang="mtmacro" line> | <syntaxhighlight lang="mtmacro" line> | ||
[ | [r: vNewMapId = createMap("New Map", json.set("{}", | ||
"display name", "Display Name", | "display name", "Display Name", | ||
"player visible", json.true, | "player visible", json.true, | ||
Line 69: | Line 69: | ||
))] | ))] | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Returns: | |||
The ID of the created Map. | |||
|also= | |also= | ||
Line 75: | Line 77: | ||
|changes= | |changes= | ||
* '''1.14.0''' - First released. | * '''1.14.0''' - First released. | ||
* '''1.15.0''' - Map Asset accepts {{code|lib://path/to/image.jpg}} URLs | |||
}} | }} | ||
[[Category:Map Function]] | [[Category:Map Function]] |
Latest revision as of 23:59, 16 February 2024
createMap() Function
Note: This function can only be used in a Trusted Macro
• 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 theconfig 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 noneplayer visible:
- defaults to user preferencesvision type:
- defaults to user preferencesvision distance:
- defaults to user preferenceslighting style:
- defaults to "OVERTOP"background paint:
- defaults to built-in Grassfog paint:
- defaults to blackhas fog:
- defaults to user preferences (TODO Implement it)map asset:
- defaults to nonegrid:
- JSON object, see below
The grid value is another JSON object, with these optional keys:
type:
- defaults to user preferencescolor:
- defaults to user preferencesunits per cell:
- defaults to user preferencessize:
- defaults to user preferencesx offset:
- defaults to 0y offset:
- defaults to 0
Examples
Create a map called
New Map
.
[r: id = createMap("New Map")]
Returns: The ID of the created Map.
Create a map called New Map
with config
options set.
[r: vNewMapId = createMap("New Map", json.set("{}",
"display name", "Display Name",
"player visible", json.true,
"vision type", "NIGHT",
"vision distance", 600,
"lighting style", "OVERTOP",
"has fog", json.true,
"ai rounding", "CELL_UNIT",
"grid", json.set("{}",
"type", "Square",
"color", "#FF0000",
"units per cell", 20,
"size", 200,
"x offset", 7,
"y offset", 11
),
"background paint", "asset://c93660c09e3d3f9aff04df49a6c594b4",
"map asset", "asset://014aaa10a10b5ddcbbe006f3c22188c2"
))]
Returns:
The ID of the created Map.See Also
Version Changes
- 1.14.0 - First released.
- 1.15.0 - Map Asset accepts
lib://path/to/image.jpg
URLs