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

Saves Macros for NPCs returning : ReferenceError: Invalid left-hand side expression in postfix operation

1511367263

Edited 1511367439
Game Title : Saviors of Greenest D&D 5e using OGL sheets Several of my monsters are returning the above reference error when attempting Saving throws, and only saving throws, all other rolls seem to be working properly.  The thing is, I create all my monsters from a template, and the template saves macro works.  Specific monsters that are failing are Kobolds, Dragonclaw Cultist, Stirge, Beserker, Guard Drakes, and Ambush Drakes that I know of, most everything else seems to be working fine.  I have tried to copy and paste the macro from one that is working into a nonworking, but that hasn't fixed the problem.
I have never seen that error before. Could you post your macro code?
This is the code from one that is NOT working: /w GM &{template:default} {{name=@{selected|token_name} Saving Throws}} {{Str Save= [[1d20+@{strength_mod} }+(@{npc_str_save}-@{strength_mod})]] | [[1d20+@{strength_mod}+(@{npc_str_save}-@{strength_mod})]]}} {{Dex Save= [[1d20+@{dexterity_mod} + (@{npc_dex_save}-@{dexterity_mod})]] | [[1d20+@{dexterity_mod}+ (@{npc_dex_save}-@{dexterity_mod})]]}} {{Con Save= [[1d20+@{constitution_mod} + (@{npc_con_save}-@{constitution_mod})]] | [[1d20+@{constitution_mod}+ (@{npc_con_save}-@{constitution_mod})]]}} {{Int Save= [[1d20+@{intelligence_mod}+ (@{npc_int_save}-@{intelligence_mod})]] | [[1d20+@{intelligence_mod}+ (@{npc_int_save}-@{intelligence_mod})]]}} {{Wis Save= [[1d20+@{wisdom_mod} + (@{npc_wis_save}-@{wisdom_mod})]] | [[1d20+@{wisdom_mod}+ (@{npc_wis_save}-@{wisdom_mod})]]}} {{Cha Save= [[1d20+@{charisma_mod} + (@{npc_cha_save}-@{charisma_mod})]] | [[1d20+@{charisma_mod} + (@{npc_cha_save}-@{charisma_mod})]]}}
1511369666

Edited 1511369928
Silvyre
Forum Champion
After some experimentation, it seems like the source of the error stems from the subtraction of a negative number within parentheses. For example, this expression returns the same error: [[ (1--1) ]] You should be able to avoid this error within that macro by rewriting each instance of @{ ability _mod}+(@{npc_ ability _save}-@{ ability _mod}) as simply @{npc_ ability _save}—the latter is algebraically equal to the former.
Why then would it work for some monsters, and not others?  I am in the process of modifying one.
Actually, I think i figured that out, the monsters that work all have either 0 or + modifiers.  I am travelling for thanksgiving so I will have to finish trying to fix this next week.