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 .
Advertisement Create a free account

Problem getting It's A Trap 4E theme to work...

Hello my fellow humans,  I've been trying to get the It's A Trap API (made by Stephen L.) to work for my DnD 4E game, but I ran into an error... Had to dig deep to find the 4E theme since it's not on the one-click list anymore (found it here ); the trapmaker macro seems to work ok, but as soon as I try to put any variables in the Theme-specific properties I get the following error when triggering the trap: "ERROR - It's A Trap!: TrapTheme.getSheetAttr is not a function" "TypeError: TrapTheme.getSheetAttr is not a function     at TrapThemeDnD4.getPassivePerception (apiscript.js:27677:26)     at TrapThemeDnD4.passiveSearch (apiscript.js:27348:21)     at apiscript.js:24754:15     at Function.each (/home/node/d20-api-server/node_modules/underscore/underscore-umd.js:1330:9)     at _$1.<computed> [as each] (/home/node/d20-api-server/node_modules/underscore/underscore-umd.js:1849:39)     at _checkPassiveSearch (apiscript.js:24753:8)     at _checkTrapInteractions (apiscript.js:24782:9)     at apiscript.js:25259:9     at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:161:1), <anonymous>:65:16)     at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:161:1), <anonymous>:70:8)"  Anybody out there who can tell me what's wrong and how to fix it? I will send you a million goblins each carrying a gold piece for your troubles ♥
If anyone else has this problem and needs the fix, I got a response from the author of the API and instead of the repository listed above use the below script for the 4E theme: (() => { 'use strict'; // A mapping of saving throw short names to their attribute names. const DEFENSE_NAMES = { 'ac': 'ac', 'fort': 'fort', 'ref': 'ref', 'will': 'will' }; // Register the theme with ItsATrap. on('ready', () => { /** * A theme for the D&D 4th Edition character sheet. */ class TrapThemeDnD4 extends D20TrapTheme4E { /** * @inheritdoc */ get name() { return 'DnD4'; } /** * @inheritdoc */ getDefense(character, defenseName) { return CharSheetUtils.getSheetAttr(character, DEFENSE_NAMES[defenseName]); } /** * @inheritdoc */ getPassivePerception(character) { return CharSheetUtils.getSheetAttr(character, 'passive-perception'); } } ItsATrap.registerTheme(new TrapThemeDnD4()); }); })();