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

PowerCards Template problems

1597069299

Edited 1597241124
Wab
Pro
Hi there, I am just getting into the meat of how to properly utilize PowerCards for my games, and I ran into an issue I can't resolve. I am trying to expand on the example used in the "PowerCards : Templates and Replacements" Tutorial video, adding some logic to display misses, hits, and crits. I started by making sure the base PowerCard Worked, which it does: !power {{ --name|@{selected|character_name} - Quarterstaff Attack --Attack Roll:|[[ [$Atk] 1d20 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF] ]] vs @{target|character_name}'s @{target|AC} AC --?? $Atk < @{target|AC}?? Damage:|Missed! --?? $Atk > @{target|AC}?? Damage:|[[ [$Dmg] 1d6 + @{selected|strength_mod} [STR] ]] Bludgeoning --?? $Atk.base = 20?? Crit!:|[[ [$Crit] 2d6 + @{selected|strength_mod} [STR] ]] Bludgeoning }} Which is exactly what I want So i then wrote it as a template, and made the templated macro to follow ( Variable key will be right above that, to easier reading ) 0 - Character Name | @{selected|character_name} 1 - Weapon | Quarterstaff 2 - Ability Modifier | @{selected|strength_mod} 3 - Ability | STR 4 - Proficiency Bonus | @{selected|pb} 5 - Target's Name | @{target|character_name} 6 - Target AC | @{target|AC} 7 - Damage | 1d6 8 - Crit Damage | 2d6 9 - Damage Type | bludgeoning Also, I put it on multiple lines for better reading while editing, I remove newline characters before adding into roll20 # PowerCard Templates Handout WeaponAttack:--name|~0! - ~1! Attack --Attack Roll:|[[ [$Atk] 1d20 + ~2! [~3!] + ~4! [PROF] ]] vs ~5!'s ~6! AC --?? $Atk < @{target|AC}?? Damage:|Missed! --?? $Atk > @{target|AC}?? Damage:|[[ [$Dmg] ~7! + ~2! [~3!] ]] ~9! --?? $Atk.base = 20?? Crit!:|[[ [$Crit] ~8! + ~2! [~3!] ]] ~9! # 04-QuarterStaff-Template Macro !power {{ --template|WeaponAttack|@{selected|character_name};Quarterstaff;@{selected|strength_mod};STR;@{selected|pb};@{target|AC};1d6;2d6;bludgeoning }} When I run this, I get an error on the script that causes it to crash: TypeError: Cannot read property '0' of null TypeError: Cannot read property '0' of null at apiscript.js:1509:48 at Array.forEach (<anonymous>) at apiscript.js:1499:10 at checkFinishedOps (eval at <anonymous> (/home/node/d20-api-server/api.js:158:1), <anonymous>:757:7) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:158:1), <anonymous>:837:8) at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:825:19) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) I am not sure what is not reading properly. Any thought would be greatly appreciated. Edit: Images didn't want to load. So Codeblocks instead
Hi Wab! Just at a quick glance, it looks like you are only passing 9 values in your template call when you have 10 values defined in your macro. You are missing @{target|character_name} in the template macro.