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

Chat Menu vs. Macro - Can't figure out why this won't work

Hi! I have a character sheet named "Macro" with a series of abilities named: 1-SingleAttack 2-SingleAttack 3-SingleAttack ... and so on. I am trying to call these macros based on the number in Bar3 of the selected token. This feels to me like it should work: %{Macro|@{selected|Bar3}-SingleAttack} It doesn't. It returns an error: "No ability was found for %{Macro|Bar3}." Yet this creates a chat button that works:  [Single Attack](~Macro|@{selected|Bar3}-SingleAttack) I'd really prefer to avoid the second click of a chat menu if possible. As an example, 0-SingleAttack reads:     /emas @{selected|token_name} attacks!     /r 1d20+[[3+@{selected|Attack_Mod}]]      For [[1d7+@{selected|Dam_Mod}]] damage! I suspect I'm missing something simple in the format, but I'm new to this and am having a hard time parsing the advanced roll queries section.
1583736374
GiGs
Pro
Sheet Author
API Scripter
You cant do this: %{Macro|@{selected|Bar3}-SingleAttack) because of roll20s order of operations. When you trigger a macro button, roll20 grabs the references for all attribute or macro calls, so it tries to find %{Macro|@{selected|Bar3}-SingleAttack}  before it resolves into %{Macro|whatever is in that bar}. So this call naturally fails. This works: [Single Attack](~Macro|@{selected|Bar3}-SingleAttack) again because of the order of operations. That @{selected|Bar} is read, and its contents put in this text, which is printed into chat. So when you go to click that button, it has a proper reference and works.
Aha! That also explains why you can't just select a new token and hit the same button in a chat menu. The @selected is processed when the chat menu is created. Thank you!