View Full Version : I finally found out how some things can shrink a large token image to a smaller image
SilentRuin
September 29th, 2022, 01:13
Basically if I have some replace combat token (sort of like CombatManager.replaceCombatantToken code) for some reason or other I have occasionally noticed different extensions of mine which do this sort of thing end up with the huge tokens becoming medium. I could never find out why this happened seemed very inconsistent.
I have now managed to find out how this is happening. If the host combat map is not up on the host and the client does some operation sent to host to update that map token - this is when it shrinks. Seems to only happen with non medium tokens.
Any ideas why this would be happening?
Moon Wizard
September 29th, 2022, 03:02
You’d have to set up a minimum test case extension (maybe with letter tokens); and send over to review.
You may even find it on review.
Also, if you are replacing large tokens and the auto-scale is triggering, you’ll need to make sure you call the functions that set the drag units for the tokens.
Regards,
JPG
Moon Wizard
September 29th, 2022, 03:06
Given all this, you need to make sure that the token replacement only occurs in the host as well.
JPG
SilentRuin
September 29th, 2022, 05:22
Given all this, you need to make sure that the token replacement only occurs in the host as well.
JPG
Yep first thing I did. It's not like this is super critical but I will try to get you an example sometime in the next week or so. It's been happening for years I just never put all the pieces to figure out the "why" of it. Just happy I finally at least know how it happens and the simple fix - don't run those things without the the host having the map up. I mean how often does that really happen - which is why it was so hard to find.
Also, before I do send an example I'll make sure I'm doing the stuff you said I should be doing - pretty sure it was doing the same thing the FGU versions did - but I'll have to double check.
SilentRuin
September 29th, 2022, 05:43
Is there a way to trigger a CombatManager.replaceCombatantToken call and all it executes in a normal FGU environment without the host having the map up (ie. from a client)? As that would be an easy test case I could perform - I just don't know of a way to do it. My update code is doing the same things the combat Manager stuff does so that's not the issue. I ask because that would be a much easier test than me cobbling together and extension which could trigger it from the client to execute on the host.
Moon Wizard
September 29th, 2022, 16:34
The CombatManager.replaceCombatantToken function does not call any functions that require the image window to be open; which is why I need a simple extension that shows the issue.
Regards,
JPG
Moon Wizard
September 29th, 2022, 16:42
It does expect a tokeninstance object, which you can retrieve using the image container database path and the token ID provided to the Token.getToken API.
Regards,
JPG
SilentRuin
September 29th, 2022, 18:24
It does expect a tokeninstance object, which you can retrieve using the image container database path and the token ID provided to the Token.getToken API.
Regards,
JPG
I'll have to try and duplicate it then. Probably after I finish up a performance bug in AssistantGM and testing out the beta with my stuff.
Morenu
October 5th, 2022, 03:19
Our group has this happen frequently. we are fighting giants, have some large shapeshifters, Tiny quasit... so several different sized tokens a lot of the time. it is HIGHLY annoying, so IF you track down the error, please try and fix it. we lose 5-10 minutes of game time to it every session. I never looked at trouble shooting it because I saw no pattern. I am rooting for you Silentruin.
SilentRuin
October 5th, 2022, 04:31
Our group has this happen frequently. we are fighting giants, have some large shapeshifters, Tiny quasit... so several different sized tokens a lot of the time. it is HIGHLY annoying, so IF you track down the error, please try and fix it. we lose 5-10 minutes of game time to it every session. I never looked at trouble shooting it because I saw no pattern. I am rooting for you Silentruin.
It's very simple to duplicate. Have anything replace a token (extension is only way I know how to do this) while host map it is in is not open - and poof - shrunken.
I use Death Indicators and simply open host - close the map - kill (wounds = HP in combat tracker) the huge NPC that has a token in the map - then bring it back to life (0 wounds) - then reopen the map and poof - duplicated. I can do this even if the client has the token shown in a map on it - its only the host not having map open when operation happens.
For me this can be done as I described with Death Indicator - or with Polymorphism transforming a huge NPC to something else and back again with host map off - or Assistant GM changing client NPC control on and off with host not having map with token up - or pretty much ANYTHING that does what CombatManager.replaceCombatantToken FGU 5e ruleset code does when a host map is not up with the token its replacing or setting.
As I don't know a normal FGU function that triggers that type of operation unless the host map is up (if someone knows one just do that) I have to use extensions that trigger that thing which does not require host map up with that token as described. Which is a pain to make a simple test case and I've not gotten around to it yet for Moon Wizard - though I'm sure anyone could do it with the FGU function I mention above - you just have to get it to trigger while host map containing the token is not up. As I do the same operations as CombatManager.replaceCombatantToken does in all my replace token operations (well more and varied for each thing but that is the core of all of them).
SilentRuin
October 5th, 2022, 18:33
My personal suspicion is that FGU has the Token.setSize tied to the image and if its not around - it does not get updated based on the creature size. I'm not ready to go store all the original sizes and then restore them after the token is replaced at this stage just to compensate for a generic issue with not having the map open in FGU base code.
bmos
October 5th, 2022, 23:46
It's very simple to duplicate. Have anything replace a token (extension is only way I know how to do this) while host map it is in is not open - and poof - shrunken.You shouldn't need an extension to show it off then. The onDrop in ct_token.lua calls CombatManager.replaceCombatantToken.
SilentRuin
October 6th, 2022, 00:41
You shouldn't need an extension to show it off then. The onDrop in ct_token.lua calls CombatManager.replaceCombatantToken.
So you know how to do an onDrop from client into map that is not open on host? I mean obviously you could not do it from the host as that is the map that has to be closed to duplicate this. I stand ready for enlightenment how this is accomplished!
As I said - I have no way of doing this that I know of.
bmos
October 6th, 2022, 15:07
So you know how to do an onDrop from client into map that is not open on host? I mean obviously you could not do it from the host as that is the map that has to be closed to duplicate this. I stand ready for enlightenment how this is accomplished!
As I said - I have no way of doing this that I know of.Ah, it needs to initiated by the client?
I was confused as you said
Is there a way to trigger a CombatManager.replaceCombatantToken call and all it executes in a normal FGU environment without the host having the map up (ie. from a client)?
Since you could just close the map on host and trigger CombatManager.replaceCombatantToken from the CT, that appeared to satisfy your request. I see in a prior post you specify that "from a client" is not merely an example (as said by "ie" in the post I just quoted) but a requirement (which I now see you specify in the first post).
SilentRuin
October 6th, 2022, 15:56
Ah, it needs to initiated by the client?
I was confused as you said
Since you could just close the map on host and trigger CombatManager.replaceCombatantToken from the CT, that appeared to satisfy your request. I see in a prior post you specify that "from a client" is not merely an example (as said by "ie" in the post I just quoted) but a requirement (which I now see you specify in the first post).
It would work purely from host if you can trigger it on a map that is not open. How do I trigger replace of a token from CT without a map? Maybe that is the solution - I just don't know how to do that. Do you have an example? As if the map is "open" then the token will be replaced correctly. It requires the token operation to occur while the map is closed on the host. Even if you just have a host. Per my example with Death Indicators - but that requires and extension as it triggers off of wounds value changing and is not dependent on dropping anything on an active map. I mean to replace a token it already has to be on the map obviously.
bmos
October 6th, 2022, 20:04
It would work purely from host if you can trigger it on a map that is not open. How do I trigger replace of a token from CT without a map? Maybe that is the solution - I just don't know how to do that. Do you have an example? As if the map is "open" then the token will be replaced correctly. It requires the token operation to occur while the map is closed on the host. Even if you just have a host. Per my example with Death Indicators - but that requires and extension as it triggers off of wounds value changing and is not dependent on dropping anything on an active map. I mean to replace a token it already has to be on the map obviously.I'll do a quick test and let you know. I assumed just dragging a new token onto the actor in the CT would call it.
bmos
October 6th, 2022, 20:10
Confirmed. CombatManager.replaceCombatantToken is called when you do this (without any extensions):
1. Open map
2. Open CT
3. Add ct actor to map
4. Close map
5. Drag new token onto actor in combat tracker
6. Re-open map and note token is a different size
and actually, the token is replaced with a token of a different size when you do it with the map closed even with a medium creature (although it's more subtle with a medium creature as it just gets a bit bigger).
So I guess this is your reproducible test scenario, Moon.
SilentRuin
October 6th, 2022, 20:23
Confirmed. CombatManager.replaceCombatantToken is called when you do this (without any extensions):
1. Open map
2. Open CT
3. Add ct actor to map
4. Close map
5. Drag new token onto actor in combat tracker
and actually, the token is replaced with a token of a different size when you do it with the map open vs closed.
even with a medium creature.
So I guess this is your reproducible test scenario, Moon.
Awesome - THANK YOU!!! :) I really did not want to bother with making a one off extension to show this - appreciate it!
Moon Wizard
October 8th, 2022, 01:55
This should be addressed in the Test channel. Thanks to @bmos for recreating so succinctly.
Regards,
JPG
bmos
October 8th, 2022, 03:03
@SR, in case you are interested:
The change seems to have occurred in manager_image.lua in the onTokenAdd function.
SilentRuin
October 8th, 2022, 04:50
Verified it works in TEST with the same operations I have it happening with in LIVE. Thanks this has been bugging me for years, just could never find the pattern till now - and thank you bmos for finding a non extension way to duplicate it!
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.