Aedif / TokenVariants

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

Issue to Configure Settings #71

Closed Flylicorne closed 2 years ago

Flylicorne commented 2 years ago

Using the module v2.10.1 on Foundry VTT with all others module deactivated. I tried to uninstall/reinstall it as well and same error appears. When i try to configure settings and click on Settings, nothing Happen.

foundry.js:319 TypeError: Cannot read properties of undefined (reading 'startsWith') [Detected 3 packages: token-variants, colorsettings, lib-wrapper] at ConfigureSettings._pathIcon (configureSettings.js:465) at configureSettings.js:61 at Array.map () at ConfigureSettings.getData (configureSettings.js:58) at ConfigureSettings._render (foundry.js:3062) at ConfigureSettings._render (foundry.js:3764) at ConfigureSettings.render (foundry.js:3021) at ExtendedSettingsConfig.onClickSubmenuWrapper (colorSetting.js:20) at Wrapper.🎁call_wrapper [as call_wrapper] (libWrapper-wrapper.js:595) at ExtendedSettingsConfig.🎁SettingsConfig.prototype._onClickSubmenu#0 (libWrapper-wrapper.js:189) at HTMLButtonElement.dispatch (jquery.min.js:2) at HTMLButtonElement.v.handle (jquery.min.js:2)

+ Before the update, when a token was send to the board, a popup appears to select another token image. Since, the update, nothing appear anymore.
Aedif commented 2 years ago

Hi,

I think your search paths got corrupted somehow.

Mind running the following in console?:

game.modules.get("token-variants").api.TVA_CONFIG.searchPaths

image

You should see something similar to the example above ^

Do you notice any source: missing or being equal to NULL or 'undefined'?

Aedif commented 2 years ago

source: should have been automatically set for you, but for some reason it hasn't. I'm not sure how savy you are with the console but your bug could be fixed by manually editting the setting:

image

image

Or if you want to keep it simple and don't mind re-entering the paths you could just run:

game.modules.get("token-variants").api.TVA_CONFIG.searchPaths = []

This will remove all your search paths but allow you to open the Configure Settings.

SR5060 commented 2 years ago

This happened to me as well. I was able to use your code to clear and remap and that fixed it, but wanted to flag in case there was something funky causing the corruption.

Aedif commented 2 years ago

If you saw it do you perhaps remember if any of your paths were missing "source"? If you do what type of path was it (data/s3/rolltable etc)

SR5060 commented 2 years ago

Sorry, I didn't bother checking since I was confident your fix would work. But I only had "data" directories listed previously

Flylicorne commented 2 years ago

game.modules.get("token-variants").api.TVA_CONFIG.searchPaths = []

Hi,

Thank you, i am able to open the settings now. Huge thanks for your assistance on it.

Flylicorne commented 2 years ago

Is there a reason i dont see the Variant pop up when i move a Token on my board game. In the past version, when i move a token to the game board, a pop up appear to change the token image. It doesn't appear anymore now. Is that expected behavior ?

Aedif commented 2 years ago

Pop-ups can be enabled/disabled through various means.

If you want the pop-ups to appear first make sure that they're not disabled for the actor type you're dragging onto the board and that On Token Create is unchecked here:

image

Also make sure that you have the permissions enabled:

image

If you're using the randomizer then that will be prioritized over opening the pop-up. For example if randomizer is set to randomize the token image on Token Create then the pop-up will not be displayed:

image

If you want randomization but would also like the pop-up displayed for tokens that are not being randomized then enabled Show Art Select pop-up if randomization is disabled

And lastly you can override some of the pop-up settings for a particular token/actor via Shift+Left-Clicking the 'Token HUD button':

image

I realise it's a lot, however it's to allow users to really fine tune the behaviour of the module 😅

Flylicorne commented 2 years ago

Here my settings and still no pop up :

image

image

image

image

image

image

image

image

Token HUD client settings :

image

Compendium Mapper

image

Flylicorne commented 2 years ago

I just update to the last version 2.11 and Pop Up appears now with the same settings.

Aedif commented 2 years ago

Hmm glad to know it's working for you. I didn't actually find the source of the problem but I made the module tolerate the missing source a bit more.

According to your settings the pop-ups should have been appearing in the older versions too.

If it wouldn't bother you too much, would you mind exporting the settings and posting the file here? If you rename the file to token-variants-settings.txt you should be able to just drop it in the text box.

image

This would allow me to exactly replicate the settings that you have and actually fix the source of the problem.

Flylicorne commented 2 years ago

Here the file

token-variants-settings.txt

asdexter commented 2 years ago

Hello, I'm having the same issue as OP, but when I used the console command you provided

game.modules.get("token-variants").api.TVA_CONFIG.searchPaths = []

, a second error pops up when I try to access the module settings

TypeError: Cannot create property 'label' on string '' [Detected 1 package: token-variants] at ConfigureSettings.getData (modules/token-variants/applications/configureSettings.js:75) at ConfigureSettings._render (foundry.js:3062) at ConfigureSettings._render (foundry.js:3764) at ConfigureSettings.render (foundry.js:3021) at SettingsConfig._onClickSubmenu (foundry.js:55705) at HTMLButtonElement.dispatch (jquery.min.js:2) at HTMLButtonElement.v.handle (jquery.min.js:2)

I wonder if the easiest fix for this is to post an exported default settings txt file so that I can import and reset the settings, since for whatever reason the migration between versions seems to have failed (just guessing). Thanks!

Aedif commented 2 years ago

Along with that command could you also run:

game.modules.get("token-variants").api.TVA_CONFIG.searchFilters = { "Portrait": { "include": "", "exclude": "", "regex": "", "label": "Portrait" }, "Token": { "include": "", "exclude": "", "regex": "", "label": "Token" }, "PortraitAndToken": { "include": "", "exclude": "", "regex": "", "label": "PortraitAndToken" }, "Tile": { "include": "", "exclude": "", "regex": "", "label": "Tile" }, "Item": { "include": "", "exclude": "", "regex": "", "label": "Item" }, "JournalEntry": { "include": "", "exclude": "", "regex": "", "label": "JournalEntry" }, "Macro": { "include": "", "exclude": "", "regex": "", "label": "Macro" }, "RollTable": { "include": "", "exclude": "", "regex": "", "label": "RollTable" } }

Then open the 'Configure Settings' window and make sure you press 'Save Changes'.

I'll look into adding a fix for this in the next module release that will not require execution of such commands.

Aedif commented 2 years ago

If you are yet to try out the fix I recommended above I'd recommend updating to 3.4.0. I made some fixes that should hopefully resolve this issue.

asdexter commented 2 years ago

Hey thanks for the update, this resolved the issue!

Aedif commented 2 years ago

All brought up issues should be resolved now. Feel free to comment or re-open the issue if any related problems pop-up again.