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

Generic Macro help please (M&M system, default templates)

Trying to write a macro that allows me to click the token & allows me to choose which save to roll, but apparently I'm doing something wrong. I've attempted a lot of variations, including using the html code (&#numbers;). Included is the bare basic version, but the final @target portion I have tried more combinations than I can count for replacing the symbols with html code. &{template:default} {{name=@{Target|Name}}} {{?{Save|Dodge|Parry|Fortitude|Toughness|Will}=[[?{Roll|d20|10}+@{Target|?{Save}}]]}}
1568233619
GiGs
Pro
Sheet Author
API Scripter
You cant do this: @{Target|?{Save}} You can never put calculations or queries inside an attribute call, due to the order roll20 does its macros. The first thing it does is try to read the value of all attributes in the macro, and then  run queries. So it tries to look for an attribute named  ?{Save} on the Target character sheet, and that obviously doesnt exist. The best way to do this is to use chat menu : print a button for each of the saves into chat (you can whisper the menu to yourself or the relevant player, so it doesnt clutter up chat for everyone), and then the person clicks the button for the correct save, which then rolls it. If you wish to use a query approach, you'll need to get familiar with html entity replacements . But the basic procedure would be to have a query like {{?{Save|Dodge,<complete text of dodge label and roll here>|Parry,<complete parry stuff here>|etc } }} That <complete text> section for dodge would look something like this Dodge=?{Roll|d20|10}+@{Target|Dodge} except that you have to replace some of the characters (in this case, the | and } characters) with html entities, like so Dodge=?{Roll|d20|10}+@{Target|Dodge} You never replace characters in attribute calls, so the target|dodge is left alone. You then repeat that for each other row of the dropdown, and if you're lucky, it will work! Chat menus are much easier. :) Notice I've put the entire query inside the {{ }} brackets. Each row of the query will generate the proper label, the = sign, and the roll after the equals. All of that has to be put in each row of the query. 
Problem is I did try that method & it still failed. I tried one that asked the type of save & had the whole @{target code for the defense. I tried replacing numerous parts with the html code & it still failed. Though the one I tried was slightly different from yours it was {{?{Roll|d20|10}+?{Defense|Dodge,hasgd|Parry,asdjk|Toughness,ashdfkjas|etc etc}}} One thing I never learned was how to get the HTML code to show in here so I just blabbered lol
1568287877
GiGs
Pro
Sheet Author
API Scripter
I've generally given up on nested html, and go the chat menu route, It's a lot less pain.