I am trying to code a random encounter generator for a DnD campaign and am having a great deal of trouble. I don’t know how to code and have been trying to parse my syntax for three hours over what I thought would be a relatively simple task.

My goal is to have a list of [ruins], with nested subtables of encounters, characters, treasure, etc. Example would be that there is a ruin called “Ancient Archives”. The generator pulls that name, and then automatically pulls from an “encounter” list specifically tailored for “Ancient Archives”. And then also pulls from a friendlies/rivals list, treasure list, and “Complication list” that are tailored to Ancient Archives.

If the [ruins] selected was instead “Birthing Cyst”, the encounter, friendlies, and treasure sublist would be different, and tailored to “birthing cyst” instead of “Ancient Archives”

can anyone help me out with the way to format/syntax this??

  • wholeai@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    26 days ago

    Sub lists can be a pain. I’m sure there’s a better way to solve it this problem, but I think this gets the output your looking for. The aspirinPeople and ancientPeople work effectively the same, just to show the variation. If you called ancientPeople without selectOne it iterates through the list.

    output [r = ruin.selectOne]

    ruin [Ancient] [Aspiring]

    Ancient Ancient graves portected by [ancientPeople.selectOne] Aspiring You come across an aspiring [aspiringPeople] ancientPeople mad dog sad jim

    aspiringPeople ninja turtlegreedy cleric