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

Atomatically roll a table based on a previous tables result

I want to roll a table that gives me a result and then automatically rolls another table based on the previous tables result. Is that possible?
1748623652
timmaugh
Forum Champion
API Scripter
To do that in the same message would require a script... which means that the game owner would have to be a Pro subscriber. If scripts are available, then  RecursiveTables can do it, as can the MetascriptToolbox. Are scripts available?
1748623844

Edited 1748624086
Yes. Scripts are available. I just finished makings some tables and I recently learned how to make multiple table rolls at the same time, but I haven't figured out how to roll a table based off another tables result. I also have  RecursiveTables and MetascriptToolbox.
1748654410
timmaugh
Forum Champion
API Scripter
Good! So, RT is especially good at looking at the result from a rollable table and, if that result includes another inline roll, expanding that roll as a part of the returned information. This is something that the Toolbox can do, too, though with different syntax and generally different goals. Alternatively, if what you're looking to do is take the result from one table and use it as part of another roll (for instance, rolling against a table of "what level of bad guy" walks through a door to generate an encounter, and then using the returned value as the name of another rollable table -- ie, the table of "GruntsLackingHygiene" or the table of "GruntsWithHygiene" or the table of "BigThingsWithClubs" -- on which to roll), then you're going to want the Toolbox. Note that if the result is at all preprogrammed (ie, this result means make this roll and this roll) then RT is a convenient, all-in-one solution, and while the Toolbox can do similar things it might just be easier to use RT for the entire process. Where the Toolbox really becomes necessary is if the result CANNOT be preprogrammed... that is, maybe the secondary roll can't be pre-scripted because it requires retrieving information from the selected character which would be different for this character compared to some other. One potential way that could look (with the Toolbox) is assigning the first roll to a global variable: {&global ([FirstRoll] [[1t[WhatLevelBadGuy] ]].value)} ...then recalling/reusing that variable in a deferred roll, somewhere else: {&r}1t[FirstRoll]{&/r} As an example, I have a table in my game called "TableOfTables." It has an entry with the text "MaleNames" and another entry with the text "FemaleNames." Both of those text entries correspond to other tables in my game (a table of male names, and a table of female names). To generate a random name from a random source table, I would use the above form and do: !{&global ([FirstRoll] [[1t[TableOfTables] ]].value)}{&r}1t[FirstRoll]{&/r}{&simple} Can you give an example of the situation you're trying to handle, and maybe a sample of the data in your tables?
Thank you! Yes. So what I'm trying to do is to randomly determine factions actions and what they want. I have one table that has the 5 major faction groups in them. From there I made 5 other tables that has the specific names of each group (each of these tables ranges from 3-8 entries.) I then have a table for each specific factions individual goals (15 tables of 5 entries.) Ideally I would like to add an attribute to my gm helper character that asks them to roll faction group>determine individual faction>determine their motive/goal/quest all in one click.
1748706672

Edited 1748706713
timmaugh
Forum Champion
API Scripter
OK... I *think* I understand what you have. At least, I hope what I've mocked up, here, gets you close enough that if I'm wrong you can bridge the gap to get your version across the finish line. This solution will require the MetascriptToolbox. ( Also, I used my TableToTable script to set up my tables quickly; you probably already have your tables setup, I'm just mentioning this as an explanation of what you'll see in the next few screenshots.) Here is my setup... I created a table called "Factions", and made entries like this: Then, for each of those Factions, I created a table named as the name of the faction followed by the word "Groups". So I had "ActualCannibalsGroups", "FollowersOfTheGourdGroups", and "FollowersOfTheShoeGroups". Then I created 2 entries in each of those tables to represent each faction having 2 groups: (don't worry that the interface says "Replace: ..." ... it's just the TableToTable interface letting me know that if I change any of those entries it will overwrite the existing entry) Then, for each of those Faction-groups, I created a table for their "Goals". The name of each table was the name of the group + "Goals" (ie, "ActualCannibalsGroup1Goals"). In each of these tables, I created 2 entries to represent their potential goals. Whew. But... important that you understand my setup in case my setup isn't like yours and you need to tweak the syntax of the command line to fit what you have. In any case, now I can run this command: !/w gm &{template:default} {&global ([FactionGlobVar] [[ 1t[Factions] ]].value)} {\&global ([GroupGlobVar] [\[\ 1t[FactionGlobVarGroups] \]\].value)} {\\&global ([GoalGlobVar] [\\[\\ 1t[GroupGlobVarGoals] \\]\\].value)} {{name=Faction Report}} {{Faction=FactionGlobVar}} {{Group=GroupGlobVar}} {{Goal=GoalGlobVar}} {&simple} ...and get a valid report. Here are two reports I ran just as examples: If you want a (potentially) easier way to parse the syntax of that command line, here it is rewritten to use ZeroFrame's batching capabilities: !{{   {&global ([FactionGlobVar] [[ 1t[Factions] ]].value)}   {\&global ([GroupGlobVar] [\[\ 1t[FactionGlobVarGroups] \]\].value)}   {\\&global ([GoalGlobVar] [\\[\\ 1t[GroupGlobVarGoals] \\]\\].value)}   (^)/w gm {^&template:default}  ({)name=Faction Report(}) ({)Faction=FactionGlobVar(}) ({)Group=GroupGlobVar(}) ({)Goal=GoalGlobVar(}) }}
Thank you so much for all the help. I have my factions tables rolling as intended. Now I'm just creating some menus for them. I truly appreciate your help.