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

Macro for basic NPC stats not working on some tokens. 5th Edition D&D

So, I've made a macro for myself to blurt out some basic statistics of NPC for myself so I don't have to go back and forth to the character sheet, but some NPC's dont really play nice with the macro while some do. The macro in question is: /w gm &{template:default} {{name=@{selected|npc_name}}} {{Armor Class= @{selected|npc_AC} @{selected|npc_actype}}} {{Hit Dice= @{selected|npc_hpformula} | [[@{selected|npc_hpformula}]]}} {{Speed= @{selected|npc_speed}}} {{Senses=@{selected|npc_senses}}} {{Condition Immunity=@{selected|npc_condition_immunities}}} {{Resistances= @{selected|npc_resistances}}} {{Immunities= @{selected|npc_immunities}}}  The result would be the following: I have a problem with some NPC's and the following error occurs:  SyntaxError: Expected [0-9] but " " found. Does anyone know what the problem can be? I can provide some more information if I'm told what I need to check but as of now I'm clueless as to why it doesn't work.
1612006850

Edited 1612007530
jim s. said: The  basic  role templates in the  5e  sheet use the default Roll20 Big Pink Button. This is fine for a Chat Menu with  a few  commands, but it really makes the output ... This does  not  handle spellcasting, again, because there are too many conditional . dying light console commands ... Like the Statblock   macro , this will only   work   on   NPC tokens . Um... I'm not sure I'm following what you're saying? Even more, I'm not exactly sure what you mean by spellcasting or dying light console commands?
1612010508
GiGs
Pro
Sheet Author
API Scripter
Zanderaf said: Um... I'm not sure I'm following what you're saying? Even more, I'm not exactly sure what you mean by spellcasting or dying light console commands? That's spam. See the link? (don't click it.) Ignore the message, it's not helpful.
1612054812
Oosh
Sheet Author
API Scripter
It looks like the only calculation you have in there is the npc_hpformula one, so I'd say that's the problem. Inline roll brackets need a digit to work with, [[ ]] will cause an error. To avoid this you can prefix your Attribute with a zero: [[ 0 @{selected|npc_hpformula} ]] This has no effect on an existing number [[ 1d6 ]] => [[ 01d6 ]] But if the Attribute is blank it will stop the error [[ ]] => [[ 0 ]]
Oosh said: It looks like the only calculation you have in there is the npc_hpformula one, so I'd say that's the problem. Inline roll brackets need a digit to work with, [[ ]] will cause an error. To avoid this you can prefix your Attribute with a zero: [[ 0 @{selected|npc_hpformula} ]] This has no effect on an existing number [[ 1d6 ]] => [[ 01d6 ]] But if the Attribute is blank it will stop the error [[ ]] => [[ 0 ]] Thanks! I figured out what was causing it in the end. It was mostly for the premade base level tokens I've been making for the Tasha's Cauldron of Everything new Summoning spells. The NPC where the macro was working on had their HP set like: Hit Points: 40      Formula: 40 + (10 for each spell level above 4th) While the ones that weren't working had their HP fields set like: Hit Points: 40      Formula: + 10 for each spell level above 5th It wasn't putting out the template at all but that fix you suggested fixed it even while it was broken and made me discover what I did wrong. Thanks a lot!
1612111236
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Oosh said: It looks like the only calculation you have in there is the npc_hpformula one, so I'd say that's the problem. Inline roll brackets need a digit to work with, [[ ]] will cause an error. To avoid this you can prefix your Attribute with a zero: [[ 0 @{selected|npc_hpformula} ]] This has no effect on an existing number [[ 1d6 ]] => [[ 01d6 ]] But if the Attribute is blank it will stop the error [[ ]] => [[ 0 ]] Stupid Trick ?
1612134777

Edited 1612134811
Oosh
Sheet Author
API Scripter
keithcurtis said: Stupid Trick ? It's already in there :) I was either in a hurry or just too lazy to link the trick... sorry Ziechael!
1612179297
Ziechael
Forum Champion
Sheet Author
API Scripter
I don't do it for the glory... but I'll take it ;)