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

Please help me understanding a macro

I am trying to understand a macro I found posted in the forms, without much success.  The macro I want to modify is this Animate Objects macro .  Take for example this line from it: }} {{Attack #[[[{?{Number of attacks}, 6}kl1]]](#)=[[ ?{Roll} + [[abs(?{Size} - 1) + 5]] + {0} ]] vs. AC for [[ [[1 + ceil(?{Size} / 4)]]d[[floor((?{Size} - 2 * {0, 3}=[[2 + ?{Size}]]) / 2) * 2 + 8]] + [[abs(?{Size} - 1) + 1]] ]] damage (if crit, +[[ [[1 + ceil(?{Size} / 4)]]d[[floor((?{Size} - 2 * {0, 3}=[[2 + ?{Size}]]) / 2) * 2 + 8]] ]]) Questions: I cannot figure out the function this part: "[[[{?{Number of attacks}, 6}kl1]]](#)". The inner part "[[{?{Number of attacks}, 6}kl1]]" is an inline dice roll, but I cannot figure out the function of the the outer part "[<dice result>](#)" It looks a bit like like the syntax for "Ability Command Buttons", but that does not seem to be what is going on. Inside the to hit portion there is "+ {0}". What does this do? Inside the damage calculation is "2 * {0, 3}=[[ <some inline roll> ]]" I do not understand the what "{0, 3}=" does. I have tried searching the forums and looked at the documentation without success. Thanks in advance for answers or pointers to documentation. Bret
1612582856

Edited 1612582999
Oosh
Sheet Author
API Scripter
The first part you're looking at is a template property overwrite, as explained in this post - there's a multiattack macro in there which is a simplified version of the Animate Objects macro you're looking at. Basically, when you choose to roll 6 attacks on one of these macros, it still rolls all 10 (or however many are coded), and this: [[[{?{Number of attacks}, 6}kl1]]](#) generates an API command button with a null link which causes all attacks after number 6 to keep overwriting number 6. The overwrite doesn't work without being turned into an API command button due to the inline roll results not being identical property names from the point of view of the roll template. Here's another simplified version: &{template:default} {{name=Overwrite}} {{[[[{?{Number of attacks|1|2|3}, 1}kl1]]](#)=First entry}} {{[[[{?{Number of attacks}, 2}kl1]]](#)=Second entry}} {{[[[{?{Number of attacks}, 3}kl1]]](#)=Third entry}} You'll notice that no matter how many "attacks" you choose, you always get "Third entry". And a version without the null API buttons, which won't work: &{template:default} {{name=Overwrite}} {{[[{?{Number of attacks|1|2|3}, 1}kl1]]=First entry}} {{[[{?{Number of attacks}, 2}kl1]]=Second entry}} {{[[{?{Number of attacks}, 3}kl1]]=Third entry}} As for the other stuff - I don't think it's doing anything. {0,3} is shorthand for {0,3}kh1 - in this universe, as far as I'm aware, 3 is always going to win that battle. My best guess would be that Kyle generated his macros with either an iterative script, or built them out in Roll20 using Attribute references, and copied the end result with the numbers replacing the Attribute references, but didn't clean up the superfluous syntax.
1612584308
GiGs
Pro
Sheet Author
API Scripter
That's a complex macro. I'll do my best to figure it out. I cannot figure out the function this part: "[[[{?{Number of attacks}, 6}kl1]]](#)". The inner part "[[{?{Number of attacks}, 6}kl1]]" is an inline dice roll, but I cannot figure out the function of the the outer part "[<dice result>](#)" It looks a bit like like the syntax for "Ability Command Buttons", but that does not seem to be what is going on. When using the default rolltemplate, you have keys  and values . The key is the part to the left of the =, the value is to the right, eg {{key=value}} Keys have to be unique, or they dont get displayed. So my guess is its using the kl1 feature to hide attacks beyond the amount chosen, by making sure all attack lines beyond that have the same key, which means they don't get displayed. This is very clever.  The extra set of square brackets followed by the (#) hides the fact that the number in attack #4 is an inline roll - it appears to be a normal number. Inside the to hit portion there is "+ {0}". What does this do? I have no idea why that's there. It doesnt seem to be necessary.  Inside the damage calculation is "2 * {0, 3}=[[ <some inline roll> ]]" I do not understand the what "{0, 3}=" does. The {0,3}=[[inline roll]] is a group roll comparison. Silvyre used these a lot to generate some almost magical macros. Here I think it will return 0 or 1, and just before it is -2 *, so it looks to me like this is going to by -0, or -2. So it looks like this is a correction factor to make sure the damage dice calculation is correct for creature size. 
1612584583
GiGs
Pro
Sheet Author
API Scripter
Oosh said: [[[{?{Number of attacks}, 6}kl1]]](#) generates an API command button with a null link  Ah, of course, that explains why it works to make the inline roll appear like a normal number.
Thank you Oosh and GiGs - the information in your combined replies allowed me to get what my macros working.