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

Need help, New to marcos, drop down would prompt correctly

1584818356

Edited 1584820024
Hello, I'm new to macros and have been trying for over an hour to get a macro to work. I don't know what I'm doing wrong. this is the code I'm working on. I only need damage. I removed the attack roll since that handled by a different ability. I need the movement to be added to the damage. Movement is handled by the player since it from the intended distance they were moving before the collision with the other object. &{template:default} {{name=Ramming/Crashing Damage}} {{?{Ship Size|Awesome, [[20d6 + ?{Movement?|0}]]|Colossal, [[16d6 + ?{Movement?|0}]]|Gargantuan, [[12d6 + ?{Movement?|0}]]|Huge, [[8d6 +?{Movement?|0}]]|Large, [[4d6 + ?{Movement?|0}]]|Medium or smaller, [[?{Movement?|0}]]}} This code is for a spelljammer campaign and I don't want my players or my co-dm to have to look up how to ramming over and over again every time we use it, which really should't be often. Thank you anyone that can help me. I tried changing it to &{template:default} {{name=Ramming/Crashing Damage}}  {{?{Ship Size|Awesome, [[20d6]]|Colossal, [[16d6]]|Gargantuan, [[12d6]]|Huge, [[8d6]]|Large, [[4d6]]|Medium or smaller, [[0d6]]}} + {{[[?{Movement?|0}]]}} but it still doesn't add the movement or even roll damage, what am I doing wrong
1584823947
Kraynic
Pro
Sheet Author
Ok, there are a couple things going on here.  Generally it is best to avoid trying to nest a query inside another query because you have to start using html replacements for some of the characters to keep the thing from breaking.  I'll leave that to someone else to explain, because I avoid that like death... Your second is very close.  With the default template, every double pair of double curly brackets is a new line printed out in chat.  So you can't have your ship size query calculated and added to your movement entry, because they are totally separate and on different lines.  So the solution is to make them all one line.  Also, to make sure it is resolved to a single number, you need another pair of double square brackets around the entire thing.  Otherwise you get a number for your ship roll, and a number for your movement. I also added a zero for the input result if you choose "medium or smaller".  Change that if it should be something else.  I think this will do what you are looking for: &{template:default} {{name=Ramming/Crashing Damage}} {{[[?{Ship Size|Awesome, [[20d6]]|Colossal, [[16d6]]|Gargantuan, [[12d6]]|Huge, [[8d6]]|Large, [[4d6]]|Medium or smaller, 0}+[[?{Movement?|0}]]]]}}
1584824903
GiGs
Pro
Sheet Author
API Scripter
You have queries inside of Queries, so you are running into the most common problem people encounter when trying to make complex queries. Note that roll20 is not a clever system, it looks at the text you are giving it and tries to interpret it. it knows that a comma, a | and a } have special meanigns in queries, so it looks for them. But it stupidly pays no attention to the { symbol. So it looks at something like this this ?{Ship Size|Awesome, [[20d6 + ?{Movement?|0}]]| And sees the | in movement, and thinks it is a separator for the Ship Size query. Then it sees the } at the end of Movement, and tries to end the Ship Size query. And then everything goes wrong. There are generally two ways to fix this. The first is to replace certain characters with html entities. These are alternate ways of creating a symbol. For instance  }  is the html entity for }. By using these, roll20 doesnt recognise them on the first pass of reading the macro. But it gets tricky knowing which characters to replace and which to leave untouched. There's more on this at the wiki for Advanced Roll Queries . In your macro, i think you need to replace the | and } in each Movement Query. I think that would lead to this monstrosity (I havent tested it so may have missed something: &{template:default} {{name=Ramming/Crashing Damage}} {{?{Ship Size|Awesome, [[20d6 + ?{Movement? | 0 } ]]|Colossal, [[16d6 + ?{Movement? | 0 } ]]|Gargantuan, [[12d6 + ?{Movement? | 0 } ]]|Huge, [[8d6 +?{Movement? | 0 } ]]|Large, [[4d6 + ?{Movement? | 0 } ]]|Medium or smaller, [[?{Movement? | 0 } ]]}}} (PS: you were missing a } at the very end, one to close the ship size query, and and two to close the {{ }} set for the template. That didnt matter though, the query failed before it reached that.) The second method is to look at your query and see if there's a way to restructure it to avoid this problem. If there's anything repeated inside the query try to move it outside. This doesnt always lead to simpler macros, but in your case it can be done. & {template:default} {{name=Ramming/Crashing Damage}} {{[[?{Ship Size|Awesome, 20d6|Colossal, 16d6|Gargantuan, 12d6|Huge, 8d6|Large, 4d6|Medium or smaller, 0}+?{Movement|0}]] }} By moving the movement query outside the ship size query, we avoid the problem.
1584824984
GiGs
Pro
Sheet Author
API Scripter
Kraynic, you dont need to include the inline roll brackets around movement and every d6 roll - the one set around both queries is enough.
1584826378

Edited 1584826427
Ziechael
Forum Champion
Sheet Author
API Scripter
Since you are using the same query result time and time again you can avoid some extra nesting issues by prefixing the macro with the query then only nesting the call for the result: ! ?{Movement| 0 } &{template:default} {{name=Ramming/Crashing Damage}} {{?{Ship Size|Awesome, [[20d6 + ?{Movement? } ]]|Colossal, [[16d6 + ?{Movement? } ]]|Gargantuan, [[12d6 + ?{Movement? } ]]|Huge, [[8d6 +?{Movement? } ]]|Large, [[4d6 + ?{Movement? } ]]|Medium or smaller, [[?{Movement? } ]]}}} Better yet, since it is good practice to only nest the things that need to be different and your movement query is global you could avoid nesting altogether (edit: which I've just noticed that GiGs has already pointed out lol) : &{template:default} {{name=Ramming/Crashing Damage}} {{ [[?{Ship Size|Awesome,20d6|Colossal,16d6|Gargantuan,12d6|Huge,8d6|Large,|Medium or smaller,0} + ?{Movement?|0} ]] }}
1584826496
Kraynic
Pro
Sheet Author
GiGs said: Kraynic, you dont need to include the inline roll brackets around movement and every d6 roll - the one set around both queries is enough. I guess that is true.  I just took the original and ran with it.
Thank you everyone for your help, I eventually figured it out as Ziechael said by putting movement first but I nested a bit differently and removed the movement from the damage. I don't have it to show at the moment, but I did get it to work. Also thank you Kraynic I wasn't aware of the missing brackets. I only learned how to write macros this morning and am learning I need to have the total numbers of bracket match.
1584863727
Ziechael
Forum Champion
Sheet Author
API Scripter
It's a learning curve to be sure, don't be afraid to ask any questions you might have... it's a steep climb sometimes and the extra leg up certainly helps :) Happy rolling!