View Full Version : Token movement and line-of-sight question
gamerhawaii
March 10th, 2026, 21:35
I have an extension I use to move tokens that uses "token.setPosition(newX, newY);". Works great but allows movement that the Line-of-sight functionality would normally stop. Tokens move through walls, doors, etc. with no problem.
I have looked at all the APIs and code I could find like Token, TokenMoveManager, TokenManager, ImageManager, etc. but I could not find anything that will only let the movement go if it is valid (e.g., not through a wall.) I thought trying to treat it like "Token Movement Lock Mode" movement might work but there does not seem to be a way to add an approval entry without already changing the token position.
Is this something that is doable in an extension? If so, could you please point me in the right direction (i.e., how check the movement is valid, have FG automatically block the movement requested, or some other solution)?
Thank you
pindercarl
March 11th, 2026, 00:33
I have an extension I use to move tokens that uses "token.setPosition(newX, newY);". Works great but allows movement that the Line-of-sight functionality would normally stop. Tokens move through walls, doors, etc. with no problem.
I have looked at all the APIs and code I could find like Token, TokenMoveManager, TokenManager, ImageManager, etc. but I could not find anything that will only let the movement go if it is valid (e.g., not through a wall.) I thought trying to treat it like "Token Movement Lock Mode" movement might work but there does not seem to be a way to add an approval entry without already changing the token position.
Is this something that is doable in an extension? If so, could you please point me in the right direction (i.e., how check the movement is valid, have FG automatically block the movement requested, or some other solution)?
Thank you
The movement check only occurs when a token is "moving," i.e., token is dragged or token is executing a planned movement. There isn't an API method to trigger this. If you share your use case, it will help determine the best way to handle this and if any new API calls should be added.
gamerhawaii
March 11th, 2026, 00:55
The use case is a new version of the capability to allow players to control tokens and the map from a phone for playing in person using a TV.
From a phone, players can move their tokens, center on their token, zoom the map in or out, and move the map around. They can also roll simple dice. Great for playing in person. Only the GM has to be in FG. A client machine displaying to a TV is used for displaying maps, images, etc.
The old version (https://www.fantasygrounds.com/forums/showthread.php?45911) didn't work anymore and my newer version has some new features as well as not having to run as administrator. The old version had this problem as well.
It works by sending commands into the FG extension which then call standard FG functions. That is, move a token uses token.setPosition. Zoom and moving the map uses cImage.setViewpoint.
It is actually not a big deal as we usually do not play with line-of-sight on anyway, but it would have been nice to have it work just in case.
pindercarl
March 11th, 2026, 06:15
The use case is a new version of the capability to allow players to control tokens and the map from a phone for playing in person using a TV.
From a phone, players can move their tokens, center on their token, zoom the map in or out, and move the map around. They can also roll simple dice. Great for playing in person. Only the GM has to be in FG. A client machine displaying to a TV is used for displaying maps, images, etc.
The old version (https://www.fantasygrounds.com/forums/showthread.php?45911) didn't work anymore and my newer version has some new features as well as not having to run as administrator. The old version had this problem as well.
It works by sending commands into the FG extension which then call standard FG functions. That is, move a token uses token.setPosition. Zoom and moving the map uses cImage.setViewpoint.
It is actually not a big deal as we usually do not play with line-of-sight on anyway, but it would have been nice to have it work just in case.
Interesting. I can see that token.moveTo that evaluates as a move from the tokens current position could be useful. I will add it to my notes.
gamerhawaii
March 11th, 2026, 08:08
Thank you for the incredibly quick responses. I appreciate it.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.