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

Rolling Multiple tables to a Single Template

1763603154

Edited 1763605440
I would like to roll a Random NPC and get it to display in the default template The first question will be names which there are several tables to chose from (names).  The second is a single table (behavior & traits) and the third is a single table (Appearance Features). Here is the code I have so far !rt /w gm&{template:default}{{name=Random NPC Name Generator}}{{The NPC is =[[ 1t[?{Which table|Names-Common|Names-Magical|Names-Cute|Names-Outlaw|Names-Heroic|Names-Ferocious|Names-Heart-Throb|Names-Comedic|Names-Ancient}] ]] }} I don't know where to put the other table names in the sequence Behavior-and-Traits Appearance-Features I would like it to display in the template:defualt The NPC is (Which Table - Names...) The NPC Behavior is ( Behavior-and-Traits) The NPC Appearance ( Appearance-Features) Do I need to make a macro for each table?   I don't know where the script ends and where I can add the other two tables.    
1763605572

Edited 1763733555
timmaugh
Forum Champion
API Scripter
No, you don't have to do a different template for each. The default template takes as many "{{this=that}}" template parts as you want. If you duplicate a template part (that is, you use the same "this" for a "this=that" and a "this=something else"), then the later one will overwrite the earlier ones. Also, RecursiveTable is only necessary if you need to keep expanding rolls from tables (if your return would, itself, have a roll that required further rolling). If you don't have that situation you don't need to use a script to do this. Here is a version with no script: /w gm &{template:default} {{name=Random NPC Name Generator}}{{The NPC is =[[ 1t[?{Which table|Names-Common|Names-Magical|Names-Cute|Names-Outlaw|Names-Heroic|Names-Ferocious|Names-Heart-Throb|Names-Comedic|Names-Ancient}] ]]}} {{ The NPC Behavior is =[[1t[ Behavior-and-Traits]]] }} {{ The NPC Appearance is =[[1t[ Appearance-Features]]] }} If you *do* actually need the power of RecursiveTable, just slap the "!rt " on the beginning of that command.
This is the output in the chat 
This script worked  !rt /w gm&{template:default}{{name=Random NPC Behavior Generator}}{{The NPC is =[[ 1t[?{Which table|Names-Common|Names-Magical|Names-Cute|Names-Outlaw|Names-Heroic|Names-Ferocious|Names-Heart-Throb|Names-Comedic|Names-Ancient}]]]}}{{Behavior is=[[1t[Behavior-and-Traits]]]}}{{Appearance is=[[1t[Appearance-Features]]]}}
1763733532
timmaugh
Forum Champion
API Scripter
Hmm. Glad you got it working. I had an extra parentheses in the Appearance table reference that I think was doinking with the output. I removed it and tested my command and it worked. I'll edit the above command line in case people return to this thread, later.