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

Roll Macro Help

So I'm prepping some roll macros for a Fate Accelerated game that I plan to run soon and I'm running into a problem. I'm not sure if what I want to do is possible with macros, but hopefully I'm just missing something obvious and one of you fine could point me in the right direction. I'm also not the most skilled code-boy out there, so apologies is a lot of this is explained poorly. I'm building a roll template and what I'm looking to have it do is: one one line display the name of the Approach (attribute) used, then next to it in parenthesis the value of said approach. On the next line roll the dice and add the value of that same Approach once again. Ideally I would like this to only query the use about what Approach to use once. Basically I need it to deliver the name of the attribute used once, and then the value of the attribute the next 2 times. My idea was to have the macro query the user for the name of the approach to be rolled. Then I can display the name, and reuse the same query again, but nested inside a call for the character's attribute, giving me both results while only bothering the user once. Here's what I have now: ?{Approach|careful|clever|flashy|forceful|quick|sneaky} &{template:default} {{name=@{selected|token_name}}} {{Action=ATTACK}} {{Approach=?{Approach} (+@{selected|?{Approach}})}} {{Roll=[[4df]]}} (Note: I haven't added the attribute query to the roll section yet, because I can't get it work earlier in the macro)  And here's what it's delivering (after the error message: "No attribute was found for @{selected|?{Approach}"): As you can see, It worked correctly to deliver the name of the selected Approach, but not when I try to nest the query inside of @{selected) Is this simply not supported behavior with macros? Have I made a huge mistake? Am I just being dumb and screwed up something which should be simple? (Note that in Fate there are 4 basic actions, and each character has 6 "attributes". Right now I have 1 macro for each action, then then queries the user about what attribute to use. I could easily solve this by having a macro for each attribute and then querying for the action instead; But that would clutter the screen with extra token-actions and seems like it would be a slightly backwards thought process when going to roll)
1501189724

Edited 1501189866
Liam M. said: Is this simply not supported behavior with macros? Correct. It is not possible to use a query within an attribute call (@{selected|?{query}}. This is because of the order of operations within a command. Attributes come before queries. In order to accomplish what you want you are going to need to turn the query into a dropdown list instead of a straight text version. In order to also get this attribute in the roll you will need to use advanced macro formatting to encode the }} of the Approach field into }} I think this will work for what you want. ?{Approach|careful|clever|flashy|forceful|quick|sneaky} &{template:default} {{name=@{selected|token_name}}} {{Action=ATTACK}} {{Approach=?{Approach |Careful,Careful (+@{selected|careful})}} {{Roll=[[4df+@{selected|careful}]] |Clever,Clever (+@{selected|clever})}} {{Roll=[[4df+@{selected|clever}]] |Flashy,Flashy (+@{selected|flashy})}} {{Roll=[[4df+@{selected|flashy}]] |Forceful,Forceful (+@{selected|forceful})}} {{Roll=[[4df+@{selected|forceful}]] |Quick,Quick (+@{selected|quick})}} {{Roll=[[4df+@{selected|quick}]] |Sneaky,Sneaky (+@{selected|sneaky})}} {{Roll=[[4df+@{selected|sneaky}]] }}}
Ah, that looks like it works! Thank you Kyle G! I'd tried something similar to that earlier but didn't have any luck getting it to work. Looks like you prevailed where I was simply lost though. This is a huge help!
If you still have what you were trying to do, I may be able to point out the problem.
Well, with your post from before I managed to get it working more or less exactly as I was looking for it to work. I'm not entirely sure I understand why replacing the }} with the html code works, but it seems to. The only thing I'm still struggling with on this is adding another query for extra modifiers. The code you gave me works well as is, but as soon as I add another query in there it breaks on me and I'm not sure why. That said, that's a really minor thing that absolutely doesn't need to be built into the roll macro, and it was more for myself to see if I could make it work. Sadly I don't have that saved any more.  Basically I was trying variations on: &{template:default} {{name=@{selected|token_name}}} {{Action=ATTACK}} {{Approach=?{Approach |Careful (+@{selected|careful}) (+?{Mod|0}),Careful (+@{selected|careful})}} {{Result=[[4df+@{selected|careful}+?{Mod|0}]] ... Whenever I added those Mod queries it just broke a lot of other stuff and I'm not certain why. Before I add the Mod query: and after I add it I get an input box like this, with a bunch of extra stuff listed... and that outputs nothing to chat: But like I said, it's a feature I can completely live without.
Here's the code that will ask for a modifier within the query. &{template:default} {{name=@{selected|token_name}}} {{Action=ATTACK}} {{Approach=?{Approach |Careful,Careful (+@{selected|careful}) (+?{Mod|0&#125)}} {{Roll=[[4df+[[@{selected|careful}]][careful]+[[?{Mod}]][mod]]] |Clever,Clever (+@{selected|clever}) (+?{Mod|0&#125)}} {{Roll=[[4df+[[@{selected|clever}]][clever]+[[?{Mod}]][mod]]] |Flashy,Flashy (+@{selected|flashy}) (+?{Mod|0&#125)}} {{Roll=[[4df+[[@{selected|flashy}]][flashy]+[[?{Mod}]][mod]]] |Forceful,Forceful (+@{selected|forceful}) (+?{Mod|0&#125)}} {{Roll=[[4df+[[@{selected|forceful}]][forceful]+[[?{Mod}]][mod]]] |Quick,Quick (+@{selected|quick}) (+?{Mod|0&#125)}} {{Roll=[[4df+[[@{selected|quick}]][quick]+[[?{Mod}]][mod]]] |Sneaky,Sneaky (+@{selected|sneaky}) (+?{Mod|0&#125)}} {{Roll=[[4df+[[@{selected|sneaky}]][sneaky]+[[?{Mod}]][mod]]] }} I would recommend that you take a look at  Advanced Usage For Roll Queries as it discusses when and how to use the HTML encoding. 
If you're interested in avoiding advanced queries, this should work, too: &{template:default} {{name=@{selected|token_name}}} {{Action=ATTACK}} {{Approach=?{Approach|    Careful, [Careful] (+@{selected|careful}) |    Clever, [Clever] (+@{selected|clever}) |    Flashy, [Flashy] (+@{selected|flashy}) |    Forceful, [Forceful] (+@{selected|forceful}) |    Quick, [Quick] (+@{selected|quick}) |    Sneaky, [Sneaky] (+@{selected|sneaky})   } (+?{Mod|0}) }} {{Roll=[[ 4df + ?{Approach} + (?{Mod}) ]]
Thanks for all the advice, guys. I think I've come up with a workable solution now. It took a lot more time and messing about with stuff then I expected but here's what I managed to come up with based on your help. First, the base macro for the performing the roll: &{template:default} {{name=@{selected|token_name}}} {{Action=ATTACK}} {{Approach=?{Approach |Careful (+@{selected|careful}),Careful (+@{selected|careful})}} {{Result=[[4df+@{selected|careful} &{tracker}]] |Clever (+@{selected|clever}),Clever (+@{selected|clever})}} {{Result=[[4df+@{selected|clever} &{tracker}]] |Flashy (+@{selected|flashy}),Flashy (+@{selected|flashy})}} {{Result=[[4df+@{selected|flashy} &{tracker}]] |Forceful (+@{selected|forceful}),Forceful (+@{selected|forceful})}} {{Result=[[4df+@{selected|forceful} &{tracker}]] |Quick (+@{selected|quick}),Quick (+@{selected|quick})}} {{Result=[[4df+@{selected|quick} &{tracker}]] |Sneaky(+@{selected|sneaky}),Sneaky (+@{selected|sneaky})}} {{Result=[[4df+@{selected|sneaky} &{tracker}]] }}} Since in Fate bonuses are often applied to rolls after the fact once someone has already seen their result I made a few changes. As such the macro does not ask for an additional modifier right away. The macros was modified so that the roll result is stored on the token's entry in the turn tracker... since it looks like that's just about the only "stat" that macros are allowed to alter. If they player then decides to spend Fate Points on a bonus or has some other means of obtaining a modifier there is a second macro to handle that: &{template:default} {{name=@{selected|token_name}}} {{Invoke / Bonus=+?{Bonus|2} }} {{ New Total=[[ ?{Bonus|2} + @{tracker|Birdbrain} &{tracker} ]] }} This one then reads the value of the token's last roll from the turn tracker, applies the new modifier/bonus and updates the tracker once more. Yes, it would be easy enough to do the simple addition in one's head, but I figured this method leaves a permanent record of the total result in chat just in case people forget the final value when long strings of bonuses get involved. The only hitch is that the second "bonus" macro needs to be built separately for each character, since putting the call @{selected|token_name} doesn't work within @{tracker|item name}. I'm not sure if it's at all possible to nest calls like that without a lot of changes that may be more effort than they're worth. For now simply manually replacing the character name when creating each character's "bonus" ability is simple enough. I'm hoping this solution is viable, but there's always the chance I've ruined things somehow.