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

Using Attributes that are macros in ability button macros

klRoll20 Question Some of the attributes have full macros in the value of the attribute. When I try to call those attributes within another macro it fails due to the way attribute substitution works in the order of operations. Is there a way around this? My ultimate goal is to be able to use the attribute in an ability button without having to rewrite the attribute or copy the entire thing into the ability code.
1602878103
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Terry said: klRoll20 Question Some of the attributes have full macros in the value of the attribute. When I try to call those attributes within another macro it fails due to the way attribute substitution works in the order of operations. Is there a way around this? My ultimate goal is to be able to use the attribute in an ability button without having to rewrite the attribute or copy the entire thing into the ability code. Hi Terry, First off, I quoted your post, since you seem to be using a dark mode style that makes the text nearly invisible for others. Second, I don't think so, due to the order of operations. Attributes always resolve first. This makes some macros very hard to use. I'm assuming this is on the D&D 5th Edition by Roll20 Sheet? Some recent (past year) changes to some kinds of ability checks brought in this practice of putting a formula in the attribute. Very annoying.
1602897379

Edited 1602897601
Oosh
Sheet Author
API Scripter
Isn't the behaviour the same for an Ability call? %{bob|attackMacro} is expanded just as an Attribute call is... what functionality broke with the change? And you can still call a skill roll with %{bob|acrobatics}, you don't have to reference the Attribute directly. @Terry - what's the actual code you're trying to run? It sounds like you might be after a chat menu , a bit hard to tell without more info though.
1602920094
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It can be done as a Chat Menu, but not a drop down query. Currently, you can call a Skill check in one of two ways. An ability (sheet action): %{selected|athletics_roll} or an attribute: @{selected|athletics} The attribute for that one expands to: @{wtype}&{template:simple} {{rname=^{athletics-u}}} {{mod=@{athletics_bonus}}} {{r1=[[{@{d20},0d20+10}k1+@{athletics_bonus}@{pbd_safe}]]}} {{always=1}} {{r2=[[{@{d20},0d20+10}k1+@{athletics_bonus}@{pbd_safe}]]}} {{global=@{global_skill_mod}}} @{charname_output} A query expands the roll template and you get garbage (without going through some very messy html substitutions), and as far as I know, you can't encode a sheet action into a query. Unless you pull off one of your trademark impossible tricks? I'd like to put the functionality into TokenActionMaker, since the current one doesn't account for Jack of All Trades or Reliable Talent.
1602939918
Oosh
Sheet Author
API Scripter
Well... only if you let me cheat :) [Roll ?{Skill|Acrobatics|Athletics}](~selected|?{Skill}) It creates a button from a drop-down, which rolls... does that count? Or defeat the purpose of the drop-down in the first place? I can't think of a non-messy way to get RT in to your script. I think you'd need to expand @{rtype} and have it hard-coded into the macro, which would mean having 2 versions of the macro, for Query & Always advantage. Grab the value of @{rtype} and use a regexp to work out which one they're using, then set the macro accordingly. Example of Query type advantage: @{wtype}&{template:simple} {{query=1}} ?{Advantage?|Normal Roll,&#123&#123normal=1&#125&#125 &#123&#123r2=[[{0d20|Advantage,&#123&#123advantage=1&#125&#125 &#123&#123r2=[[{@{d20}| Disadvantage,&#123&#123disadvantage=1&#125&#125 &#123&#123r2=[[{@{d20}},[[ceil(?{Skill| Athletics,@{athletics_prof}/100)*10]]+0d0}k1+@{athletics_bonus}[Athletics]]]}} {{rname=ATHLETICS}} {{mod=@{athletics_bonus}}} {{r1=[[{@{d20},[[ceil(@{athletics_prof}/100)*10]]+0d0}k1+@{athletics_bonus}[Athletics]| Acrobatics,@{Acrobatics_prof}/100)*10]]+0d0}k1+@{Acrobatics_bonus}[Acrobatics]]]}} {{rname=ACROBATICS}} {{mod=@{Acrobatics_bonus}}} {{r1=[[{@{d20},[[ceil(@{Acrobatics_prof}/100)*10]]+0d0}k1+@{Acrobatics_bonus}[Acrobatics]}]]}} I don't see how you can get Toggle Advantage to work with this, though. Jack of all Trades is easier, though if you only want it enabled for JoaT characters, it's going to mean another version of the macro just for JoaT, then another 2 versions for people using RT and JoaT, one for each @{rtype}. This one is just straight from the sheet, not rewritten at all for the drop-down: @{wtype}&{template:simple} {{rname=^{arcana-u}}} {{mod=@{arcana_bonus}}} {{r1=[[@{d20}+@{arcana_bonus}[ARCANA]+[[abs(ceil(@{arcana_prof}/100)-1)*0@{jack}]][JOAT]]]}} {{query=1}} @{rtype}+@{arcana_bonus}[ARCANA]+[[abs(ceil(@{arcana_prof}/100)-1)*0@{jack}]][JOAT]]]}} {{global=@{global_skill_mod}}} @{charname_output} If you wanted to check the setting on the sheet, grab the @{jack_of_all_trades} Attribute - @{jack} does not get zeroed if JoaT is flicked on and off again. Yeah, 5 versions of the macro and I'm pretty sure Toggle advantage is a dead-end for RT. Not sure if that's worth the effort :)
1602950674
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That was the conclusion I came to. :(
keithcurtis said: It can be done as a Chat Menu, but not a drop down query. Currently, you can call a Skill check in one of two ways. An ability (sheet action): %{selected|athletics_roll} or an attribute: @{selected|athletics} The attribute for that one expands to: @{wtype}&{template:simple} {{rname=^{athletics-u}}} {{mod=@{athletics_bonus}}} {{r1=[[{@{d20},0d20+10}k1+@{athletics_bonus}@{pbd_safe}]]}} {{always=1}} {{r2=[[{@{d20},0d20+10}k1+@{athletics_bonus}@{pbd_safe}]]}} {{global=@{global_skill_mod}}} @{charname_output} A query expands the roll template and you get garbage (without going through some very messy html substitutions), and as far as I know, you can't encode a sheet action into a query. Unless you pull off one of your trademark impossible tricks? I'd like to put the functionality into TokenActionMaker, since the current one doesn't account for Jack of All Trades or Reliable Talent. I think you have those call reversed. When I look at my sheet I have @{selected|atheletics_roll}   Which is an attribute whose 'value' is the expansion you have above. This also the call used if you click on the athletic skill on the character sheet. @{selected|atheletics_bonus} which is a simple attribute that holds a single numerical value %{selected|atheletics_roll} is only present if I create an ability with that name. My big issue is that I want to directly call @{selected|athletics_roll) from a macro/ability, such as this code to create ability buttons in the chat.  /w Terry &{template:simple} {{rname=Skill Checks}} {{always=1}} {{r1= [Per](~@{character_name}|@{perception_roll) [Stealth](~@{character_name}|Stealth-check) }}  The first line for [Per] will fail every time. The @{perception_roll} attribute is a complete roll command as shown in Keith's expansion. So when the interpreter reaches the attribute in replaces the call with the 'value' which is a full templated macro. So you get something like this  /w Terry &{template:simple} {{rname=Skill Checks}} {{always=1}} {{r1= [Per](~myName|@{wtype}&{template:simple} {{rname=^{perception-u}}} {{mod=@{perception_bonus}}} {{r1=[[@{d20}+@{perception_bonus}[Mods]@{pbd_safe}]]}} {{always=1}} {{r2=[[@{d20}+@{perception_bonus}[Mods]@{pbd_safe}]]}} {{global=@{global_skill_mod}}} @{charname_output})  This doesn't work for more reasons than I can figure out. The second line of code for the Stealth button works, because I created an ability that only calls the @{selected|Stealth_roll} attribute. So after substitution I get this which works  /w Terry &{template:simple} {{rname=Skill Checks}} {{always=1}} {{r1=[Stealth](~Stealth-check)}} My issue is that it would be nice to eliminate the creation of the Stealth-check helper ability.
1603258901
Oosh
Sheet Author
API Scripter
Ah yep, those buttons need to point to an Ability, and not an Attribute. As I hinted up above, you can do this: [Roll ?{Skill|Acrobatics|Athletics|Pole Dancing}](~@{selected|character_name}|?{Skill}) This will create a clickable button for your skill selection, provided it is spelled correctly and exists on the sheet. Keith is referring to attempting to get this to work in a drop-down Query, with no button click required. It's fiendishly difficult to get working with Reliable Talent, as I've discovered.