movedOverDrawing: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "{{MacroFunction |name=movedOverDrawing |version=1.5.2 |trusted=true |description= Use to check if a given path has crossed through a specified drawing. Returns a JSON array w...")
 
No edit summary
 
(9 intermediate revisions by 5 users not shown)
Line 4: Line 4:
|trusted=true
|trusted=true
|description=
|description=
Use to check if a given path has crossed through a specified drawing.
Use to check if a given path has crossed through a specified drawing including templates. The easiest way to discover a drawing's Id is via the Draw Explorer interface.


Returns a JSON array with coordinates of all cells in the path that overlap with the area defined by the given points.
Returns a JSON array with coordinates of all cells in the path that overlap with the area defined by the given drawing.
|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
getDrawingInfo(mapName, drawingId)
movedOverDrawing(mapRef, drawingId, path)
</source>
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
{{param|mapName|A string containing the name of the map.}}
{{param|mapRef|The Name or ID of the map.}}
{{param|drawingId|A string containing the id of the drawing. The easiest way to discover a drawing's Id is via the Draw Explorer interface.}}
{{param|drawingId|A string containing the id of the drawing.}}
{{param|path|JSON array of X/Y coordinate such as that returned by {{func|getLastPath}}}}
{{param|path|JSON array of X/Y coordinate such as that returned by {{func|getLastPath}}}}
|examples=
|examples=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: lp = getLastPath()]
[h: lp = getLastPath()]
[h: id = findDrawings(getCurrentMapName(),"fig1")]  
[h: id = findDrawings(getCurrentMapName(),"fig1")]  
[r: movedOverDrawing(getCurrentMapName(),id,lp)]
[r: movedOverDrawing(getCurrentMapName(),id,lp)]
</source>
</syntaxhighlight>


|also=
|also=
{{func|getDrawingProperties}}
{{func|getDrawingInfo}} {{func|getLastPath}}
}}
}}
[[Category:Draw Function]]
[[Category:Draw Function]]

Latest revision as of 23:59, 14 March 2023

movedOverDrawing() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.5.2
Use to check if a given path has crossed through a specified drawing including templates. The easiest way to discover a drawing's Id is via the Draw Explorer interface. Returns a JSON array with coordinates of all cells in the path that overlap with the area defined by the given drawing.

Usage

movedOverDrawing(mapRef, drawingId, path)

Parameters

  • mapRef - The Name or ID of the map.
  • drawingId - A string containing the id of the drawing.
  • path - JSON array of X/Y coordinate such as that returned by getLastPath()

Examples

[h: lp = getLastPath()]
[h: id = findDrawings(getCurrentMapName(),"fig1")] 
[r: movedOverDrawing(getCurrentMapName(),id,lp)]

See Also