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

Calling Character Sheet Macros

Hi all... I have a token macro that is trying to call a macro that is on a charactersheet.  I want to use an attribute from selected token as part of the macro name, but it wont let me do it.  Is there a trick to this? This creature is CR Rated: @{selected|npc_challenge} %{MacroCRLOOT|CRLOOT@{selected|npc_challenge} This will output the creatures CR, lets say 3 of the selected token, this works fine. But the secondline just outputs as the formula text, and doesnt fire the macro from the MacroCRLOOT page.  If I replace that line with:  %{MacroCRLOOT|CRLOOT3 Then it will run properly.. This appending will work if you use the # to run macros, but I cant use that to call a sheet (that I know of) Any clues on how to make this append properly?   Overall Goal is to have a token button that will pull the CR level and run the macro for loot of that level.  Since I need a macro for every CR level, thought it best that they live on a sheet.  (free user, so no scripts)
1682655477
timmaugh
Forum Champion
API Scripter
Without scripts, you can leverage the  Order of Operations  to your advantage. Attributes are detected/parsed up to 99 times before abilities are parsed (also 99 times)... So if you put the start of the ability you want to call in one attribute, then the selected call, then a closing brace, Roll20 will construct what you want. Create a prefix attribute named abil_prefix (name is just an example. Make it read: %{MacroCRLOOT|CRLOOT Then, when you want to incorporate info from the selected token, you can call it like this: @{abil_prefix}@{selected|npc_challenge}} After the first round of parsing, it will read: %{MacroCRLOOT|CRLOOT3} Then that construction will be found in pass #2 of attribute expansion.
1682667252

Edited 1682968190
GiGs
Pro
Sheet Author
API Scripter
As Tim says, the only way to do this without Scripts is to use the prefix trick. This is because Roll20 macros follow an order of operations , and this order means - among other things - that you can't include attribute calls (things that look like @{attribute} inside attribute or ability calls (things that look like %{ability}).
1682949931

Edited 1682950776
Thanks for these tips, never would have gotten to this workaround without your help. Thanks much, gonna give it a try. EDIT: Got it working, thanks !