ultrakorne / better-rolltables

Module for FoundryVTT to improve rolltables
MIT License
32 stars 28 forks source link

In Foundry v.0.8.9 updating from module v.1.8.6 to v.1.8.91 disables the ability to use Better Roll Tables #158

Closed magispitt closed 2 years ago

magispitt commented 2 years ago

image

I am uncertain if this is related to the advertised interface updates

image

DanielBoettner commented 2 years ago

@magispitt

Does the browser console give any errors?

magispitt commented 2 years ago

@magispitt

Does the browser console give any errors?

I see the following errors after pressing F12 on Microsoft Edge using the Forge as a host:

image

image

image

DanielBoettner commented 2 years ago

Lets start from the bottom.

Handlebars issue

Could you click on the small arrow next to d and post a screenshot of the handlebars issue? I can imagine that there is a bug regarding filepaths (windows/linux).

updateSpellCache

The line in question tries to get the default spell compendium.

const defaultPack = game.settings.get(MODULE.ns, BRTCONFIG.SPELL_COMPENDIUM_KEY);
      if (!pack || pack === defaultPack) {
        const spellCompendium = game.packs.get(defaultPack);
        const spellCompendiumIndex = await spellCompendium.getIndex({ fields: ['data.level', 'img'] });

In the settings we set the default compendium to pf2e.spells-srd. Could you make sure that this compendium exists? Or if you changed the compendium, make sure this one exists. Either way, I will try to add a check to above code that checks if a spellCompendium was loaded successfully.

Item issue

The error at the top would suggest that maybe the structure of items we expect is 5e but we get PF2E. But that could be an unrelated error.

magispitt commented 2 years ago

Lets start from the bottom.

Handlebars issue

Could you click on the small arrow next to d and post a screenshot of the handlebars issue? I can imagine that there is a bug regarding filepaths (windows/linux).

updateSpellCache

The line in question tries to get the default spell compendium.

const defaultPack = game.settings.get(MODULE.ns, BRTCONFIG.SPELL_COMPENDIUM_KEY);
      if (!pack || pack === defaultPack) {
        const spellCompendium = game.packs.get(defaultPack);
        const spellCompendiumIndex = await spellCompendium.getIndex({ fields: ['data.level', 'img'] });

In the settings we set the default compendium to pf2e.spells-srd. Could you make sure that this compendium exists? Or if you changed the compendium, make sure this one exists. Either way, I will try to add a check to above code that checks if a spellCompendium was loaded successfully.

Item issue

The error at the top would suggest that maybe the structure of items we expect is 5e but we get PF2E. But that could be an unrelated error.

Alright, for the handlebars error the drop-down menu reveals this:

image

if I reveal the drop-down menu within that it reveals this, which in turn has further drop-down menus (which I can post if needed)

image

The error triggering for Pathfinder 2e content confuses me, because the world I'm running is a Pathfinder 1e world. I don't see any Pathfinder 2e compendiums loaded within the world, but I do have a second world (which is Pathfinder 2e) that is also hosted on Forge -- should I be checking that world as well?

*edit: I think I have resolved that handlebar error, there was a tile that was using an image I had changed

DanielBoettner commented 2 years ago

You could test with PF2e world. Did you check the settings for BetterRolltables if you can set the default spell compendium?

Please try the following.

put in the following into the console (bottom part, if you don't see it hit [Esc])

I would like to know what that says. Because I just guessed PF2E as a system because I read something with ItemPF. So if this doesn't say pf2e that is likely the problem.

So far in the code we only take care of PF2E. What exactly changed that it worked before with PF1 is another question.

If the above says undefined or null or something.

DanielBoettner commented 2 years ago

Please test the latest release. This should fix your problem.

Please be aware that BetterRolltables does not officially support PF1. There are likely more errors.

magispitt commented 2 years ago

You could test with PF2e world. Did you check the settings for BetterRolltables if you can set the default spell compendium?

Please try the following.

  • Press [F12] to open the console

put in the following into the console (bottom part, if you don't see it hit [Esc])

  • game.system.id an press [Enter]

I would like to know what that says. Because I just guessed PF2E as a system because I read something with ItemPF. So if this doesn't say pf2e that is likely the problem.

So far in the code we only take care of PF2E. What exactly changed that it worked before with PF1 is another question.

  • copy this into the console

    • game.settings.get('better-rolltables', 'default-spell-compendium') and press [Enter]
    • This should give you some kind of textstring like pf1.spells

If the above says undefined or null or something.

  • go into the settings
  • go to the Better Rolltable Settings
  • Check or select the spell compendium (some compendium with spells, preferably PF1 spells)
  • check again via console game.settings.get('better-rolltables', 'default-spell-compendium')

This is on the v.1.8.91 version, I see you have kindly updated the system but I will conduct the requested tests on this version first -- the module appears to work on the Pathfinder 2e system, as you suggested

image

Ah yes it appears that the game.system.id return pf1 on my Pathfinder 1e game. I had not actually attempted to use the automatic compendium integration before with Pathfinder 1e on Better Rolltables, I was only dragging actors onto my rolltables and using Better Rolltables to roll the number of actors within the table -- e.g. a table might look like (roll 1d3):

  1. One of actor A
  2. Two of actor A
  3. 1d6+2 of actor A

image

Curiously, my Pathfinder 1e game appears to be using D&D 5e spells when I enter:

game.settings.get('better-rolltables', 'default-spell-compendium')

image

Within the settings I'm uncertain how to change the spell directory used, but I see that there is an update so I will now test that

image

magispitt commented 2 years ago

Please test the latest release. This should fix your problem.

Please be aware that BetterRolltables does not officially support PF1. There are likely more errors.

Alright unfortunately after loading the new update I see this error for a few seconds before it automatically dissapears:

image

Fortunately though the initial issue appears to have been resolved and I can use the Better Rolltable functionality again!

image

Thank you kindlly for your assistance!

DanielBoettner commented 2 years ago

The error appears cause the thing the error suggests happend. That is because. In the code we default to dnd5e.spells.

For PF2e we do

 if (game.system.id === 'pf2e') {
            defaultLootSheet = 'pf2e.LootSheetNPC';
            defaultSpellCompendium = 'pf2e.spells-srd';

            BRTCONFIG.QUANTITY_PROPERTY_PATH = 'data.quantity.value';
            BRTCONFIG.PRICE_PROPERTY_PATH = 'data.price.value';
            BRTCONFIG.SPELL_LEVEL_PATH = 'data.level.value';
            BRTCONFIG.ITEM_LOOT_TYPE = 'treasure';
            // pf2e scroll is "Scroll of 1st-level Spell"
            BRTCONFIG.SCROLL_REGEX = /\s*Scroll\s*of\s*(\d+)/gi;
        }

You could try to set the compendium to pf1.spells in the settings. In the below image you made, that would be the second line.

image

I tried to get conformation on the PF1 structure on discord, but no response yet.