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

Help with nested macro using roll templates or character sheet repeating action calls. 5e OGL. Current Script included.

September 21 (6 years ago)

Hey smart people!


I'm trying to work on a macro for my necromancer to make attack rolls with multiple skeletons faster / easier. While I have a hard coded version that works I'd ideally like to find a way to make use of roll templates / character sheet rolls for better formatting and the ability to recognize crits.

My current script is a nested set of two, as follows:

Skelleton bow attack/damage ("Sbow"):  

[[1d20+4]] - [[1d10+6]]

Skelleton multi attack macro ("SkelBowAtk"):

/emas "The Skeletons" attack! 
?{Attacks|
  1,#Sbow |
  2,#Sbow
#Sbow |
  3,#Sbow 
#Sbow 
#Sbow |
  4,#Sbow
#Sbow
#Sbow
#Sbow |
  5,#Sbow
#Sbow
#Sbow
#Sbow
#Sbow }

I have another set of two for the short swords. When I have tried previously to implement the nested query with either using templates or character sheet calls it broke the query and/or the template. 

I do have a pro account so have access to the API if there is a script that makes this function but I was unable to find one myself. 

Any help would be greatly appreciated! Thanks in advance!

-thedjally

September 21 (6 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

This is due to how roll queries work. There is no easy way to nest roll templates in them, but if you want to work on it, you can find the details on what needs to be done in the wiki and my roll query nester spreadsheet may be of use.

September 21 (6 years ago)

Hey Scott!

Thanks for your reply! I had previously tried to put the template in a macro, and then call said macro with my script. I tried this time to put everything in one macro. Although I had tried replacing characters before with no success I tried again. . .while the query works the template does not. Instead the output is the text that *should* code for the template. My code is as follows if you're willing to take a look:

The Skeletons attack!
Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}}?{Attacks|
  1, • |
  2, • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} |
  3, • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} |
  4, • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} |
  5, • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}} • Attack:&{template:npcaction}; {{attack=1}} {{damage=1}}; {{dmg1flag=1}};  {{name=Shortsword}} {{rname=Skeleton}} {{r1=[[d20+4]]}} {{always=1}} {{r2=[[d20+4]]}} {{dmg1=[[d6+6]]}} {{dmg1type=Slashing}} {{crit1=[[d6]]}}
}


Thanks!

September 21 (6 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

It looks like you're replacing characters for things that aren't in the roll query (e.g. your first template declaration. I'm on mobile atm, so it's hard to do a more in depth dig.

September 21 (6 years ago)

Hi Scott!

Turns out I'm really bad at scripting. I rebuilt it piecewise starting with 2 options and building up and I've gotten it working! Thanks so much for your help, your responses put me on the right path! 


thedjally