movedOverPoints: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: {{MacroFunction |name=movedOverPoints |version=1.3.b75 |description= |usage=This function can be used to check if {{code|token}} is in an array of cell coordinates like the one received f...)
 
No edit summary
Line 4: Line 4:
|description=
|description=


|usage=This function can be used to check if {{code|token}} is in an array of cell coordinates like the one received from {{func|getLastPath}} or the onTokenMove-events macro.args
|usage=This function can be used to check if a token has moved through a shape that is defined by an array of cell coordinates (formatted like the one received from {{func|getLastPath}} or the onTokenMove-events macro.args).
 
 
{{code|movedOverPoints}} returns a json array with coordinates of all cells that have been a) in the defined shape and b) traversed by the token.


<source lang="mtmacro" line>
<source lang="mtmacro" line>
=movedOverPoints(jsonArray)
<!-- lets define a shape -->
 
[h: jsonArray = json.append("",
    json.set("", "x",  0, "y",  0),
    json.set("", "x",  0, "y", 100),
    json.set("", "x", 100, "y", 100),
    json.set("", "x",  0, "y", 100)
)]
<!-- check if token in context has moved through that shape -->
[r: movedOverPoints(jsonArray)]
</source>
</source>



Revision as of 17:20, 20 November 2010

movedOverPoints() Function

Introduced in version 1.3.b75

Usage

This function can be used to check if a token has moved through a shape that is defined by an array of cell coordinates (formatted like the one received from getLastPath() or the onTokenMove-events macro.args).


movedOverPoints returns a json array with coordinates of all cells that have been a) in the defined shape and b) traversed by the token.

<!-- lets define a shape -->

[h: jsonArray = json.append("",
    json.set("", "x",   0, "y",   0),
    json.set("", "x",   0, "y", 100),
    json.set("", "x", 100, "y", 100),
    json.set("", "x",   0, "y", 100)
)]
<!-- check if token in context has moved through that shape -->
[r: movedOverPoints(jsonArray)]


 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: lastPath-format specified, define/explain return value, examples