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

Creating self calculating query macros

So this is the macro I'm trying to make work right now: &{template:default} {{name=Heavy Mace}} {{Heavy Mace=[[1d20 @{Damien Kavras|bab}+@{Damien Kavras|epicattackbonus}+@{Damien Kavras|weapon1stat}+@{Damien Kavras|size}+@{Damien Kavras|weapon1enh}+@{Damien Kavras|weapon1focus}+?{Power Attack? (Put in penalty with negative sign ie -3)|0}+?{Additional Attack Bonus?(Don't add +)|0}]]}} {{Damge=[[1d8 + @{Damien Kavras|weapon1damagestat} +@{Damien Kavras|weapon1enh}+@{Damien Kavras|weapon1specialize} +?{Power Attack Bonus?|0}+?{Additional Damage Bonus?|0}]]}} My question is, how do I make the Power Attack Damage query auto calculate based on the modifier given in the Power Attack To Hit query? And if that works, is there a way to have it check whether the weapon in question is a two handed weapon, to adjust the damage modifier accordingly?
1588825389
GiGs
Pro
Sheet Author
API Scripter
It could be done, but you'd need some way of declaring that a weapon is one handed or two handed. If a heavy mace is always 2 handed, just put a x2 multiple (or whatever 2h weapons get). There is a problem with your macro: if you want to reuse the query's value, you need to use the same query name exactly. The query name is everying between the { and the first | . So this query ?{Power Attack? (Put in penalty with negative sign ie -3)|0} has a name of Power Attack? (Put in penalty with negative sign ie -3) and the second time you call the power attack query, you must use that exactly. Both Power Attack and Additional Attack Bonus have that problem. Also this section  {{Heavy Mace=[[1d20 @{Damien Kavras|bab} looks like its missing a + after the d20.
1588829700

Edited 1588829850
Thank you for the reply! I've changed the macro so it can identify the person using it based on the token that's selected. I'm trying to make it so the macro itself checks for all the needed information, so I don't have duplicates of the same macro for every individual character/weapon. The sheet I'm using doesn't have a field to say whether or not the weapon in question is one or two handed, so how am I able to tell the macro whether or not it needs to apply a multiple to the stat mod bonus? Here is my revised macro &{template:default} {{name=@{selected|weapon1name}}} {{weapon1name}=[[1d20 + @{selected|bab}+@{selected|epicattackbonus}+@{selected|weapon1stat}+@{selected|size}+@{selected|weapon1enh}+@{selected|weapon1focus}+?{Power Attack?|0}+?{Additional Attack Bonus?(Don't add +)|0}]]}} {{Damge=[[1d8 + @{selected|weapon1damagestat} +@{selected|weapon1enh}+@{selected|weapon1specialize} +?{Power Attack Bonus?|0}+?{Additional Damage Bonus?|0}]]}} One of the issues I'm having, is that the macro wont identify the name in weapon1name, it simply fills the name with Weapon1name}. What do I need to alter in order to get the proper name to show up? Edit: I just realized that I'm having it display the weapon name twice, which isn't necessary because the second time should be the "To Hit" roll. So That's a none issue now.
1588831099
GiGs
Pro
Sheet Author
API Scripter
Power attack and power attack bonus are still different. Are you saying the weapon1name is working properly now? To get the 1h or 2h bonus, you are much better off using two different macros for that. You can do it with the one macro, but you'll need to use another query, and use html substitutions. Having three queries everytime to attack is a bit of a pain, especially when you'll be choosing the exact same answer every time when using the same weapon. Here's a version of the attack and damage part of the query For 1h weapons: [[1d20 + @{selected|bab}+@{selected|epicattackbonus}+@{selected|weapon1stat}+@{selected|size}+@{selected|weapon1enh}+@{selected|weapon1focus}+?{Power Attack Penalty?|0}+?{Additional Attack Bonus?(Don't add +)|0}]]}} {{Damge=[[1d8 + @{selected|weapon1damagestat} +@{selected|weapon1enh}+@{selected|weapon1specialize} -(?{Power Attack Penalty?})+?{Additional Damage Bonus?}]]}} Notice I changed the name to include the word Penalty , so the user knows to enter a negative number, and in the damage section i put a minus sign, and the power attack penalty in brackets. This is so that when you enter a power attack penalty, like -3, it becomes a bonus to damage. For 2h weapons, if the multiplier is x2, just stick that inside the brackets: [[1d20 + @{selected|bab}+@{selected|epicattackbonus}+@{selected|weapon1stat}+@{selected|size}+@{selected|weapon1enh}+@{selected|weapon1focus}+?{Power Attack Penalty?|0}+?{Additional Attack Bonus?(Don't add +)|0}]]}} {{Damge=[[1d8 + @{selected|weapon1damagestat} +@{selected|weapon1enh}+@{selected|weapon1specialize} -(?{Power Attack Penalty?}*2)+?{Additional Damage Bonus?}]]}}
1588832672

Edited 1588832739
I just wound up changing the name, so previously it would look like Heavy Mace Heavy mace     |16 | (the to hit roll) Damage           | 9 | But then I realized I didn't need the weapon name to show up twice, so it looks like this now Heavy Mace To Hit            |16| Damage       | 9| You are right about too many queries. I felt like two would be the max. In my particular case, I'll be filling in the information for everyone's character sheets, so I'm going to set up all the macros for them so I can personalise where needed. For instance, there's only one person with Power Attack, so he can have this macro, and everyone else's wont prompt for PA info. Unless they later on get it, and I can edit it then. Needless, you've really helped me fix my issue. Before this, I knew next to nothing about coding, and have spent the last day and a half learning as I go. I definitely realize that it can be a rabbit hole trying to make your macros more and more efficient, and things mess up because after I solve a problem, I try to make it do something else and have to back fill in order to problem solve. Thanks!
1588833656
GiGs
Pro
Sheet Author
API Scripter
You're welcome :)