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 .
×

Re-Using dropdown query result later in same macro (PF 1E)

1654992794

Edited 1655019283
Hello everyone,  So this thingy might have already been answered but the subject of macros is so diverse i'm getting a bit lost, so i'd appreciate any help or useful redirection.  To put some context, in a PF game my character has an ability that adds a d6 to his attack, then adds twice the result of that d6 to his damage. I'm using and slightly modifying the macros initially present in the pathfinder character sheets. I've been using a dropdown query with a yes/no for the initial d6 bonus (since the bonus isn't always there), giving me something like this for the "attack" part  :   {{attack=[[ 1d20cs>[[ @{crit-target} ]] + @{attack_macro} +?{Inspiration ? |Oui, 1d6|Non, 0} ]]}}  But how to use that result later for the damage part ? I wanted to try and put the "1d6" in brackets and use the re-using tricks found in the wiki, doing something like this (note that I have another query in the damage but it shouldn't have an impact in this case since it already works just fine by itself usually) :   {{attack=[[ 1d20cs>[[ @{crit-target} ]] + @{attack_macro} +?{Inspiration ? |Oui, [[1d6]]|Non, 0} ]]}}  {{damage=[[@{damage-dice-num}d@{damage-die} + @{damage_macro} + $[[2]]*2 +?{Studied strike ? |Oui, 3d6|Non, 0}]]}}  In the attack part, the query still works fine, but the damage part doesn't compute correctly, giving me "visually" this kind of results :  Attack 45   vs AC Damage - P [[1d4 + 12 [Total] + 0 + 0 + 0 +  6 *2 + 3d6]] I've been trying a few other things without success, so if anyone could give me any hint as to how to make the macro work, it would be greatly appreciated.  Thanks in advance,  Glonthein
1654996271
Andrew R.
Pro
Sheet Author
Is there a line break after the attack= line? Because Roll Templates should be all on 1 line.  (Quick glance troubleshooting  on my iPad)
1655019593

Edited 1655035435
Hi,&nbsp; If I don't use the re-using thing, the template works just fine :&nbsp; {{attack=[[ 1d20cs&gt;[[ @{crit-target} ]] + @{attack_macro} +?{Inspiration ? |Oui, 1d6|Non, 0} ]]}} {{damage=[[@{damage-dice-num}d@{damage-die} + @{damage_macro}&nbsp; +?{Studied strike ? |Oui, 3d6|Non, 0}]]}}&nbsp; Attack <span class="userscript-inlinerollresult showtip tipsy-n-right" title=" Rolling 1d20cs>18 + 21 [Total] + 0 + 0 + 0 + 1d6 = ( 11 )+21+0+0+0+( 4 )" style="border: 2px solid ; padding: 0px ; cursor: help ; min-width: 2rem ; text-align: center ; display: inline-block">36 &nbsp; vs AC Damage - P 13 (I removed the style on the first line's result else it is all white here for some reason) I should add this isn't the whole template, i just copied the parts that I modified. The whole macro is like this :&nbsp; &amp;{template:pf_attack} @{toggle_attack_accessible} @{toggle_rounded_flag} {{font=@{apply_specfont_chat}@{use_specfont}}} {{scroll_desc=@{scroll-desc}}} {{color=@{rolltemplate_color}}} {{character_name=@{character_name}}} {{character_id=@{character_id}}} {{subtitle}} {{name=@{name}}} {{attack=[[ 1d20cs&gt;[[ @{crit-target} ]] + @{attack_macro} +?{Inspiration ? |Oui, 1d6|Non, 0} ]]}} {{damage=[[@{damage-dice-num}d@{damage-die} + @{damage_macro}&nbsp; +?{Studied strike ? |Oui, 3d6|Non, 0}]]}} {{crit_confirm=[[ 1d20 + @{attack_macro} + [[ @{crit_conf_mod} ]] ]]}} {{crit_damage=[[ [[ @{damage-dice-num} * (@{crit-multiplier} - 1) ]]d@{damage-die} + ((@{damage_macro}) * [[ @{crit-multiplier} - 1 ]]) ]]}} {{type=@{type}}} {{weapon_notes=@{notes}}} @{iterative_attacks} @{macro_options} {{vs=@{vs}}} {{vs@{vs}=@{vs}}} {{precision_dmg1=@{precision_dmg_macro}}} {{precision_dmg1_type=@{precision_dmg_type}}} {{precision_dmg2=@{global_precision_dmg_macro}}} {{precision_dmg2_type=@{global_precision_dmg_type}}} {{critical_dmg1=@{critical_dmg_macro}}} {{critical_dmg1_type=@{critical_dmg_type}}} {{critical_dmg2=@{global_critical_dmg_macro}}} {{critical_dmg2_type=@{global_critical_dmg_type}}} {{attack1name=@{iterative_attack1_name}}}
1655065373

Edited 1655065393
vÍnce
Pro
Sheet Author
I don't think you can re-use a roll without an API script...&nbsp; As I recall, other than posting the result, I don't believe you can actually DO anything with the re-use trick either. ;-( You can probably post the additional Inspiration Damage as it's own line with the re-use trick , although it won't actually multiply the result by 2. So you would need to mentally adjust the total damage. &amp;{template:pf_attack} @{toggle_attack_accessible} @{toggle_rounded_flag} {{font=@{apply_specfont_chat}@{use_specfont}}} {{scroll_desc=@{scroll-desc}}} {{color=@{rolltemplate_color}}} {{character_name=@{character_name}}} {{character_id=@{character_id}}} {{subtitle}} {{name=@{name}}} {{attack=[[ 1d20cs&gt;[[ @{crit-target} ]] + @{attack_macro} +[[?{Inspiration ? |Oui, 1d6|Non, 0}]] ]]}} {{Inspiration Damage=$[[3]]*2 }} {{damage=[[@{damage-dice-num}d@{damage-die} + @{damage_macro} + ?{Studied strike ? |Oui, 3d6|Non, 0}]]}} {{crit_confirm=[[ 1d20 + @{attack_macro} + [[ @{crit_conf_mod} ]] ]]}} {{crit_damage=[[ [[ @{damage-dice-num} * (@{crit-multiplier} - 1) ]]d@{damage-die} + ((@{damage_macro}) * [[ @{crit-multiplier} - 1 ]]) ]]}} {{type=@{type}}} {{weapon_notes=@{notes}}} @{iterative_attacks} @{macro_options} {{vs=@{vs}}} {{vs@{vs}=@{vs}}} {{precision_dmg1=@{precision_dmg_macro}}} {{precision_dmg1_type=@{precision_dmg_type}}} {{precision_dmg2=@{global_precision_dmg_macro}}} {{precision_dmg2_type=@{global_precision_dmg_type}}} {{critical_dmg1=@{critical_dmg_macro}}} {{critical_dmg1_type=@{critical_dmg_type}}} {{critical_dmg2=@{global_critical_dmg_macro}}} {{critical_dmg2_type=@{global_critical_dmg_type}}} {{attack1name=@{iterative_attack1_name}}} Hovering over the attack below, you can see that the attack roll inspiration rolled a "2", which is reflected in the "Inspiration Damage" line as 2*2
Well thanks vince for the answer, it's not ideal but I can still make it work. The only other way I had found to make something more or less acceptable was putting the query as a custom attribute (the ones in the PF sheet that evaluate at roll time) and calling said attribute in the macro for both atk and dmg. it works in the way that I only have to make the choice for the query once, and the calculation for the damage gets done correctly, but it also means the roll result of the inspiration dice most likely won't be the same between atk and dmg. Also the custom attributes makes the macro looks cleaner/easier to update, so i'm going to check and see if I can combine both (use custom attribute and calling the result with the re-use trick in a separate line). Hopefully shouldn't be too hard to do.&nbsp;
1655187347
vÍnce
Pro
Sheet Author
While including multiple, "matching" queries within a single roll produces a single prompt, dice rolls that are included in the query happen as if each query were unique. ;-(&nbsp; Not sure if there's a workaround for that.