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

How can you properly roll for the name of an attribute call ?

Hi, I'm trying to achieve the following : Having attributes "tst_1" (value "abc"), "tst_2" (value "def"), "tst_3" (value "ghi") and "tst_4" (value "jkl"), and calling one of them randomly via a d4 (my testing character sheet is named "Ruen"). For ease of parsing, I also have the attribute "AttributePrefix" (value "@{Ruen|"). I have tried the following command :&nbsp; @{Ruen|AttributePrefix}tst_[[1d4]]} But the output is : No attribute was found for @{Ruen|tst_[[1d4]]} GaelL (GM): &nbsp;Ruen|tst_<span class="inlinerollresult showtip tipsy-n-right fullfail" original-title=" Rolling 1d4 = ( 1 )" style="box-sizing: content-box; background-color: rgb(254, 246, 142); border: 2px solid rgb(179, 21, 21); padding: 0px 3px; font-weight: bold; cursor: help; font-size: 1.1em;">1 It seems that the roll is processed too late (after the attribute call is tried). As a confirmation, I added attribute "tst_[[1d4]]" (value "haha") and re-called the above command : GaelL (GM): &nbsp;. haha I wonder if there's something I'm missing in order to process the roll (for [[1d4]] to become either 1, 2, 3 or 4) before the attribute call. Any help would be appreciated.
1535901448
The Aaron
Pro
API Scripter
You are missing the Order of Operations:&nbsp; <a href="https://wiki.roll20.net/Dice_Reference#Order_of_Operations" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Order_of_Operations</a> Variables (Attributes) are substituted at Step 3, Inline rolls aren't processed until Step 6. Usually, you'd use a Rollable Table to generate some random string.&nbsp; Are you just trying to learn the capabilities of the system, or is there something specific you're trying to do that we can help with?
1535901677

Edited 1535902852
Well, see, Rollable Tables are great, but aren't easy to export/import in many different games like a character sheet (I wouldn't want to cause extra work to the DMs I play with just so that my table is in their game), so I'm trying to achieve a similar thing to a Rollable table INSIDE my character sheet itself. An alternative I tried is to store a random value in my selected token's initiative tracker... /roll 1d4 &amp;{tracker} And then make the attribute call using the tracker value... @{Ruen|AttributePrefix}tst_@{tracker|Ruen}} Which works great when the commands are delayed (do the first one, wait for the tracker to update, then do the second one). It, however, does not work so great when the two commands are done right after one another, as the tracker is not yet updated when the second command is issued (so the value used in the ability call is the previous tracker value). I wonder if there would be a way to put an artificial delay between the two to automate the thing... My goal is to have one Ability (shown in the Token Actions) to click for the roll to be made and then the attribute to be displayed. With my current lack of knowledge on applying artificial delays, the best I can do is two Token Actions (one to roll, one to display).
1535903774
The Aaron
Pro
API Scripter
That's a very creative solution, and I don't really have a better one for you.&nbsp; There are solutions with the API (Pro subscriber perk), and there may be some other clever ways of doing what you want without the API, but I can't think of any.&nbsp; You might try reading over the Stupid Tricks forum post.
1535907701
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The most pertinent Stupid Trick is here , but it's probably not the solution you are looking for. I don't have any better advice at the moment, but I'll give it some thought.
Hi guys, I´m having a problem with a macro for saving throws, i cant succesfully&nbsp;cal the attributes ?{Saving |STR,/r 1d20+@&amp;#123strength_save_bonus&amp;#125 |DEX,/r 1d20+@&amp;#123dexterity_save_bonus&amp;#125 |CON,/r 1d20+@&amp;#123constitution_save_bonus&amp;#125 |INT,/r 1d20+@&amp;#123intelligence_save_bonus&amp;#125 |WIS,/r 1d20+@&amp;#123wisdom_save_bonus&amp;#125 |CHA,/r 1d20+@&amp;#123charisma_save_bonus&amp;#125} The macro is correctly giving the dropdown menu, but once the roll is done, the modifier is not getting added to the roll
Diego S. said: Hi guys, I´m having a problem with a macro for saving throws, i cant succesfully&nbsp;cal the attributes ?{Saving |STR,/r 1d20+@&amp;#123strength_save_bonus&amp;#125 |DEX,/r 1d20+@&amp;#123dexterity_save_bonus&amp;#125 |CON,/r 1d20+@&amp;#123constitution_save_bonus&amp;#125 |INT,/r 1d20+@&amp;#123intelligence_save_bonus&amp;#125 |WIS,/r 1d20+@&amp;#123wisdom_save_bonus&amp;#125 |CHA,/r 1d20+@&amp;#123charisma_save_bonus&amp;#125} The macro is correctly giving the dropdown menu, but once the roll is done, the modifier is not getting added to the roll You don't need to HTML encode attribute calls. ?{Saving |STR,/r 1d20+@{strength_save_bonus} |DEX,/r 1d20+@{dexterity_save_bonus} |CON,/r 1d20+@{constitution_save_bonus} |INT,/r 1d20+@{intelligence_save_bonus} |WIS,/r 1d20+@{wisdom_save_bonus} |CHA,/r 1d20+@{charisma_save_bonus} }
1536006953
GiGs
Pro
Sheet Author
API Scripter
You don't need to HTML encode attribute calls. To be even more definitive: you absolutely must not &nbsp;html encode attribute calls. As you've found, it breaks the macros.&nbsp;
1536015767

Edited 1536015804
Thank´s guys!! everything is working now. Now, is there a way to put the result of the rolled die in a template. I would like to put the result of the rolled die in something like this(image down), and the idea is that the text change depending on the save you choose. Where should I put the template attributes (like name and roll) to get a similar result?? PD: As you can see, mi wisdom is not helping a lot hahahah.
1536016513
vÍnce
Pro
Sheet Author
The template you need depends on the sheet you are using. You'll also want to change the query to use inline rolls to work within a template. You always have access to roll20's default template.&nbsp; example &amp;{template:default}{{name=Ability Roll}}{{Check:=?{Saving |STR,Strength [[1d20+@{strength_save_bonus} ]] |DEX,Dexterity [[ 1d20+@{dexterity_save_bonus} ]] |CON,Constitution [[ 1d20+@{constitution_save_bonus} ]] |INT,Intelligence [[ 1d20+@{intelligence_save_bonus} ]] |WIS,Wisdom [[ 1d20+@{wisdom_save_bonus} ]] |CHA,Charisma [[ 1d20+@{charisma_save_bonus} ]] } }}