eraseVBL: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
m (Conversion script moved page EraseVBL to eraseVBL: Converting page titles to lowercase)
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{stub|Lacks examples.}}
{{MacroFunction
{{MacroFunction
|name=eraseVBL
|name=eraseVBL
Line 6: Line 5:
|version=1.3b89
|version=1.3b89
|description=
|description=
This function erases VBL shapes.
Erases Wall Vision Blocking Layer (Wall VBL) shapes from the '''Map''' VBL.  This function does not affect Token VBL.
<p>
This function works the same as {{func|drawVBL}} with the difference that {{func|drawVBL}} draws the shapes on the Vision Blocking Layer and {{func|eraseVBL}} erases them. For more examples go to the {{func|drawVBL}} page.  


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
eraseVBL(shapesList)
eraseVBL(shapeArray)
</source>
</syntaxhighlight>
 
'''Parameters'''
'''Parameters'''
{{param|shapesList|A [[JSON Array]] of [[JSON Object|JSON objects]], one of the latter for each VBL shape.}}
{{param|shapeArray|An array of one or more shapes as JSON objects.}}
The shapes can be one of {{code|"Rectangle"}}, {{code|"Circle"}}, {{code|"Polygon"}} or {{code|"Cross"}}.
 
For {{code|"shape":"Rectangle"}}:
{{param|"x"|Abscissa in pixels. (aka: X-Coordinate)}}
{{param|"y"|Ordinate in pixels. (aks: Y-Coordinate)}}
{{param|"w"|Width in pixels.}}
{{param|"h"|Height in pixels.}}
{{param|"r"|Rotation on centre axis in degrees, clockwise.}}
{{param|"fill"|If {{code|1}} fills rectangle, otherwise creates empty shape. '''Optional.'''}}
{{param|"thickness"|Line thickness from {{code|2}} to {{code|n}} pixels. Lower than {{code|2}} or empty defaults to {{code|2}}. Even numbers only (odd numbers get rounded down by one). Can't be bigger than width or height. '''Optional.'''}}
{{param|"scale"|If provided number not {{code|0}}, will scale rectangle by {{code|x}}, ie scale: {{code|2}} is double, scale: {{code|0.5}} is half. '''Optional.'''}}<br />
 
: Example:<source lang="mtmacro">
{"shape":"rectangle","x":1743,"y":2198,"w":100,"h":100,"r":45,"fill":1,"thickness":1,"scale":0}
</source><br />
 
For {{code|"shape":"Circle"}}:
{{param|"x"|Abscissa in pixels.}}
{{param|"y"|Ordinate in pixels.}}
{{param|"radius"|In pixels.
{{param|"fill"|If {{code|1}} fills circle, otherwise creates empty shape. '''Optional.'''}}
{{param|"thickness"|Line thickness from {{code|2}} to {{code|n}} pixels. Lower than {{code|2}} or empty defaults to {{code|2}}. Even numbers only (odd numbers get rounded down by one). '''Optional.'''}}
{{param|"sides"|Specifies how many sides the polygon will have to approximate a circle, from {{code|3}} to {{code|100}}.}}<br />
: Example:<source lang="mtmacro">
{"shape":"circle", "X":50, "Y":100, "radius":200, "sides":12, "thickness":3, "fill":0}</source><br />
 
For {{code|"shape":"Polygon"}}:
{{param|"r"|Rotation on centre axis in degrees, clockwise.}}
{{param|"thickness"|Line thickness from {{code|2}} to {{code|n}} pixels. Lower than {{code|2}} or empty defaults to {{code|2}}. Even numbers only (odd numbers get rounded down by one). '''Optional.'''}}
{{param|"close"| If {{code|1}} then it will close the polygon otherwise it will leave it open. '''Optional.'''}}
{{param|"fill"|If {{code|1}} and {{code|"close"}} is set too fills polygon, otherwise creates empty shape. '''Optional.'''}}
{{param|"points"|[[JSON Array]] of 2 or more {{code|"x"}}, {{code|"y"}} coordinates.}}<br />
: Example:<source lang="mtmacro">
{"shape":"polygon","r":0,"fill":1,"close":1,"thickness":10,"points":[{"x":1993,"y":1998},{"x":2043,"y":1998},{"x":1993,"y":2148}]}</source><br />
 
For {{code|"shape":"Cross"}}:
{{param|"x"|Abscissa in pixels.}}
{{param|"y"|Ordinate in pixels.}}
{{param|"w"|Width in pixels.}}
{{param|"h"|Height in pixels.}}
{{param|"r"|Rotation on centre axis in degrees, clockwise.}}
{{param|"thickness"|Line thickness from {{code|2}} to {{code|n}} pixels. Lower than {{code|2}} or empty defaults to {{code|2}}. Even numbers only (odd numbers get rounded down by one). Can't be bigger than width or height. '''Optional.'''}}
{{param|"scale"|If provided number not {{code|0}}, will scale cross by {{code|x}}, ie scale: {{code|2}} is double, scale: {{code|0.5}} is half. '''Optional.'''}}}}<br />
: Example:<source lang="mtmacro">{"shape":"cross","x":1593,"y":2198,"w":50,"h":50,"r":22,"thickness":5,"scale":0.75}</source><br />


|example=
|example=
This example doesn't really do anything.
This example erases a (solid) block of VBL of 200x200 pixels starting at the origin of the map
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: exampleVariable = "a,b,c"]
[h:rectangle = "{'shape':'rectangle','x':0,'y':0,'w':200,'h':200, 'fill':1}"]
[r: exampleFunction(exampleVariable, reverse)]
[h:objectArrary = json.append('',rectangle)]
</source>
[h:eraseVBL(objectArrary)]
Returns:
</syntaxhighlight>
<source lang="mtmacro" line>
[[Category:VBL Function]]
c,b,a
</source>


|also=
|also=
[[Introduction to Vision Blocking]], {{func|drawVBL}}
[[Introduction to Vision Blocking]], {{func|drawVBL}}
}}
}}
[[Category:Token Function]]
[[Category:Miscellaneous Function]]

Latest revision as of 23:31, 9 February 2023

eraseVBL() Function

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

Introduced in version 1.3b89
Erases Wall Vision Blocking Layer (Wall VBL) shapes from the Map VBL. This function does not affect Token VBL.

This function works the same as drawVBL() with the difference that drawVBL() draws the shapes on the Vision Blocking Layer and eraseVBL() erases them. For more examples go to the drawVBL() page.

Usage

eraseVBL(shapeArray)

Parameters

  • shapeArray - An array of one or more shapes as JSON objects.

Example

This example erases a (solid) block of VBL of 200x200 pixels starting at the origin of the map
[h:rectangle	= "{'shape':'rectangle','x':0,'y':0,'w':200,'h':200, 'fill':1}"]
[h:objectArrary	= json.append('',rectangle)]
[h:eraseVBL(objectArrary)]

See Also