getMoveCount: Difference between revisions
Jump to navigation
Jump to search
(Needs examples still...) |
m (Added mention of return values of -1) |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 5: | Line 5: | ||
|trusted=true | |trusted=true | ||
| description= | | description= | ||
Returns the token's last movement count in units. The count takes movement metric into account, and thus works on gridless, hex, and square grids. Two optional parameters allow you to set the function to return | Returns the token's last movement count in units. The count takes movement metric into account, and thus works on gridless, hex, and square grids. Two optional parameters allow you to set the function to return true/false (1/0) if there was fractional movement left over and the second toggles whether Terrain Modifiers for determining returned movement count. | ||
| usage= | | usage= | ||
< | <syntaxhighlight lang="mtmacro"> | ||
getMoveCount() | getMoveCount() | ||
getMoveCount(fractionOnly) | getMoveCount(fractionOnly) | ||
getMoveCount(fractionOnly,useTerrainMods) | getMoveCount(fractionOnly,useTerrainMods) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|fractionOnly|0 for normal count; 1 for fractional movement - only valid with 1-2-1 movement metric}} | {{param|fractionOnly|0 for normal count (default); 1 for fractional movement - only valid with 1-2-1 movement metric}} | ||
{{param|useTerrainMods|0 to ignore terrain modifiers when determining movement count; 1 to account for terrain modifiers}} | {{param|useTerrainMods|0 to ignore terrain modifiers when determining movement count (default); 1 to account for terrain modifiers}} | ||
'''Fraction Only''' - Return value will be a 0 when there was an even number of diagonal movements and 1 for an odd number. | '''Fraction Only''' - Return value will be a 0 when there was an even number of diagonal movements and 1 for an odd number. | ||
'''Return value''' - will be non-negative to represent the number of cells traversed (as described above), or {{code|-1}} if the user attempted to move into an invalid location (such as a cell within or behind VBL). | |||
|changes= | |changes= |
Latest revision as of 23:59, 10 September 2024
getMoveCount() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.3b76
Returns the token's last movement count in units. The count takes movement metric into account, and thus works on gridless, hex, and square grids. Two optional parameters allow you to set the function to return true/false (1/0) if there was fractional movement left over and the second toggles whether Terrain Modifiers for determining returned movement count.
Usage
getMoveCount()
getMoveCount(fractionOnly)
getMoveCount(fractionOnly,useTerrainMods)
Parameters
fractionOnly
- 0 for normal count (default); 1 for fractional movement - only valid with 1-2-1 movement metricuseTerrainMods
- 0 to ignore terrain modifiers when determining movement count (default); 1 to account for terrain modifiers
Fraction Only - Return value will be a 0 when there was an even number of diagonal movements and 1 for an odd number.
Return value - will be non-negative to represent the number of cells traversed (as described above), or -1
if the user attempted to move into an invalid location (such as a cell within or behind VBL).
Version Changes
- 1.5.0 - Added Fraction Only and Use Terrain Modifiers parameters.