eraseVBL: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
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.
This function erases Vision Blocking Layer (VBL) shapes.


|usage=
|usage=
Line 13: Line 12:
</source>
</source>


'''Parameters'''
This function works EXACTLY the same as {{func|drawVBL}} with the ONLY difference that {{func|drawVBL}} draws the shapes on the vision blocking layer and eraseVBL erases them. For descriptions on parameters and more examples goto the {{func|drawVBL}} page.  
{{param|shapesList|A [[JSON Array]] of [[JSON Object|JSON objects]], one of the latter for each VBL shape.}}
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, centered on the origin of the map
<source lang="mtmacro" line>
<source 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:
<source lang="mtmacro" line>
c,b,a
</source>
</source>


|also=
|also=

Revision as of 11:25, 10 April 2013

eraseVBL() Function

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

Introduced in version 1.3b89
This function erases Vision Blocking Layer (VBL) shapes.

Usage

eraseVBL(shapesList)

This function works EXACTLY the same as drawVBL() with the ONLY difference that drawVBL() draws the shapes on the vision blocking layer and eraseVBL erases them. For descriptions on parameters and more examples goto the drawVBL() page.

Example

This example erases a (solid) block of VBL of 200x200 pixels, centered on 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