[1.5.7] Wrong values of getTokenNativeWidth/Height after setTokenImage size

Confirmed bugs should get a single post here. Check the READ ME FIRST sticky thread for the format.

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice, MapTool BugReport Manager

Forum rules
Posts that do not conform to the READ ME FIRST sticky thread are subject to deletion.
Post Reply
User avatar
Purzelkater
Cave Troll
Posts: 41
Joined: Thu Oct 31, 2019 3:45 am

[1.5.7] Wrong values of getTokenNativeWidth/Height after setTokenImage size

Post by Purzelkater »

If you are using setTokenImage to replace a token image with the image (or handout) of another token, getTokenNativeWidth and getTokenNativeHeight are showing the values of the old (original) token, not of the new associated image.

This can easily reproduced:
1. From the standard resource library add "Information" (Markers) and "Denoleran Enclave" (Maps) to your map.
2. On the campaign properties, add this to the Basic Token Properties:

Code: Select all

*getTokenNativeWidth:[r: getTokenNativeWidth(currentToken())]
*getTokenNativeHeight:[r: getTokenNativeHeight(currentToken())]
Now, if you hover the mouse over the tokens, you can see the correct native image size:
getTokenImageSize_1.png
getTokenImageSize_1.png (611.6 KiB) Viewed 4245 times
getTokenImageSize_2.png
getTokenImageSize_2.png (649.48 KiB) Viewed 4245 times
3. Add a new macro (I have add is as campaign macro and set "use for selected tokens" (sorry, don't know the current english translation ^^) ):

Code: Select all

[h: handoutImageAssetId = getTokenImage()]
[h: handoutTokenId = findToken("Information")]
[h: setTokenImage(handoutImageAssetId, handoutTokenId)]
4. Select the "Denoleran Enclave" token and run the macro.
Now the image of the "Information" token will be replaced by the token image of the map. If you zoom into the map, you can see all details as expected.

But if you hover the mouse over the Information token with the replaced icon, you are shown the old values:
getTokenImageSize_3.png
getTokenImageSize_3.png (790.3 KiB) Viewed 4245 times

Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

Re: [1.5.7] Wrong values of getTokenNativeWidth/Height after setTokenImage size

Post by Merudo »

Issue should be fixed in 1.5.8

User avatar
Purzelkater
Cave Troll
Posts: 41
Joined: Thu Oct 31, 2019 3:45 am

Re: [1.5.7] Wrong values of getTokenNativeWidth/Height after setTokenImage size

Post by Purzelkater »

Yeah, I have seen this yesterday on the github logs and I'm very happy about - also about getting image size from asset id. Much thanks! :)

Post Reply

Return to “Bug Reports”