vtt-lair / token-replacer

Foundry VTT - Automatically replace NPC actor tokens and/or portraits dependent on token assets saved in a defined folder structure
MIT License
5 stars 4 forks source link

Save button breaks when enabling debug logging #73

Closed kageru closed 3 years ago

kageru commented 3 years ago

After your recent refactoring, the save button is once again broken when debug logging is enabled, only logging

ReferenceError: imageNameFormat is not defined
    at TokenReplacerSetup._updateObject (token-replacer.js:152)

to the console. This is caused by this part of the code which I fixed just last week:

        if (isTRDebug) {
            if (folderNameFormat === "proper") {
                folderNameFormat = " ";
            }
            if (imageNameFormat === "proper") {
                imageNameFormat = " ";
            }
            console.log(`Token Replacer: Format Structure Setup: '${tr_tokenDirectory.activeSource}/${tr_tokenDirectory.current}/${diffName}${folderNameFormat}0_25/Monster${imageNameFormat}Name.png'`);
        }

because after your recent changes, these nameFormat variables no longer exist (instead you use the index from the dropdown in line 113, right below my now-outdated comment about not using const). The logging should be changed accordingly (or removed entirely).

vtt-lair commented 3 years ago

sigh sorry about that. Will get a new version out a bit later today.