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 .
×
May your rolls be chill this holiday season!
Create a free account

Difficulty making multiple choice macro

The long and short of my situation is that I got ahold of this PDF for an out of print game called Dark Earth. So my online buddies and I want to try it out. Obviously there's no sheet for it so im making some macros to compensate. Game uses a d6 dice pool system. 1-3 is a fail while 4-6 is a success with 6s counting as two successes. Heres the macro I made for that; &{template:default} {{name=**Dice Pool:** ?{Dice Pool}d6}} {{Amount of Successes:=[[?{Dice Pool|1}d6>6f<3 + ?{Dice Pool|1} ]] }} Combat, however, works slightly different. It still uses d6 pools for tests but what makes it different is that you divvy up dice from your total "combat potential" dice pool (skill level in a weapon + overall combat ability), into smaller "attack potential" and "defence potential" dice pools at the start of a round. There are other actions you can take but for simplicity sake ill be focusing on attack and defence. Anyway, I want to make a macro that allows you to choose between making an attack, defence, or attack & defence at the same time, etc. However, every attempt ive made hasnt worked. Macros for the individual actions work but I would prefer a single, multiple choice macro. Here are the macros for the each action; Attack: &{template:default} {{name=**@{selected|character_name}**}} {{Attack:=[[?{Attack Potential|0}d6>6f<3 + ?{Attack Potential|0} ]]}} Defence:   &{template:default} {{name=**@{selected|character_name}**}}  {{Defence:=[[?{Defence Potential|0}d6>6f<3 + ?{Defence Potential|0} ]]}} Both:   &{template:default} {{name=**@{selected|character_name}**}} {{Attack:=[[?{Attack Potential|0}d6>6f<3 + ?{Attack Potential|0} ]]}} {{Defence:=[[?{Defence Potential|0}d6>6f<3 + ?{Defence Potential|0} ]]}} Ive tried this macro:  ?{Which Action? |Attack, #Attack |Defence, #Defence|Both, #Both|} but i keep getting errors. Same goes if I just but the entire attack, defence, and Both macro into the multiple choice macro instead of using the #. So what exactly am I missing? Is what I want to do even possible?
1765030544
timmaugh
Forum Champion
API Scripter
Before I get into what's going on, I'm going to suggest you look at Chat Menus for this. It's the same number of clicks... in a query based macro, you click once to run the macro, then once for choose the mode from the query... in a menu based macro, you click once to get the menu, then once to choose the mode button. By the time you see what it takes to fix the above commands to work with queries, you will probably agree that a menu works better, too. (Solutions at the bottom of each section...) Query Solution You're going to need to get into HTML Substitutions . (although that link shares the unicode values and you can use much nicer versions like I'll show below, it does get into the idea of what a substitution is). This is because certain characters mean something to the query structure, so when the Roll20 parser encounters a query, the "control" characters tell it how to proceed: |  =>  a pipe => denotes the start of a new answer option ,  =>  a comma => denotes a change from the answer text as presented in the query to the actual value that will be returned for that option }  =>  right brace  => denotes the end of the query As for why these are a problem, it's because of the order of operations and how Roll20 approaches a command line. Before the query gets parsed, attributes, abilities, and macros will be expanded. The name reference: #TheBestMacroInTheWholeWideWorld ...gets replaced with the contents of that macro in the command line: I'm the {best}. Braces for extra bestness. So where that's used in the query: ?{How good of a macro to use?|Best,#TheBestMacroInTheWholeWideWorld|Better,... ...becomes... ?{How good of a macro to use?|Best, I'm the {best}. Braces for extra bestness.|Better,... And when that gets parsed, the closing brace after "{best}" will terminate your query syntax, and you won't see the rest of the options. So, in your case, you have closing braces for all of your template parts, closing braces for what will be sub-queries, and vertical pipes in your sub-queries that will need to be replaced. You DON'T need to replace the closing braces in attribute calls since, as you can see in the order of operations, they will resolve before the query is examined, so those closing braces will have disappeared. You would only have to worry about what those calls will resolve INTO... so, hopefully, you don't have people putting commas into their names... or vertical pipes for extra "pipey-ness". If you do, cuff those people roundly about the head and neck area for general surliness. Going this route, you do save *some* verbiage, since everything common and contiguous can be left outside your query. It's still a bit of work, though. Your combined query would be something like... &{template:default }  {{name=**@{selected|character_name}**}} {{ ?{Which action?|Attack, Attack:=[[?{Attack Potential | 0 } d6>6f<3 + ?{Attack Potential }  ]] |Defend, Defence:=[[?{Defence Potential | 0 } d6>6f<3 + ?{Defence Potential }  ]] |Both, Attack:=[[?{Attack Potential | 0 } d6>6f<3 + ?{Attack Potential }  ]] } }  {{Defence:=[[?{Defence Potential | 0 } d6>6f<3 + ?{Defence Potential }  ]] } }} Chat Menu Solution A chat menu will work with what you already have written without any changes. You won't need to make any changes to any of them. You'll just need to store them as macros that your players can access. For now, I'll assume they are named Attack, Defence, and Both, and that they have the text as you listed in your original post. In that case, your chat menu solution would be: /w @{selected|character_name} &{template:default} {{name=Combat Options}} {{[Attack](!
#Attack)%NEWLINE% [Defend](!
#Defence)%NEWLINE% [Both](!
#Both) }} Which would give a menu like this, whispered only to the selected character:
Oh thats grand! This helps a lot. Thanks