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 .
Advertisement Create a free account Compendium in Game, Join Today

Getting my butt kicked by a macro im trying to write

1610615036
So my character has an attack that gets bonuses for the margin of success on a skill roll. &{template:pf_generic} {{name=Deadly Leap}}{{color=green}}{{Acrobatics Check=[[ ?{Acrobatics Check}]]}} {{Enemy CMD=[[ ?{Target CMD}]]}}{{Margin of Success= [[(( ?{Acrobatics Check})-(?{Target CMD}))]]}}{{AC Bonus=+[[{[[floor(((?{Acrobatics Check})-(?{Target CMD}))/5)]]d1,@{Andrea Full Merge|level}d1 }kl1]]}}{{Attack Bonus=+[[{[[floor(((?{Acrobatics Check})-(?{Target CMD}))/5)]]d1,@{Andrea Full Merge|level}d1 }kl1]]}}{{Bonus Damage=+[[[[{[[floor(((?{Acrobatics Check})-(?{Target CMD}))/5)]]d1,@{Andrea Full Merge|level}d1 }kl1]]d6]]}} This macro works if I make the acrobatics check separately and input the results of the acrobatics check into the query box. What I want, is for the macro to make the check itself instead of me making the roll and manually inputting the results. I have tried a bunch of different ideas trying to get it to pull the check and make the roll, then input it into the other query boxes that need that information.
1610617079

Edited 1610617686
GiGs
Pro
Sheet Author
API Scripter
What youre trying to do isnt actually supported by roll20 macros - you cant make a roll and then use its result as a variable in later parts of the macro. There are often two ways around this, both kind of complex. The first is to use an API script, in place of the macro, which creates the output for you. The Power Cards script can probably do this. The second is to use a bit of an undocumented hack, called Reusing Rolls (you can search the wiki for that). With this you have to calculate all needed totals early in the macro, and then place the results using a synatx that looks like this: $[[0]]. Sometimes a roll is too complex for this. The macro below might  work: &{template:pf_generic} {{name=Deadly Leap}}{{color=green}} [[ [[ {floor(([[ [[1d20+@{Andrea Full Merge|Acrobatics}]] - [[(?{Target CMD}]])/5]] ]], @{Andrea Full Merge|level} }kl1 ]]d6 ]] {{Acrobatics Check=$[[0]]}} {{Enemy CMD=$[[1]]}} {{Margin of Success=$[[2]]}} {{AC Bonus=+$[[3]]}} {{Attack Bonus=+$[[3]]}} {{Bonus Damage=+$[[4]]}} Building expressions like this is very tricky! Replace the 1d20+@{Andrea Full Merge|Acrobatics} part with the roll you actually want to make. In your original macro, you had d1 in a couple of places, like this:  @{Andrea Full Merge|level}d1 . I don't know the contents of your attributes, but is this neccessary?It looks like both parts of that expression iwll be numerical, so you shouldnt need to convert them to dice.  But in case you do, I'd modify the macro as &{template:pf_generic} {{name=Deadly Leap}}{{color=green}} [[ [[ {floor(([[ [[1d20+@{Andrea Full Merge|Acrobatics}]] - [[(?{Target CMD}]])/5]] ]] +0d0, @{Andrea Full Merge|level} +0d0 }kl1 ]]d6 ]] {{Acrobatics Check=$[[0]]}} {{Enemy CMD=$[[1]]}} {{Margin of Success=$[[2]]}} {{AC Bonus=+$[[3]]}} {{Attack Bonus=+$[[3]]}} {{Bonus Damage=+$[[4]]}} The +0d0 method creates tidier outputs - converting a number to a die, without lots of 1,1,1,1,1,1,1s in the output. 
1610624447
&{template:pf_generic} {{name=Deadly Leap}}{{color=green}} [[ [[ {floor(([[ [[1d20+@{Andrea Full Merge|Acrobatics}]] - [[(?{Target CMD}]])/5]] ]] +0d0, @{Andrea Full Merge|level} +0d0 }kl1 ]]d6 ]] {{Acrobatics Check=$[[0]]}} {{Enemy CMD=$[[1]]}} {{Margin of Success=$[[2]]}} {{AC Bonus=+$[[3]]}} {{Attack Bonus=+$[[3]]}} {{Bonus Damage=+$[[4]]}} This macro does query me on the Target CMD, but doesn't actually output anything when entered :( Does it have anything to do with the bolded section having no kind of overall bracketing?
1610626714

Edited 1610626986
GiGs
Pro
Sheet Author
API Scripter
Try changing it tp this &{template:default} {{name=Deadly Leap}}{{color=green}} [[ [[ {floor([[ [[1d20+@{Andrea Full Merge|Acrobatics}]] - [[?{Target CMD|0}]] ]]/5), @{Andrea Full Merge|level}}kl1 ]]d6 ]] {{Acrobatics Check=$[[0]]}} {{Enemy CMD=$[[1]]}} {{Margin of Success=$[[2]]}} {{AC Bonus=+ $[[3]]}} {{Attack Bonus=+ $[[3]]}} {{Bonus Damage=+ $[[4]]}}
1610627198
GiGs
Pro
Sheet Author
API Scripter
Seriah said: Does it have anything to do with the bolded section having no kind of overall bracketing? If you meant the lack of rolltemplate brackets {{ }}, no - its intended that there are no such brackets around that. It performs the calculation, but does not get passed to the rolltemplate. Instead the $[[0]], $[[1]] etc are sent to to rolltemplate. Those quantities refer to which inline roll from the monstrous expression: $[[0]] is the first inline roll, $[[1]] is the second, and so on. When you have nested inline rolls, the innermost rolls are first. And you count from left to right, for inline rolls at the same nested level, and then outwards.
1610653736
that one worked!! thanks!
1610673660
GiGs
Pro
Sheet Author
API Scripter
great :)