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

TypeError: Cannot read property 'substring' of undefined - Again

Hi everybody As I don't have any experience in programming, I'd like to apologize for what seems to be basic question, but after having read quite a lot of internet pages and wikis, I still have no idea what's wrong with my macro... I'd like to run a silent perception check for my party (composed atm of Gruuf and Gruuf2) with the Pathfinder Sheet If I select either one of the players and use the macro : /w gm &{template:pf_generic} @{selected|toggle_accessible_flag} @{selected|toggle_rounded_flag}{{color=@{selected|rolltemplate_color}}} {{header_image=@{selected|header_image-pf_generic}}} {{subtitle}} {{name=[Perception]( <a href="http://www.d20pfsrd.com/skills/perception" rel="nofollow">http://www.d20pfsrd.com/skills/perception</a>)} } {{Gruuf =[[(1d20 + [[@{Gruuf|Perception}]] [Perc] + [[@{Gruuf|perception-racial}]] [Race] + [[@{Gruuf|perception-trait}]] [Trait] + [[@{Gruuf|perception-feat}]] [Feat] + [[@{Gruuf|perception-item}]] [Item])]]}}{{Gruuf2 =[[(1d20 + [[@{Gruuf2|Perception}]] [Perc] + [[@{Gruuf2|perception-racial}]] [Race] + [[@{Gruuf2|perception-trait}]] [Trait] + [[@{Gruuf2|perception-feat}]] [Feat] + [[@{Gruuf2|perception-item}]] [Item])]]}} there's no problem whatsoever. However if I use : /w gm &{template:pf_generic} @{toggle_accessible_flag} @{toggle_rounded_flag}{{color=@{rolltemplate_color}}} {{header_image=@{header_image-pf_generic}}} {{subtitle}} {{name=[Perception]( <a href="http://www.d20pfsrd.com/skills/perception" rel="nofollow">http://www.d20pfsrd.com/skills/perception</a>)} } {{Gruuf =[[(1d20 + [[@{Gruuf|Perception}]] [Perc] + [[@{Gruuf|perception-racial}]] [Race] + [[@{Gruuf|perception-trait}]] [Trait] + [[@{Gruuf|perception-feat}]] [Feat] + [[@{Gruuf|perception-item}]] [Item])]]}}{{Gruuf2 =[[(1d20 + [[@{Gruuf2|Perception}]] [Perc] + [[@{Gruuf2|perception-racial}]] [Race] + [[@{Gruuf2|perception-trait}]] [Trait] + [[@{Gruuf2|perception-feat}]] [Feat] + [[@{Gruuf2|perception-item}]] [Item])]]}} it returns the error : TypeError: Cannot read property 'substring' of undefined I understand some of the code used (I copy pasted it from a website and tweaked it a bit), but I don't really understand how that template thingy works :s Hope you can help me Corwin
1493478218

Edited 1493478225
The Aaron
Pro
API Scripter
In the second one, you have @{rolltemplate_color} instead of @{ selected| rolltemplate_color}. &nbsp;That's probably the issue...
1493478270
The Aaron
Pro
API Scripter
ditto @{header_image-pf_generic}
1493478360
The Aaron
Pro
API Scripter
Try this: /w gm &{template:pf_generic} @{selected|toggle_accessible_flag} @{selected|toggle_rounded_flag}{{color=@{selected|rolltemplate_color}}} {{header_image=@{selected|header_image-pf_generic}}} {{subtitle}} {{name=[Perception](<a href="http://www.d20pfsrd.com/skills/perception" rel="nofollow">http://www.d20pfsrd.com/skills/perception</a>)}} {{Gruuf =[[(1d20 + [[@{Gruuf|Perception}]] [Perc] + [[@{Gruuf|perception-racial}]] [Race] + [[@{Gruuf|perception-trait}]] [Trait] + [[@{Gruuf|perception-feat}]] [Feat] + [[@{Gruuf|perception-item}]] [Item])]]}}{{Gruuf2 =[[(1d20 + [[@{Gruuf2|Perception}]] [Perc] + [[@{Gruuf2|perception-racial}]] [Race] + [[@{Gruuf2|perception-trait}]] [Trait] + [[@{Gruuf2|perception-feat}]] [Feat] + [[@{Gruuf2|perception-item}]] [Item])]]}}
Thanks for the (very) quick answer That was the point... I didn't want to have anything selected, as it is a silent party macro. Wouldn't then matter if a NPC was selected, or a monster, or anything else
1493478855

Edited 1493479297
Corwin Whitehorn said: I didn't want to have anything selected In that case, either Remove the keywordless Attribute calls (plus any corresponding fields) from the macro, i.e. @{toggle_accessible_flag} @{toggle_rounded_flag}{{color=@{rolltemplate_color}}}{{header_image=@{header_image-pf_generic}}}) Or, add the &lt;character_name&gt; keyword to all of the above Attribute calls, e.g. @{Gruuf|toggle_accessible_flag} Or, determine what each of the above Attribute calls do/affect and then replace them with your desired values Attribute calls (e.g. @{AC}) that are not placed within one of tabs of a Character Window (e.g. within a field on the Character Sheet Tab or within an Ability on the Attributes & Abilities Tab ) must use a keyword to let the parser know which Character you intend to call that Attribute from (e.g. @{selected|AC}). Using a Selected Token with a Macro Using a Targeted Token with a Macro
1493478927
The Aaron
Pro
API Scripter
Ah. &nbsp;So there are two ways around that. 1)&nbsp;&nbsp;add as an ability on the character so that they can reference attributes on that character. /w gm &{template:pf_generic} @{toggle_accessible_flag} @{toggle_rounded_flag}{{color=@{rolltemplate_color}}} {{header_image=@{header_image-pf_generic}}} {{subtitle}} {{name=[Perception](<a href="http://www.d20pfsrd.com/skills/perception" rel="nofollow">http://www.d20pfsrd.com/skills/perception</a>)}} {{@{character_name} =[[(1d20 + [[@{Perception}]] [Perc] + [[@{perception-racial}]] [Race] + [[@{perception-trait}]] [Trait] + [[@{perception-feat}]] [Feat] + [[@{perception-item}]] [Item])]]}} then call with the % syntax on a specify character: %{Gruuf|perception-check-ability} %{Gruuf2|perception-check-ability} 2) Use one of the characters to grab the default template settings: /w gm &{template:pf_generic} @{Gruuf|toggle_accessible_flag} @{Gruuf|toggle_rounded_flag}{{color=@{Gruuf|rolltemplate_color}}} {{header_image=@{Gruuf|header_image-pf_generic}}} {{subtitle}} {{name=[Perception](<a href="http://www.d20pfsrd.com/skills/perception" rel="nofollow">http://www.d20pfsrd.com/skills/perception</a>)}} {{Gruuf =[[(1d20 + [[@{Gruuf|Perception}]] [Perc] + [[@{Gruuf|perception-racial}]] [Race] + [[@{Gruuf|perception-trait}]] [Trait] + [[@{Gruuf|perception-feat}]] [Feat] + [[@{Gruuf|perception-item}]] [Item])]]}}{{Gruuf2 =[[(1d20 + [[@{Gruuf2|Perception}]] [Perc] + [[@{Gruuf2|perception-racial}]] [Race] + [[@{Gruuf2|perception-trait}]] [Trait] + [[@{Gruuf2|perception-feat}]] [Feat] + [[@{Gruuf2|perception-item}]] [Item])]]}}
1493478964
The Aaron
Pro
API Scripter
(What Silvyre said! =D)
Thanks a lot to both of you! Of course, it looks so simple now that I know the answer :D. I just didn't understand why I had to select something to give rounded corners to a dice result.:s And to thinks that I wanted to make a macro that would automatically get the name of all the PC present and then make their perception roll...I'm definitively not on that level :D May the dice be with you ;)