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

Looking for a little help

I wish to make a macro that reuses a previously made choice on a dropdown list. Here is the macro: /em &{template:default} {{name=Melee Attack Roll}} {{@{selected|token_name} takes a swing at @{target|token_name} with ?{Weapon?|@{selected|Weapon3}|@{selected|Weapon4} }! }} {{result=[[ ?{# of Die?|1}d20sd?{Type of attack?|Normal, |Epic,kh1|Hexed,kl1} + (@{selected|Mac|max}+@{selected| CHOSEN WEAPON |Max) + (?{Other Bonus/Penalties?|0}) ]] }} The bold is where I need to use the previously chosen option [Weapon3 or Weapon4] Is there a way to do this [without the API] or do I just need to place another dropdown list here?
1490996562
Andrew C
Marketplace Creator
@{selected|"?{Weapon?}"|Max} OR @{selected|?{Weapon?}|Max} should work...
Both of these gave an error: No attribute was found for @{selected|"?{Weapon?}" and No attribute was found for @{selected|?{Weapon?}
1490999725

Edited 1491000439
Ziechael
Forum Champion
Sheet Author
API Scripter
You could have the full template finish as a result of the query (you'll need to use html replacements for key characters as per the  advanced usage guide ): /em &{template:default} {{name=Melee Attack Roll}} {{@{selected|token_name} takes a swing at @{target|token_name} with ?{Weapon?| @{selected|Weapon3},@{selected|Weapon3}! }} {{result=[[ ?{# of Die?|1}d20sd?{Type of attack?|Normal, |Epic,kh1|Hexed,kl1} + (@{selected|Mac|max}+@{selected|Weapon3|Max}) + (?{Other Bonus/Penalties?|0} |@{selected|Weapon4},@{selected|Weapon4}! }} {{result=[[ ?{# of Die?|1}d20sd?{Type of attack?|Normal, |Epic,kh1|Hexed,kl1} + (@{selected|Mac|max}+@{selected|Weapon4|Max}) + (?{Other Bonus/Penalties?|0} }) ]] }}
1490999923
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yggdrasil said: Both of these gave an error: No attribute was found for @{selected|"?{Weapon?}" and No attribute was found for @{selected|?{Weapon?} Yep, this doesn't work due to the order of operations, attributes and abilities are resolved before roll queries. However, roll queries can be reused just fine, and you don't even have to repeat the options. You might have to use advanced roll queries (and all the html encoding that entails).
Oh, advanced queries and html encoding, always fun. :P Thanks for the help everyone.
1491003474

Edited 1491003529
Silvyre
Forum Champion
I'd probably just use something like /em &{template:default} {{name=Melee Attack Roll }} {{@{selected|token_name} takes a swing at @{target|token_name} with ?{Weapon?|    @{selected|Weapon1}, @{selected|Weapon1}! }} {{result=[[ @{selected|Weapon1|max} |    @{selected|Weapon2}, @{selected|Weapon2}! }} {{result=[[ @{selected|Weapon2|max} } + ?{# of Die?|1}d20sd?{Type of attack?|Normal, |Epic,kh1|Hexed,kl1} + (@{selected|Mac|max}) + (?{Other Bonus/Penalties?|0}) ]] }} as Z suggested. However, in case you're interested, there exists a different way of handling this using what I term " extended Attribute calls ".