getMBL: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Undo revision 11255 by Kwvanderlinde (talk))
Tag: Undo
m (Text replacement - "source>" to "syntaxhighlight>")
 
(4 intermediate revisions by 3 users not shown)
Line 9: Line 9:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
getMBL(shape)
getMBL(shape,format)
getMBL(shape,format)
</source>
</syntaxhighlight>


This function retrieves the MBL found in the given shape.
This function retrieves the MBL found in the given shape(s).


'''Parameters'''
'''Parameters'''
{{param|shape|A JSON object as described in {{func|drawMBL}}.}}
{{param|shape|A JSON object or array of JSON objects, as described in {{func|drawMBL}}. If an array, gets all the MBL within all provided shapes, otherwise just the MBL in the single provided shape.}}
{{param|format|Boolean. Returns a JSON object if {{false}}, or an JSON array of coordinates if {{true}}.  In either case, the returned shape covers the MBL found in the area.}}
{{param|format|OPTIONAL Boolean. Returns a JSON object if {{false}}, or a JSON array of coordinates if {{true}}.  In either case, the returned shape covers the MBL found in the area. Defaults to {{false}}}}




''Example:''<source lang="mtmacro">
|examples=
[h:rectangle = "{'shape':'rectangle','x':50,'y':50,'w':100,'h':200,'r':45,'fill':1,'thickness':1,'scale':0}"]
<syntaxhighlight lang="mtmacro">
[h:rectangle = '{"shape":"rectangle","x":50,"y":50,"w":100,"h":200,"r":45,"fill":1,"thickness":1,"scale":0}']
[r:mblData  = getMBL(rectangle , 0)]
[r:mblData  = getMBL(rectangle , 0)]
</source><br />
</syntaxhighlight><br />


|also=
|also=

Latest revision as of 18:19, 14 March 2023

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.

getMBL() Function

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

Introduced in version 1.9.0
Gets the Movement Blocking Layer (MBL) shapes for the area specified in the shape parameter.

Usage

getMBL(shape)
getMBL(shape,format)

This function retrieves the MBL found in the given shape(s).

Parameters

  • shape - A JSON object or array of JSON objects, as described in drawMBL(). If an array, gets all the MBL within all provided shapes, otherwise just the MBL in the single provided shape.
  • format - OPTIONAL Boolean. Returns a JSON object if false(0), or a JSON array of coordinates if true(1). In either case, the returned shape covers the MBL found in the area. Defaults to false(0)

Examples

[h:rectangle = '{"shape":"rectangle","x":50,"y":50,"w":100,"h":200,"r":45,"fill":1,"thickness":1,"scale":0}']
[r:mblData   = getMBL(rectangle , 0)]

See Also