Duplicate tokens being created onDrop by player
So a little background of the issue:
When a GM does a token drop and the size/name/other properties are adjusted, everything works fine, as the token ID is accessible.
When a player does a token drop, the token proto and position is transferred to the GM to edit the size/name/other properties. When this happens, on most maps (not all for some reason, however fully repeatable with vault maps) a duplicate token is created.
Findings:
I hunted down the reason for this, my script adds another token if the original token cannot be found and adjusts that one. On the surface it doesn’t seam like a big issue.
To resolve, I had snap to grid turned on, and converted the position coordinates passed along to the imageControl’s snap to grid function to adjust the coordinates.
Issue description:
What I uncovered was that the x coordinates were correct, but the y coordinates were slightly off. To verify this I also put a known existing token x,y position (already snapped to grid) through the function.
What I found is, although the already snapped token was present, it’s adjusted coordinates had a different Y value as well.
I do not know why an already positioned token position would change when position coordinates are placed through the imageControl’s snap to grid function.
I adjusted my script to compensate correctly, but it does not seam like this is expected behavior.