Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

GetCompendiumPage with no compendium - Detect if the compendium is installed

1667777669
Jiboux
Pro
Sheet Author
Compendium Curator
Hello all, I have been working several months on compendium integration for my sheet, and am very close to release, and just remembered about a problem that I left unsolved. I heavily use in my sheetworker the function GetCompendiumPage to prefill data from the compendium database, but it seems that if there is no compendium installed on the game, this function just "freezes". I have tried to emulate the problem by removing the compendium from the game, and a very simple log:       getCompendiumPage(cat + values[pre+"Name"].trim(), compendium_pages => {        log( "Earthdawn-Autofill : Compendium Search result " +  JSON.stringify(compendium_pages)); In the above snippet for a game that doesn’t have the compendium, I never get to the log… meaning my code will become completely non-functional for non-compendium users. What workaround are there ? Is it possible in the sheetworkers to detect if a compendium is installed ? If the JSON with the default parameters of the sheet actually declares a compendium, What actually happens for getCompendiumPage for a user that didn’t buy any expansion ? Does the function return with no result ? Thanks a lot for your support
1667874739
Jiboux
Pro
Sheet Author
Compendium Curator
OK, I think I got my answer, that I will document here... I ran the same game 3 times, with different settings: Ran the game, with Game Settings / Compendium set to the compendium my sheet is supposed to work with Ran the game with Game Settings / Compendium set to a random other system I didn't purchase on the marketplace Ran the game with Game Settings / Compendium set to "None". In case 3, the behaviour described above (i.e. getcompendiumpage not calling back the callback function) did happen. In case 2, getcompendiumpage actually called back but with empty results Case 1, it returned the right results... My understanding is that because my default parameter JSON sets the compendium, anyone running the sheet, but that didn't buy the compendium will be in case 2 (i.e. there will be a compendium declared for the game, just he will not have the access)... So it seems it will work...