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

Macro for d20 roll w/ query for which character to use, w/ nested query selecting specific modifier

1533890777

Edited 1533893755
I have multiple characters in one game. Instead of making the same macro for each character (and that's a lot of macros!), I'd like to build a query that allows me to identify the who and then which modifier to apply. At this point, I have developed an arduously long and repetitive macro. I'm confident there is a more succinct way to organize the commands, but I am not fluent enough to identify it without help. Basically, the idea is to have the dropdown box to identify which character sheet is being used, then another to identify which modifier from that sheet to apply to the d20 roll in the macro. I wanted this design: [label: d20 + ?{who}?{modifier}] but I cannot break up the call for the Attribute, as identified on the Advanced Macro page. This is a shortened example of what I have so far (it functions, but is just not concise): ?{Who?|    Andrew, ?{Check|       Alpha, Alpha: [[d20+@{Andrew|A Mod}]]|       Beta, Beta: [[d20+@{Andrew|B Mod}]]|       Gamma, Gamma: [[d20+@{Andrew|G Mod}]]|       Delta, Delta: [[d20+@{Andrew|D Mod}]]    } |    Mary, ?{Check|       Alpha, Alpha: [[d20+@{Mary|A Mod}]]|       Beta, Beta: [[d20+@{Mary|B Mod}]]|       Gamma, Gamma: [[d20+@{Mary|G Mod}]]|       Delta, Delta: [[d20+@{Mary|D Mod}]]    } |    Tom, ?{Check|       Alpha, Alpha: [[d20+@{Tom|A Mod}]]|       Beta, Beta: [[d20+@{Tom|B Mod}]]|       Gamma, Gamma: [[d20+@{Tom|G Mod}]]|       Delta, Delta: [[d20+@{Tom|D Mod}]]    } |    Yolanda, ?{Check|       Alpha, Alpha: [[d20+@{Yolanda|A Mod}]]|       Beta, Beta: [[d20+@{Yolanda|B Mod}]]|       Gamma, Gamma: [[d20+@{Yolanda|G Mod}]]|       Delta, Delta: [[d20+@{Yolanda|D Mod}]]    } }
Also, how do I prevent the system from converting the HTML tags once the macro is saved?
1533892792
Ziechael
Forum Champion
Sheet Author
API Scripter
Here is a version that cuts the load a little bit, it isn't much more succinct but by querying the check first you save yourself a few lines of duplicate code: ?{Check|Alpha,Strength: [[ d20 + ?{Who|Andrew,@{Andrew|A Mod}|Mary,@{Mary|A Mod}|Tom,@{Tom|A Mod}|Yolanda,@{Yolanda|A Mod}} ]]|Beta,Dexterity: [[ d20 + ?{Who|Andrew,@{Andrew|B Mod}|Mary,@{Mary|B Mod}|Tom,@{Tom|B Mod}|Yolanda,@{Yolanda|B Mod}} ]]|Gamma,Constitution: [[ d20 + ?{Who|Andrew,@{Andrew|G Mod}|Mary,@{Mary|G Mod}|Tom,@{Tom|G Mod}|Yolanda,@{Yolanda|G Mod}} ]]|Delta,Intelligence: [[ d20 + ?{Who|Andrew,@{Andrew|D Mod}|Mary,@{Mary|D Mod}|Tom,@{Tom|D Mod}|Yolanda,@{Yolanda|D Mod}} ]]} However, if you have tokens that are linked to the sheets you can make a single universal macro without the need for html: ?{Check|Alpha,Strength: [[ d20 + @{selected|A Mod} |Beta,Dexterity: [[ d20 + @{selected|B Mod} |Gamma,Constitution: [[ d20 + @{selected|G Mod} |Delta,Intelligence: [[ d20 + @{selected|D Mod} }]] Replacing 'selected' with 'target' will have the same effect but allow you to run it on any token that can be clicked on and is linked to a sheet with the A-D Mod attributes. Cody B. said: Also, how do I prevent the system from converting the HTML tags once the macro is saved? If you are saving these as character abilities you are fine, but as global macros the VTT will convert the html whenever it is opened... the key is to save it off site or as an ability and NEVER reopen the global version unless you need to update it from the safe versions.
Thank you,  Ziechael ! I've saved the applicable code separately so I can reference it and I will begin applying it to the macros!