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 .
×

Using a variable you have created in a macro?

1617205792

Edited 1617205888
I am trying to make a macro for magic missiles that will do the simple math for me based on what spell level I choose. Here is what I thought would work: ?{Spell Level} /r (@{Spell Level} + 2)d4 + (@{Spell Level} + 2) but this is giving an error when I try to test it. I am assuming my syntax for using the variable after creating it isn't correct. What is the proper way to call a variable that you have created already in the macro using user input?
1617206381
Kraynic
Pro
Sheet Author
When you call an attribute, the attribute name will never contain spaces.  You need to use the actual attribute name that is specified for that input in the html instead of whatever label is used on the UI of the character sheet.  You didn't specify what character sheet you are using, and each sheet can be different.  If there is an actual attribute you are trying to call, it might be something like @{spell_level}. If you are just trying to reuse the answer given in the query you have at the beginning, then you just need to repeat that query, since identical multiple queries in the same macro will use the answer given to the first one. ?{Spell Level} /r (?{Spell Level} + 2)d4 + (?{Spell Level} + 2)
You won't want to have the first line on it's own like that though. If you select a spell level of 2 for the query, your output will be this: Instead, get rid of the first call altogether: /r (?{Spell Level} + 2)d4 + (?{Spell Level} + 2) Or if you have some reason to have the first query separate (which can be useful for long queries with lots of dropdown options), use a false API call by putting a ! at the start of the line: ! ?{Spell Level|1|2|3|4|5|6|7|8|9} /r (?{Spell Level} + 2)d4 + (?{Spell Level} + 2) Also there are other Magic Missile macros in other threads .