eraseVBL: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Modified usage)
(Usage rewritten)
Line 15: Line 15:
'''Parameters'''
'''Parameters'''
{{param|shapesList|A [[JSON Array]] of [[JSON Object|JSON objects]], one of the latter for each VBL shape.}}
{{param|shapesList|A [[JSON Array]] of [[JSON Object|JSON objects]], one of the latter for each VBL shape.}}
The shapes can be one of Rectangle, Circle, Polygon or Cross.
The shapes can be one of {{code|"Rectangle"}}, {{code|"Circle"}}, {{code|"Polygon"}} or {{code|"Cross"}}.
 
For {{code|"shape":"Rectangle"}}:
{{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|"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 />


* 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">
: Example:<source lang="mtmacro">
{"shape":"rectangle","x":1743,"y":2198,"w":100,"h":100,"r":45,"fill":1,"thickness":1,"scale":0}
{"shape":"rectangle","x":1743,"y":2198,"w":100,"h":100,"r":45,"fill":1,"thickness":1,"scale":0}
</source><br />
</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).
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">
: Example:<source lang="mtmacro">
{"shape":"circle", "X":50, "Y":100, "radius":200, "sides":12, "thickness":3, "fill":0}</source><br />
{"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.
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">
: 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 />
{"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).
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:<source lang="mtmacro">{"shape":"cross","x":1593,"y":2198,"w":50,"h":50,"r":22,"thickness":5,"scale":0.75}</source><br />



Revision as of 09:19, 9 April 2013

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

eraseVBL() Function

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

Introduced in version 1.3b89
This function erases VBL shapes.

Usage

eraseVBL(shapesList)

Parameters

The shapes can be one of "Rectangle", "Circle", "Polygon" or "Cross".

For "shape":"Rectangle":

  • "x" - Abscissa in pixels.
  • "y" - Ordinate in pixels.
  • "w" - Width in pixels.
  • "h" - Height in pixels.
  • "r" - Rotation on centre axis in degrees, clockwise.
  • "fill" - If 1 fills rectangle, otherwise creates empty shape. Optional.
  • "thickness" - Line thickness from 2 to n pixels. Lower than 2 or empty defaults to 2. Even numbers only (odd numbers get rounded down by one). Can't be bigger than width or height. Optional.
  • "scale" - If provided number not 0, will scale rectangle by x, ie scale: 2 is double, scale: 0.5 is half. Optional.
Example:
{"shape":"rectangle","x":1743,"y":2198,"w":100,"h":100,"r":45,"fill":1,"thickness":1,"scale":0}

For "shape":"Circle":

  • "x" - Abscissa in pixels.
  • "y" - Ordinate in pixels.
  • "radius" - In pixels.
  • "fill" - If 1 fills circle, otherwise creates empty shape. Optional.
  • "thickness" - Line thickness from 2 to n pixels. Lower than 2 or empty defaults to 2. Even numbers only (odd numbers get rounded down by one). Optional.
  • "sides" - Specifies how many sides the polygon will have to approximate a circle, from 3 to 100.
Example:
{"shape":"circle", "X":50, "Y":100, "radius":200, "sides":12, "thickness":3, "fill":0}

For "shape":"Polygon":

  • "r" - Rotation on centre axis in degrees, clockwise.
  • "thickness" - Line thickness from 2 to n pixels. Lower than 2 or empty defaults to 2. Even numbers only (odd numbers get rounded down by one). Optional.
  • "close" - If 1 then it will close the polygon otherwise it will leave it open. Optional.
  • "fill" - If 1 and "close" is set too fills polygon, otherwise creates empty shape. Optional.
  • "points" - JSON Array of 2 or more "x", "y" coordinates.
Example:
{"shape":"polygon","r":0,"fill":1,"close":1,"thickness":10,"points":[{"x":1993,"y":1998},{"x":2043,"y":1998},{"x":1993,"y":2148}]}

For "shape":"Cross":

  • "x" - Abscissa in pixels.
  • "y" - Ordinate in pixels.
  • "w" - Width in pixels.
  • "h" - Height in pixels.
  • "r" - Rotation on centre axis in degrees, clockwise.
  • "thickness" - Line thickness from 2 to n pixels. Lower than 2 or empty defaults to 2. Even numbers only (odd numbers get rounded down by one). Can't be bigger than width or height. Optional.
  • "scale" - If provided number not 0, will scale cross by x, ie scale: 2 is double, scale: 0.5 is half. Optional.
Example:
{"shape":"cross","x":1593,"y":2198,"w":50,"h":50,"r":22,"thickness":5,"scale":0.75}

Example

This example doesn't really do anything.
[h: exampleVariable = "a,b,c"]
[r: exampleFunction(exampleVariable, reverse)]

Returns:

c,b,a

See Also