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

Nested Macros

1440609742

Edited 1440609855
I'm playing a iron claw game. The rule for a attack, counter-attack, and parry use almost the same rolls. There are a few items or gift (feats I guess you'd call them in pathfinder) give explicit bonus explicitly to only attacks, only counter-attack, or only parry attempts. So what I'm left with is 98% of the same rolls with d4, d6, or d8 tacked on to the end depending on if that roll is used for a attack, counter-attack, or parry. For simplicity I'll say that 98% looks like this: /roll {d6,d6}kh1 Is there some way to pass a argument to the above without having to ask the player 50questions? Something like: #attack +d8 #counter_attack #parry +d4
1440612145
DK Heinrich
Marketplace Creator
Sheet Author
You should be able to add a roll query to get there - super rough example here (I have no idea what would be your 'default' to list 1st or of the dx's are correct but might help)  ?{attack type|Attack, 1d8|Counter, 1d6|Parry, 1d4}
1440618806

Edited 1440620165
/roll {d6,d6,?{Extra Die|d4,d4|d6,d6|d8,d8}}kh1 Would work, but that has the problem is that it only technically worked. It defeated the entire designed of the macro. When a macro was called what the bonus is is know and fixed. (there's just a lot of redundant code) Having to ask the player would be redundant. I think I found a solution though. (I've got to stop asking questions, taking a nap, and finding the solution hours later...) My problem was I think Roll20 would not recognize "#some_macro ,d8 #other_macro" as me trying to nest things . I had to break it up into lone pairs. Let's say the normal attack adds a d8, the counter attack does nothing, and parry adds a d4. I'd need seven different macros: _attack: {d6,d6 _attack_d4: #_attack ,d4 _attack_d8: #_attack ,d8 _attack_end: }}kh1 Attack: #_attack_d8 #_attack_end Counter_Attack: #_attack #_attack_end Parry: #_attack_d4 #_attack_end Entering "/roll #Attack" now resolves to "/roll {d6,d6 ,d8 }}kh1" Entering "/roll #Counter_Attack" now resolves to "/roll {d6,d6 }}kh1" Entering "/roll #Parry" now resolves to "/roll {d6,d6 ,d4 }}kh1" Edit: Turns out the following works too... _attack: {d6,d6 _d4: ,d4 _d8: ,d8 _attack_end: }}kh1 Attack: #_attack #_d8 #_attack_end Counter_Attack: #_attack #_attack_end Parry: #_attack #_d4 #_attack_end
/roll {d6,d6,?{Action|Attack,d8|Counter Attack,d6|Parry,d4}}kh1
1440679990
DK Heinrich
Marketplace Creator
Sheet Author
still should be easier to hit one macro and select the option (as Silvyre completed my thought above). And if 98% of the time it is 'Attack' its just a mater of clicking the button, hitting enter on the keyboard (to accept the default on the drop down roll query). Basically it would move all seven of your macros into one. 
It works, I just dislike redundant code (Irritates my programming habits.) ,and thought asking a question for a value that's known and fixed when the macro is called seemed silly. Thanks for the input though. ^.^
HarbingerLeo , I'm having difficulty understanding what you are referring to as "known and fixed" and/or "redundant code". Clarification would be appreciated.
HarbingerLeo said: It works, I just dislike redundant code (Irritates my programming habits.) ,and thought asking a question for a value that's known and fixed when the macro is called seemed silly. Thanks for the input though. ^.^ Silvyre's method works best. It's a simple drop down. Otherwise you'd need to create seven macro's to do what you want and have to type a lot rather than click one macro.
1440767233
DK Heinrich
Marketplace Creator
Sheet Author
HoneyBadger said: HarbingerLeo said: It works, I just dislike redundant code (Irritates my programming habits.) ,and thought asking a question for a value that's known and fixed when the macro is called seemed silly. Thanks for the input though. ^.^ Silvyre's method works best. It's a simple drop down. Otherwise you'd need to create seven macro's to do what you want and have to type a lot rather than click one macro. agree, as usual, with HB.
1440768451

Edited 1440770099
Silvyre said: HarbingerLeo , I'm having difficulty understanding what you are referring to as "known and fixed" and/or "redundant code". Clarification would be appreciated. Apologies. Of course! HarbingerLeo said: So what I'm left with is 98% of the same rolls with d4, d6, or d8 tacked on to the end depending on if that roll is used for a attack, counter-attack, or parry. For simplicity I'll say that 98% looks like this: /roll {d6,d6}kh1 Like I originally said. I have three rolls I needed to make macros for: /roll {d6,d6, d8}kh1 /roll {d6,d6}kh1 /roll {d6,d6, d4}kh1 Each one has a different dedicated use. Each roll is use in a unique situation each time. Anytime the first roll is used, it will always only be a d8. Anytime the second roll is used it will *never* have a bonus. Anytime the third roll is called it will always only have a d4. I could code three separate macros and call them each separate, but there's a lot more to the real roll then "just" {d6,d6}kh1. There are two problems why I asked (and maybe shouldn't have) a very specific question: 1) As I said anytime the macro is called, is to save typing. It's much easier and much more successful if the macro can just be entered or clicked and whatever little variation there are just baked in. Having to pause to enter information in a query technically works, but works against making things easiest. In this unique case each time the macro is reached for it's for a specific use that's always constant. That is, when you reach for it you already know what the answer to the question is and it will always be the same answer. Think of it as having a Longsword +5 vs orcs. Your either using it against orcs and getting the +5, or your not. The condition for getting the bonus is never going to change. If your going to be fighting orcs a lot, it's "easier" (especially in my case) to just make one macro for fighting orc, and one macro for not fighting orc. 2) Programmer logic: There's a good bit more to the roll then just the core "/roll {d6,d6}kh1" then I showed you. It's actually 4 to 6dice different dice each referencing a character sheet and the entire roll treated a little different at different points. Sometimes it's the same roll but with a target number of success instead of the highest showing dice. Same roll, different uses, and different bonuses. -SO- I could copy any paste the these 4to6 different dice into dozen of different places. That has the problem of "What if something in the setup those 4 to 6 dice changes?" Like say it expands to 7dice or I suddenly re roll those same dice under a new set of roll commands? I could renter the entire string of dice again and go back and change every single macro to update it all one at a time. Then pray I did it right the first time without error. -OR- I could enter the roll once in a central place, then have each macro that uses those dice reference that one single central place. I only have to enter the entire string once. As a side benefit anytime I have to change anything (because something new happened or I made a mistake) I just have to change the central place, any macros that depend on that same roll are then automatically updated. Edit: Think of it as having a variable strength bonus. If you get plus to damage based on your strength? You could calculate that bonus then add the literal +1 or +2, etc. to each and every macro -or- you could have each macro just lookup what the bonus to damage is. (For say when you get +5strength because the cleric just passed out a strength buff) Same idea, just a bit more complicated in use.
1440771663
DK Heinrich
Marketplace Creator
Sheet Author
I guess it comes down to what is easier for you - if having multiple macros to pick from is easier than having one to pick during that rock it that way :)  for me the drop down menu query system has sped things up greatly. Listing the options in order of most used to least used makes it even faster. In all the cases you listed above I would choose to have 1 macro with options instead of individual macros for each option. But the great thing is you and I can tackle the same thing in different ways and both be happy :) I hope your game runs well and the macros do their job!
1440779749

Edited 1440780811
HarbingerLeo said: /roll {d6,d6, d8}kh1 /roll {d6,d6}kh1 /roll {d6,d6, d4}kh1 I'll correct what I've posted. /roll {d6, d6, ?{Action|Attack,d8|Counter Attack,0d0|Parry,d4}}kh1 HarbingerLeo said: If your going to be fighting orcs a lot, it's "easier" (especially in my case) to just make one macro for fighting orc, and one macro for not fighting orc. I tend to agree; if I felt that I was being absolutely swamped by roll queries, I would also rather opt for splitting macros up. However, for this usecase, here are two alternatives to consider, both involving the amalgamation of two roll queries: ?{Choose a weapon|Longsword,+0|Flail,+1|Longsword (Orcs!),+5} ?{Choose a weapon|Longsword,?{Orcs?|Nope.,+0|Yes!!,+5}|Flail,+1} HarbingerLeo said: There's a good bit more to the roll then just the core "/roll {d6,d6}kh1" then I showed you. It's actually 4 to 6dice different dice each referencing a character sheet and the entire roll treated a little different at different points. Sometimes it's the same roll but with a target number of success instead of the highest showing dice. Same roll, different uses, and different bonuses. If you posted a few of these macros in full, it would be easier for others to help optimize them.
1440793715

Edited 1440878218
DK Heinrich said: I hope your game runs well and the macros do their job! Thank you sir. :) Silvyre said: ?{Choose a weapon|Longsword,?{Orcs?|Nope.,+0|Yes!!,+5}|Flail,+1} Nested queries is a interesting trick. I'll have to remember that one. Silvyre said: If you posted a few of these macros in full, it would be easier for others to help optimize them. Well ... I was asking for help in the syntax, but if you feel you can optimize them? Full information overload time then. Fell free to improve, you may impress me. Definitions that this uses: Species dice: A die (or dice) and define how hardcore you are about being a certain race. Certain races -there are many- allow the their species dice to be added to specific rolls. Career dice: A die (or dice) how good you are at a chosen job. Certain careers allow the their career dice -there are many- to be added to specific rolls. Body dice: A die (or dice) representing how physical strong one is. Mark dice: A die (or dice) represent how good you are at a certain skill. Brawling: A specific skill representing natural or fisticuffs weapon use. The skill can use up to three dice or more. One die for however many marks you have in the skill, Mark Dice, one for if your chosen career is focused on this, Carrier dice, and one if your given race is just naturally good at this skill, Species dice. Brawling is sort of a meta-macro by it's self. (Brawling = Mark_dice (+ Species_dice) (+ Carrier_dice)) Gift of Strength: Think of this as a bonus feat that adds a bonus d8 to certain actions. For this use, it only adds a bonus d8 to a normal attack. Cover: Something that is or can easily be moved in the way to provide physical cover. It's a die (or dice) that add to any attempt to dodge (not covered here) or parry a attack. In my case my cloak offers a d4. Attack: I'm using my claws. Claws attack by rolling the Body, Species, and Brawling dice. The gift of strength adds a bonus d8 to this. Counter-Attack: An attack roll to a attacker and attempt to interrupt and harm them preemptively. There are rules for when and how it can be used, but the only rule of note to this roll is the gift of strength does not apply to this. To roll a counter it's a attack roll: Body, Species, and Brawling dice. Parry: An attempt to use your weapon (in my case claws) to stop a attack from landing. "I know kung-fu!" stuff. The parry roll is a normal attack roll with cover added: Body, Species, Brawling, and Cover dice. So the attack roll comes out to look something like this: @{body-select}+@{species-select}+@{select_mark-Brawling}+@{select_species-Brawling}+@{select_career-Brawling}+d8 The counter attack roll comes out looking like this: @{body-select}+@{species-select}+@{select_mark-Brawling}+@{select_species-Brawling}+@{select_career-Brawling} The parry roll comes out looking like this (there is no clear 'cover' entry in the character sheet): @{body-select}+@{species-select}+@{select_mark-Brawling}+@{select_species-Brawling}+@{select_career-Brawling}+d4 If you'll note with the exception of the bonus dice, that roll is almost exactly the same each time. Thus my 'redundant code' comment. Here's another kicker, '+'s are easier to read and understand, but because of the way roll commands work those should be ','s. If I have to change that (again or for another reason) that's a lot of places to update at once.
I'm guessing you want the game to sort out which dice rolled the highest, and you already have a macro for each 'skill/carreer'? it seems to me that you could have an attribute 'base-brawling' which references the other attributes. in this case, add an attribute base-Brawling == @{body-select}, @{species-select}, @{select_mark-Brawling}, @{select_species-Brawling}, @{select_career-Brawling} Then your macro could be: /roll {@{base-Brawling},?{Action|Attack,d8|Counter Attack,0d0|Parry,d4}}kh1 is that more what you are looking for? if so you could expand that to cover multiple skills or careers with one macro fairly easily.
I wouldn't have thought to cross the two ideas. Clever, thank you. That idea too is helpful to know down the road. (To call on a character sheet ability I think the syntax is %{Character_Name|Ability_Name}, exactly) I think I'll stick with the solution of putting things into a base-Brawling macro, and then create three separate button macros for each one of the actions I take that call on the base-Brawling macro. To be clear I've been avoiding queries because by the time I'm ready to click the button? I already know what needs to be done. Three separate end-user macros tie all three possible actions to one click each. I'll never click the parry button setup to use a d4, and then have to answer "Wait! I really meant to use a d8!" That's still a clever solution and one I'll say would work though, Dalton.
np. the reason to use a roll query (for me, anyway) in that situation is to reduce the number of buttons. if i could reduce a bunch of rolls to one button then that is generally what i like to do.  also, i may be misunderstanding you, but the macro i used above:  /roll {@{base-Brawling},?{Action|Attack,d8|Counter Attack,0d0|Parry,d4}}kh1 only shows the options Attack, Counter Attack, and Parry. it doesn't show the d8, the 0d0, or the d4. it just creates a variable called Action, and sets the value of that variable to d8, 0d0, or d4 based on the choice. it doesn't require the end user to choose Attack, Counter Attack, and Parry, and then choose d8, 0d0 , or d4.
1440885069

Edited 1440885336
Correct. I'm say "@{base-Brawling}" never worked for me. @ references "Attributes". base-Brawling, by the letter of the law, isn't a "Attribute". It's listed under "Abilities". It will return the error : "No attribute was found for @{Lux|base-Brawling}" To reference Abilities you need to use a %, and because of a quirk with how that's setup you can't leave the first part blank and let Roll20 assume you mean "the ability on this character sheet". For instance, if my character's name was "Lux"? The following would work: /roll {%{Lux|base-Brawling},?{Action|Attack,d8|Counter Attack,0d0|Parry,d4}}kh1
you would need to add the attribute to the sheet. then reference that attribute in the macro. if you send me an invite to your campaign, i'll show you what i am talking about directly
as a side note, the dev's may have gone overboard with that quantum engine.
Dalton H. said: as a side note, the dev's may have gone overboard with that quantum engine. I'm archiving that, backing up, and never letting that screenshot go! See! Time travel does exist. :P