getLastPath()

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
iSax
Kobold
Posts: 6
Joined: Mon Dec 21, 2020 6:57 pm

getLastPath()

Post by iSax »

Hi

When I use getLastPath() on a valid movement path it gives me a json array holding all the squares moved over including the initial one:
[{"x":12,"y":16},{"x":13,"y":17},{"x":14,"y":18},{"x":15,"y":19},{"x":16,"y":20}]

However, if the movement is invalid It just gives me the start and the end of the movement:
[{"x":9,"y":17},{"x":12,"y":16,"fail":1}]

Is this the intended behaviour? I would expect it to still give me every square moved over but just flag the invalid move as failed.

I am trying to set up a map where all the buildings have a roof (using Hill VBL), and to put a teleport pad in the roof above where the door would be. The onTokenMove macro would then check that only the last square of movement was invalid before moving the token to the interior map. Is there a better way of doing this?

Thanks

Ian

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: getLastPath()

Post by Full Bleed »

You might want to take this question to the MT Discord.

https://discord.gg/K4Fnt6aT
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: getLastPath()

Post by wolph42 »

iSax wrote:
Fri Mar 11, 2022 6:13 pm
Hi

When I use getLastPath() on a valid movement path it gives me a json array holding all the squares moved over including the initial one:
[{"x":12,"y":16},{"x":13,"y":17},{"x":14,"y":18},{"x":15,"y":19},{"x":16,"y":20}]

However, if the movement is invalid It just gives me the start and the end of the movement:
[{"x":9,"y":17},{"x":12,"y":16,"fail":1}]

Is this the intended behaviour? I would expect it to still give me every square moved over but just flag the invalid move as failed.

I am trying to set up a map where all the buildings have a roof (using Hill VBL), and to put a teleport pad in the roof above where the door would be. The onTokenMove macro would then check that only the last square of movement was invalid before moving the token to the interior map. Is there a better way of doing this?

Thanks

Ian
indeed, better to ask on discord. But yes: that is intended behaviour. If you turn off the AI you'll get the entire path. You might have noticed the 'fail' indicator in the lastpath which gives you a hint that this really is as intended: if the path 'failed' it will tell you start and finish and that not path could be found to bridge those to points.

Post Reply

Return to “MapTool”