7
\$\begingroup\$

I'm trying to create a saves macro for DnD 5e in Roll20 that asks for the type of save once and then specifies which save type it is.

For example expected output may be "Lucy rolls a [19]/[10] for a strength save!" where [] means it's a formatted dice roll with modifiers. I have a working macro but the issue is I have to prompt for the save type twice. Once for the type so it can pull the modifier and once for specifying the save in chat.

My current working code is as follows:

@{selected|token_name} rolls a [[1d20+?{Save|STR, @{selected|strength_save_bonus}|DEX, @{selected|dexterity_save_bonus}|CON, @{selected|constitution_save_bonus}|INT, @{selected|intelligence_save_bonus}|WIS, @{selected|wisdom_save_bonus}|CHA, @{selected|charisma_save_bonus}}]]/[[1d20+?{Save|STR, @{selected|strength_save_bonus}|DEX, @{selected|dexterity_save_bonus}|CON, @{selected|constitution_save_bonus}|INT, @{selected|intelligence_save_bonus}|WIS, @{selected|wisdom_save_bonus}|CHA, @{selected|charisma_save_bonus}}]] for ?{Save_type|STR, a strength|DEX, a dexterity|CON, a constitution|INT, an intelligence|WIS, a wisdom|CHA, a charisma} save!

I can't reuse Save as the second prompt because it just gives the stat mod ("Lucy rolls a [19]/10] for a 5 save!" where 5 is my STR save mod.)

\$\endgroup\$
5
\$\begingroup\$

When using variables in Roll20 macros, you use a Roll Query to assign a string value to an input variable. The general syntax is as follows:

?{Variable|Option1,Value1|Option2,Value2|...}

In your original macro, it queries for the same input variable multiple times. The variable "Save" and variable "Save_type" are not independent; why should the macro treat them independently?

Instead, if you want only one prompt, then you should write the macro so that the variable "Save" corresponds to much output as possible (or at least, as much output that it would affect) in one big consecutive string.

I would write your macro as shown below, where it queries for the variable "Save" once, and then each of six options corresponds to a different string value. Then each string is the code that the macro parser will evaluate and print.

@{selected|token_name} rolls a ?{Save |STR,[[1d20+@{selected|strength_save_bonus}]]/[[1d20+@{selected|strength_save_bonus}]] for a strength |DEX,[[1d20+@{selected|dexterity_save_bonus}]]/[[1d20+@{selected|dexterity_save_bonus}]] for a dexterity |CON,[[1d20+@{selected|constitution_save_bonus}]]/[[1d20+@{selected|constitution_save_bonus}]] for a constitution |INT,[[1d20+@{selected|intelligence_save_bonus}]]/[[1d20+@{selected|intelligence_save_bonus}]] for an intelligence |WIS,[[1d20+@{selected|wisdom_save_bonus}]]/[[1d20+@{selected|wisdom_save_bonus}]] for a wisdom |CHA,[[1d20+@{selected|charisma_save_bonus}]]/[[1d20+@{selected|charisma_save_bonus}]] for a charisma } save!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ After removing the line breaks/spaces after each save type it worked great! Thanks a ton! \$\endgroup\$ – Himitsu_no_Yami Dec 24 '19 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.