eraseVBL: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Modified usage)
m (Conversion script moved page EraseVBL to eraseVBL: Converting page titles to lowercase)
 
(10 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 Rectangle, Circle, Polygon or Cross.
 
* For {{code|"Rectangle"}}, you need to supply {{code|"x"}}, {{code|"y"}}, {{code|"w"}}, {{code|"h"}} in pixels and optionally you can specify {{code|"r"}} (rotation on center axis in degrees), {{code|"fill"}} ({{code|1}} = fill rectangle otherwise create empty shape), {{code|"thickness"}} (line thickness {{code|1}} to {{code|n}}, {{code|0}} or empty defaults to {{code|2}}), and {{code|"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).
: 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|"Circle"}}, you need to supply {{code|"x"}}, {{code|"y"}}, {{code|"radius"}} in pixels, {{code|"fill"}} ({{code|1}} = fill circle otherwise create empty shape), {{code|"thickness"}} (line thickness {{code|1}} to {{code|n}}, {{code|0}} or empty defaults to {{code|2}}), and {{code|"sides"}} (specify how many sides the polygon will have to approximate a circle).
: Example:<source lang="mtmacro">
{"shape":"circle", "X":50, "Y":100, "radius":200, "sides":12, "thickness":3, "fill":0}</source><br />
 
* For {{code|"Polygon"}}, you can supply {{code|"r"}} (rotation on center axis in degrees) and {{code|"thickness"}} (line thickness {{code|1}} to {{code|n}}, {{code|0}} or empty defaults to {{code|2}}). If you specify {{code|"close":1}} then it will close the polygon otherwise it will leave it open. If it is closed, you can supply {{code|"fill":1}} to make the polygon solid. In addition you need to supply an array (named {{code|"points"}}) of 2 or more {{code|"x"}}, {{code|"y"}} coordinates.
: 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|"Cross"}}, you need to supply {{code|"x"}}, {{code|"y"}}, {{code|"w"}}, {{code|"h"}} in pixels and optionally you can specify {{code|"r"}} (rotation on center axis in degrees), {{code|"thickness"}} (line thickness {{code|1}} to {{code|n}}, {{code|0}} or empty defaults to {{code|2}}), and {{code|"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).
: 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