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

Name Generator Macro using Nested Queries

September 25 (5 years ago)

Using Nesting Queries ie?{Name of Query|

   Label 1, ?{value1|
      Label 1A, ?{value1A|
         Label 1Ai, value1Ai |
         Label 1Aii, value1Aii
      } |
      
      Label 1B, ?{value1B|
         Label 1Bi, value1Bi |
         Label 1Bii, value1Bii
      }
   } |

   Label 2, ?{value2|value2} 
}

I'm looking to make a macro to reference Rollable tables that i have set up to use roll names from Xanathar's Guide such as;


Race

    Dragonborn

        Male [[1t[Dragonborn-Male-Names]]][[1t[Dragonborn-Clan-Names]]]

        Female [[1t[Dragonborn-Female-Names]][[1t[Dragonborn-Clan-Names]]]

    Dwarf

        Male [[1t[Dwarf-Male-Names]]][[1t[Dwarf-Clan-Names]]]

        Female [[1t[Dwarf-Female-Names]][[1t[Dwarf-Clan-Names]]]

...so on so forth.


I had successfully used the template posted above to get the firsts selections to work but when I start adding more the whole thing just blows up and stops working. 


I don't quite know what I'm doing but if someone is willing to help out I would really appreciate it.

September 25 (5 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter

It looks to me like you have all the tools you need to get this working and the basics to use them so I won't patronise you.

I suspect you are over complicating it, which is the nature of the beast when nesting queries. Something like you are attempting only requires one level of nesting since you are only really asking two questions:

  1. Race
  2. Gender

The below should give you a working example of the two examples you've given (below that I've expanded it for readability):

?{Race|Dragonborn,?{Gender|Male,[[1t[Dragonborn-Male-Names]]]|Female,[[1t[Dragonborn-Female-Names]]}[[1t[Dragonborn-Clan-Names]]]|Dwarf,?{Gender|Male,[[1t[Dwarf-Male-Names]]]|Female,[[1t[Dwarf-Female-Names]]}[[1t[Dwarf-Clan-Names]]]}

?{Race|

Dragonborn,

?{Male,[[1t[Dragonborn-Male-Names]]]|

Female,[[1t[Dragonborn-Female-Names]]}[[1t[Dragonborn-Clan-Names]]]

|Dwarf,

?{Male,[[1t[Dwarf-Male-Names]]]|

Female,[[1t[Dwarf-Female-Names]]}[[1t[Dwarf-Clan-Names]]]

}

You'll notice that I only nested the forenames in the second query since the clan name was universally applied there is no need to repeat that. In this instance it wouldn't have caused a problem but I'm all about the efficiency.

You should be able to expand on the above example easily enough but if you have any issues shout out :)