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

Need some help repairing 2 npc macros.

Heya! So I spent like 8 hours yesterday fixing some stats macros for pcs, and for npcs. After a bit of fiddling around I got both the pc macros to work, and 1 of the 3 npc macros to work. but for the love of me, I can't figure out what's wrong in the other two. So what I have is the following: PC Base Stats (This one works) /w @{character_name} &{template:default} {{name=🔔Stats @{selected|character_name}}} {{Armor Class= [[@{selected|ac}]]}}{{Health= Now: [[@{selected|hp}]] Max: [[@{selected|hp|max}]]}}{{Spell Save DC | Attack Bonus=  [[@{selected|spell_save_dc}]] | [[@{selected|spell_attack_bonus}]]}}{{Speed= [[@{selected|speed}]]}}{{Passive Perception= [[@{selected|passive_wisdom}]]}}{{Weight Now & Max= [[@{selected|weighttotal}]] | @{selected|weighttotal|max}[[@{selected|strength}*15}]]}} PC Stamina (This one works) /w @{character_name} &{template:default} {{name=🔔Stamina @{selected|character_name}}} {{Exhaustion= [[@{selected|exhaustion_level}]]}}{{Standing= [[@{selected|strength}/2]] Long Jump | [[@{selected|strength}]] High Jump}} {{Running= [[@{selected|strength_mod}+3)/2]] Long Jump | [[@{selected|strength_mod}+3]] High Jump}} {{Hold Breath= [[@{selected|constitution_mod}+1]] min}} {{Rounds w/o Breath= [[@{selected|constitution_mod}]]}} {{Without Food= [[@{selected|constitution_mod}+3]] days}} NPC Base Stats (Does NOT work) /w gm @{selected|wtype} &{template:default} {{name=🔔Stats @{selected|npc_name}}} {{Type= @{selected|npc_type}}} {{Armor Class= [[@{selected|npc_AC}]] (@{selected|npc_actype})}} {{Hit Die= [[@{selected|npc_hpformula}]]}} {{Speed= [[@{selected|npc_speed}]]}} {{Senses= @{selected|npc_senses}}} {{Languages= @{selected|npc_languages}}} {{Spell Save DC & Attack Bonus=  [[@{selected|spell_save_dc}]] | [[@{selected|spell_attack_bonus}]]}} {{Challenge= CR: [[@{selected|npc_challenge}]] (@{selected|npc_xp}xp)}} NPC Resist / Weak (Does NOT work) /w gm @{selected|wtype} &{template:default} {{name=🔔Resistance & Weaknesses @{selected|npc_name}}} {{Name=@{selected|npc_name}}} {{Type= @{selected|npc_type}}} {{Armor Class= @{selected|npc_AC} (@{selected|npc_actype})}} {{Hit Die= [[@{selected|npc_hpformula}]]}} {{Resistance=@{selected|npc_resistances}}}{{Vulnerable=@{selected|npc_vulnerabilities}}} {{Immune=@{selected|npc_immunities}}} {{Condition Immune=@{selected|npc_condition_immunities}}} NPC Stamina (This one works) /w gm @{selected|wtype} &{template:default} {{name=🔔Stamina @{selected|npc_name}}} {{Standing= [[@{selected|strength}/2]] Long Jump | [[@{selected|strength}]] High Jump}} {{Running= [[@{selected|strength_mod}+3)/2]] Long Jump | [[@{selected|strength_mod}+3]] High Jump}} {{Hold Breath= [[@{selected|constitution_mod}+1]] min}} {{Rounds w/o Breath= [[@{selected|constitution_mod}]]}} {{Without Food= [[@{selected|constitution_mod}+3]] days}} Now... if you look at the attached picture, that's the result of using the 3 different NPC macros, where the Stamina macro works, but the other two... does not. I am not a programmer or coder, so I don't really understand how much of these codes work, but since I started with roll20 I have at least learned some stuff, but... if I understand the errors correctly (no guarantee) it complains about a missing symbol somewhere? I guess? But if that's the case I have no idea where. So, anyone knows what I'm missing to have the other two working? (They are pretty much similar, just different information that I had in one big macro before, but decided to split up into smaller macros, but I don't have the old code anymore, and yeah... I really can't see what the issue is?
1596393772
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Haven't tested, but maybe try this format for calculations involving an attribute call: {{Without Food= [[ [[ @{selected|constitution_mod} ]] +3]] days}} note the extra square brackets.
1596426935

Edited 1596427739
Oosh
Sheet Author
API Scripter
They all work when I run them. I'd say some of your NPC Attributes inside the [[ math ]] sections have some nasty characters in them. Have you tried running the macros for something dragged straight from Compendium? edit - I ran them on PC's and they failed. A couple of suggestions: Remove the [[ ]] brackets from anything that doesn't need them, like npc_speed. At least you'll get a blank instead of a crash for any sheet that doesn't have that Attribute set. Maybe change your NPC HP to this: {{Hit Die= @{selected|npc_hpformula}, [Roll HP](~Macros|NPCRollHP)}} That way your macro doesn't crash if they don't have a legal math statement for their HP formula. You'll then need to create a macro (in this example stored on a character sheet called Macros) that does something like this: /w gm &{template:default}{{name=NPC HP Roll}}{{@{selected|token_name} HP Roll = [[@{selected|npc_hpformula}]]}} The second macro will still fail if the HP formula isn't calculable, but it won't stop the first macro from running. You also have /w gm @{selected|wtype} at the start of a couple. The @{wtype} is redundant since you're forcing it to whisper to the GM anyway - not really a major issue, unless some funky characters find their way into the Attribute, then it could break the first field - may as well remove it.
I forgot to reply to this, and I also didn't have time to try it out until today, but.... gosh I feel so dumb. x) Thanks for telling me about other mobs from the compendium, that made me realize a really really daft thing. The macro is currently on my NPC Template character (so I can duplicate it with lots of settings and stuff).... But... I forgot a pretty vital detail. ...... The template doesn't have any information setup really. It's an "empty" NPC sheet with a name basically... so.... no HP, no AC, no Speed or any other stats at all...... [insert visual of Homer does his "Doh!"] So eh... thanks for making me check that thing! :P Thou, I will check that wtype thingy you mentioned as well to see if there is any difference or just redundancy as you say. Thanks! :)
1596733794

Edited 1596733835
Turns out all I needed was to add the HP, then everything else worked :P I also changed the top part to: /w gm &{template:default} {{name=Stamina @{selected|character_name}}} Base Stats, and Resistance / Weakness ofc instead of Stamina on the other two. :) So now that purple header has the name of the macro, and the name of the NPC on the line below. :) Edit: Right... the forum doesn't like emojis. xD  = the bell emoji.