# Adding a fixed value to a macro roll in Roll20

I want to write a macro that rolls another macro and adds a fixed value.

Example:

/me is spotting with a bonus of 2

@{Charname|spotcheck} + 2


I just can't get it to work...

• @{char|spotcheck} runs the @{char|spotcheck} macro just fine and returns the calculated value

• @{char|spotcheck}+2 ignores the +2 and just runs the @{char|spotcheck}

• If I enter [[@{char|spotcheck}+2]] nothing happens — the entry disappears

Same goes for each with the % instead of @.

Can be closed, I tried to add +2 to a template.

Thanks all

• Do you have an attribute on your character named "spotcheck"? In any case, I think you would get much better help with this on the Roll20 forums. – keithcurtis Feb 2 '17 at 0:33
• Yes, I do... I will put the question there too... – Old Zean Feb 2 '17 at 0:37
• What result are you getting? It's kind of hard to answer to "can't get it to work". Does it give incorrect results, no result? – keithcurtis Feb 2 '17 at 0:41
• im just getting the @{Charname|spotcheck} result – Old Zean Feb 2 '17 at 0:47

Check your capitalization carefully. Verify that the character does indeed have an attribute with exactly that spelling, and that it has a value. Also, if you want it to display a total, be sure to wrap your chat command in brackets, or else you will only get the formula returned.

Example: In my campaign I have a character named "Kiliki" with an attribute called "strength" which has a value of "20". If I type:

@{Kiliki|strength}


The returned value in the chat log will be:

20

if I type:

@{Kiliki|strength} + 2


I will get:

"20 + 2"

If I type:

[[@{Kiliki|strength} +2]]


I will get:

22

This last answer will be in a yellow highlight square that indicates that I can hover over it to see the formula that produced the answer.

If what you are after is running a character macro in a call, then you need to preface with a percent sign, rather than an at symbol. For example, my same character has a macro called "Shift". To activate the macro, the syntax is:

%{Kiliki|Shift}


This will tell the site to run the Shift macro of the character Kiliki.

If you want to combine the two, then you need to make sure your macro (that you are calling) produces a number. For example, I just created a macro on Kiliki's character sheet called "spotcheck", that just calls her wisdom. Then I used the following command in chat:

[[%{Kiliki|spotcheck} +2]]


This called the Intelligence with the character macro (16), and added (2) and returned the only the final result (18) because of the brackets, yielding:

18

If you hover over the answer you get:

Rolling 16 + 2 = (16+2)

Finally % before the expression returns a character ability (macro), while # runs generic macros.

As it works out, this is the macro that @Old Zean now uses, per his comment below.

I now wrote a new macro: &{template:DnD35StdRoll} {{skillflag=true}} {{name=@{charname|character_name}}} {{check=Spot check:}} {{checkroll=[[1d20 + [[@{charname|spot}]] +2 ]] }} this is working perfectly thanks again!

• @{char|spotcheck} runs the @{char|spotcheck} macro just fine and returns the value.....@{char|spotcheck}+2 ignores the +2 and just runs the @{char|spotcheck}....if i enter [[@{char|spotcheck}+2]] nothing happens...the entry disapears..same goes for the % instead of @ – Old Zean Feb 2 '17 at 17:32
• You will need to post the text of your spotcheck macro, then. Something is likely going wrong with your input. – keithcurtis Feb 2 '17 at 18:16
• &{template:DnD35StdRoll} {{skillflag=true}} {{name=@{character_name} }} {{check=[Spot](dandwiki.com/wiki/SRD:Spot_Skill ) check:}} {{checkroll=[[1d20 + [[@{spot}]] ]] }} {{notes=@{spotnote} }} that is the macro im calling on...the strange thing is that @{char|spotcheck} is working just fine... and in theory he just should take the value calculated by the macro...and add +2 – Old Zean Feb 2 '17 at 18:27
• I just realised the output of the macro is shown in a template....how should he add +2 to a template... I think I have to do this directly....but thanks for the help!!! And sorry ;) – Old Zean Feb 2 '17 at 18:39
• @keithcurtis I put his comment as a note/addendum to your answer to show what solved the problem. That may help people in the future with a similar problem. – KorvinStarmast Feb 4 '17 at 20:00