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 .
×
Advertisement Create a free account

Using Templates In a Drop-Down Result

1615699703
Hey community, I'm yet another macro user trying to do some complex stuff and was hoping to get some help. I've got a series of macros that do nested rolls for various loot tables, and I was hoping to create a new macro to just select which roll I want to do. The biggest issue is that I have formatting with my results, and I think I'm running into a bit of an issue trying to get it to correctly work with the formatting I have. This is an example of the kind of nested rolls I have: &{template:traits} {{name=Item Table Roll}} {{description= [[1t[Loot-Table[[1t[Uncommon-Skew]]]]]] }} I have tried doing a bit of HTML replacement, but I might be misunderstanding the issue with that since I haven't gotten it to work yet. I also have already seen the topics on turning the dropdown into buttons, but I prefer a dropdown method if it's possible, and was hoping that someone has already done this or knows a way I can do this.
1615748982
Andreas J.
Forum Champion
Sheet Author
Translator
Don't think you can call roll tables recursively, like your macro seems to attempt. there is an API for it, but that's for Pro users. Check here for how the dropdown thing could work: <a href="https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls#Drop-down_Queries" rel="nofollow">https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls#Drop-down_Queries</a> Something like this could work: &amp;{template:traits} {{name=Item Table Roll}} {{description= [[?{Choose table|Common,1t[Common]|Uncommon,1t[Uncommon-Skew]|Rare,1t[Rareloot]|2d100 gold,2d100}]] }}
1615756684
Thanks for the reply, and apologies for the lack of detail in my initial post. It was made in a bit of an annoyance fit before heading to bed after working on this issue. Let me take the roll formula I have and explain it out a bit more, since it actually does work. [[1t[Loot-Table[[1t[Rarity-Skew]]]]]] Rarity-Skew: This is a table that has entries for 1-5, weighted in different manners. Loot-Table(1-5): These are a series of tables that have magic items I'm offering on them, based on item rarity. The numbers 1-5 are on the end of the tables to represent the rarity.&nbsp; So, this is where my main issue comes in, which you thankfully half-solved for me, Andreas: Trying to get that formula into each entry in the drop-down. From the way I'm understanding it, my biggest issue is just getting the correct characters replaced with the HTML representations (based on this ), but I'm also not 100% certain or if I'm asking too much of the macros. Hopefully this explains my situation more, sorry if my first post was a bit vague.
1615759425
Andreas J.
Forum Champion
Sheet Author
Translator
If the nested things work, then it's should work with using queries somehow. Unless you're going to try having nested queries, you shouldnt need to use html replacment, as [[1t[Loot-Table[[1t[Rarity-Skew]]]]]] doesn't contain the problematic "}", "|", or "," characters. Show your macro attempts with the replacements included. Try first o either make the inner or outer table a dropdown, instead of trying to make everything be as you want in one go. This is a bit beyond me really, as I'm not even understanding your nested table. Is the final end result a single number, or is it an actual out put from a loot table. I'll leave this for others better at this, and keep to updating the documentation when I get things. The nested table things should be added to the docs.
1615762130
Well, you were right - no need for HTML replacements, and my issue was actually overcomplicating my formula while trying to put it into the dropdown template you gave me. To explain the final end result - It pulls an item from the Loot-Table that I "picked" from the Rarity-Skew table. For example: Rarity-Skew - 3 entries {"1", 30 weight | "2", 35 weight | "3", 35 weight} Loot-Table1 - 1 entry {"Common Magic Item"} Loot-Table2 - 1 entry {"Uncommon Magic Item"} Loot-Table3 - 1 entry {"Rare Magic Item"} So, the formula rolls 1t[Rarity-Skew], which gives me a number (we'll say 2). That's then tacked onto the end of Loot-Table, giving me 1t[Loot-Table2]. That then rolls and gives me an entry off the resulting table (in this case, "Uncommon Magic Item"). That, combined with the formatting, ends me up with this:&nbsp; So, now combining this with the template you gave me to simplify my life, I ended up with this monstrosity: &amp;{template:traits} {{name=Item Table Roll}} {{description= [[?{Choose table|Common,1t[Loot-Table1]|Uncommon,1t[Loot-Table[[1t[Uncommon-Skew]]]]|Rare,1t[Loot-Table[[1t[Rare-Skew]]]]|Very Rare,1t[Loot-Table[[1t[Very-Rare-Skew]]]]|Legendary,1t[Loot-Table[[1t[Legendary-Skew]]]]}]] }} I really hope this helps explain it a bit more, and again thank you for helping me simplify what I was attempting to do!
1615896213
Andreas J.
Forum Champion
Sheet Author
Translator
Yeah, now I get it. Rarity-Skew - 3 entries {"1", 30 weight | "2", 35 weight | "3", 35 weight} Loot-Table1 - 1 entry {"Common Magic Item"} Loot-Table2 - 1 entry {"Uncommon Magic Item"} Loot-Table3 - 1 entry {"Rare Magic Item"} I assume you meant to say the three loot tables have more than one entry. To the main Macro Guide page , I added link to this thread
1615909608
I assume you meant to say the three loot tables have more than one entry. It does in my session, I was mostly just mocking up an example. Thanks for adding it to the wiki!