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

[Recursive Tables] Is there still no way to prevent duplicates?

1756216199

Edited 1756216580
Joel
Pro
1. If I roll multiple times in one command (ie !rt [[3t[Decoctions]]] to get 3 decoctions) I will often get duplicates. Is there still no way to prevent duplicate rolls when rolling multiple times on the same table from the same macro? I see discussion from years ago, but I'm not finding any solutions. 2. Very often when I use a macro for multiple separate rolls on the same table, say two separate rolls, I only get one result in chat.  !rt &{template:general} {{name=Daily Decoctions}} {{You create [[1d4]] total doses from these two formulas}} {{[[1t[Decoctions]]]}} {{[[1t[Decoctions]]]}} I think what is happening here is when the two [[1t[Decoctions]]] rolls are the same result, it is only displaying one of them and ignoring the duplicate. To test this theory, I made a table with only 2 items (Red, and Blue), and never do I get two of the same item displayed. It's always both items (Red and Blue), or its only Red or only Blue. So in a weird way this is preventing duplicates, but only preventing them from being displayed, not from being rolled.  I'd love to be able to roll twice (or more) on a d8 table and always get unique results without duplicates. Any tips, tricks, or commands that will help?
1756218363
timmaugh
Forum Champion
API Scripter
1. I do no think RecursiveTable has been updated in that way. Any rolling method that relies on R20 methods (like rollable tables) has the possibility of generating a duplicate. It would take a script solution to overcome that... and while RT *is* a script solution, it is set up to follow R20 conventions regarding uniquity. Going outside of those conventions would require tracking the returns from the rolls and comparing them to the tables... I don't want to speak for The Aaron, but I wouldn't be surprised if that would fall into the "scope creep" realm of updates. I have kicked around the idea of a custom metascript roll-generating syntax that could incorporate some syntax token to designate "unique" (among other enhancements), but haven't gotten around to building it. Also, there is an open suggestion for a rewrite/expansion of the roll syntax that you might throw a vote behind. 2. What is happening in that command is that you're using the template overwriting trick (sorry, don't have a link to the original discussion right at hand). It follows the logic that if you reuse the same referent name for a template part, you *overwrite* what came before. An example: &{template:default} {{name=Proof of Concept }} {{Actual Cannibal=Killing for sport }} {{Actual Cannibal=Eating all the bodies }} {{ Actual Cannibal= Shia LeBeouf}} Put that in chat and you'll get only the last line ("Actual Cannibal=Shia LeBeouf"). So while it does prevent duplication, it would still fall to you to have generated enough rolls to cover the correct number of returns you require. In a situation where you can roll 5x against the table but only unique values matter (so it is assumed you might lose as many as 4 of those returns), this would work. In a situation where you can roll 5x against the table and every return must be unique and if it isn't unique you should roll again... you'd have to generate some oversized set of returns wherein you feel confident you'd get at least 5 unique values, then *only* count the first 5 of them.
1756219371

Edited 1756219383
Joel
Pro
Thanks. I guess I'll keep playing with ideas for problem #1, maybe making a deck instead of a rollable table, idk, need to look into it.   #2 at least gave me the idea then to add the text "1st" and "2nd" to the rolls and now I can at least see the duplicates happened.