Aedif / TokenVariants

GNU General Public License v3.0
17 stars 12 forks source link

"token-variants-combat" doesn't properly save or switch #112

Open megahead11 opened 1 year ago

megahead11 commented 1 year ago

Hi, using 4.40.0 on v10, but I have tried this on v11 with no other modules on. Using "token-variants-combat" no longer appears to work, as it just causes the setting to not save, and for characters that have the setting, it doesn't apply when entering combat.

I do not receive a console error when this happens. This only happens when attempting to change the token image, not when applying text. Text overlay seems to work fine.

Aedif commented 1 year ago

Are you perhaps trying to change the image as well as apply an overlay at the same time?

Aedif commented 1 year ago

Just making sure because I believe I found a bug regarding that particular situation. However token-variants-combat seems to work fine when used just to change the token image.

megahead11 commented 1 year ago

Yeah, it happens when I don't do anything other than apply an image. For the record, I am also specifying a specific image using the file browser (right-clicking the select image thing).

When I do this specifically, and hit save. I get nothing. To further clarify, this is on a fresh world, foundry V11 Stable 299; dnd 2.2.1 https://i.gyazo.com/36815ae00be55c066b7572e1ffdbb681.mp4

Aedif commented 1 year ago

If you expand the Text Overlays group, do you see token-variants-combat under tthere? image

You can only have one effect using that name.

When you shift-left click the Toggle Combat State button or any of the effects in the Assign Status Effects menu, the module will by default create a Text Overlay mappings to get you started. I should probably expand that heading by default to make this clearer.

Aedif commented 1 year ago

A hacky way to get around this limitation would be to use operators that keep the expressions logically the same, but end up giving each mapping a unique name: image

Top one translates to "Not Not token-variants-combat" which cancels out to just token-variants-combat

and 2nd one just surrounds token-variants-combat in brackets which do nothing.

megahead11 commented 1 year ago

Oh! Yes, it looks like it was the text overlay having it by default that caused it. I got confused because a couple of times, the text overlay seemed to have poofed or ate the top one. I do agree, it should probably be expanded by default to make it a little more obvious, but that solves that mystery!

megahead11 commented 1 year ago

For some odd reason, one of my player characters has the overlay/text "token-variants-combat" version (the one on the bottom half section) keeps coming back to the configuration despite it being deleted. This is a v10 one, not a v11. I don't know what's up, but I can't set up the one on the top without the bottom one showing up and deleting it, and the !! token-variants-combat doesn't seem to work when I want to set up an alternative token.

Aedif commented 1 year ago

It'd be easier if you just exported your Global and actor specific mappings and linked them to me here.

megahead11 commented 1 year ago

Yeah, I'll go ahead and do that. I exported the character to v11 and there seems to still be problems with this one character, as each time I delete the mapping, it seems to bring it back for some odd reason. (I attached both the mappings and the actor I seem to be having issues on in the zip) mappings.zip

megahead11 commented 1 year ago

Oh, here's the v10 one as well, in case its necessary. burnt jsons.zip

Aedif commented 1 year ago

Delete this: image

And rename your top mapping to token-variants-combat image

As I mentioned before when you Shift-left click this button: image

the module generates a new mapping with the name token-variants-combat IF it doesn't yet exists.

\!\! token-variants-combat is not recognised by the module as being the same as token-variants-combat so it creates a new mapping.

To avoid this issue completely, simply access that menu via Shift-left clicking this button: image

Or right-clicking the TVA button and selecting Effect Config: image

If accessed via those methods the module will not create any new mappings.

megahead11 commented 1 year ago

Gosh, I feel dumb now lol I didn't connect in my head that every time you press the combat button, it generates a new one even though you said it. For some reason, I thought it was the first time, or when the actor doesn't have one defined.

megahead11 commented 1 year ago

After messing around with it on v11, it works now that I have it set up that way. The v10 version required me to delete all of the other mappings before I could get the state to change for some odd reason.

Also, for some odd reason it keeps switching to a non-existant token image when I drag and drop the actor into the world, despite me not having any mappings for it (I changed the prototype). I haven't modified the settings on the module other than those mappings. I'm guessing it could be some weird thing in the data, but I'm unsure. I'm guessing it's unrelated to this, but I'll include my config and the actor again. https://gyazo.com/e0be277de166960b07b7752a82547bd6.mp4 I'm guessing it's keeping a variant saved, as the old and switching to it despite it being a linked PC? Is there possibly a way to remove the variant if it's not tied to the token?

megahead11 commented 1 year ago

Forgot to attach the actor's file and my configs. Whoops. (This is v11) burnt xochi again.zip

Aedif commented 1 year ago

What is the path of this non-existent image? What image is the token being set to?

megahead11 commented 1 year ago

The token prototype is set to assets/2.png, but the non-existant image (not mapped) is worlds/ashes-of-a-lost-home/tokens/Status/Xochi/XochiToken.png ; a folder that doesn't exist on the v11 client. Kinda weird that it's still looking for that image despite it being unmapped as a active effects variant and prototype, but that is what the error says. Half wondering if it's just my foundry client being weird or some corruption in the db or the actor's data.

image

Aedif commented 1 year ago

select your token and run this: _token.document.unsetFlag('token-variants', 'defaultImg') Then go to prototype token and then press Assign Token: image

I think that should fix it. I'll look into this later. This is definitely unintended behaviour.