So, I don’t know how to explain this well, but I have this generator that has a “char = {[contestant.consumableList]|[host.consumableList]}” thingimajig, and my goal is to get it to have the output have no duplicates of either an item from the contestant list or from the host list, but I’m still getting duplicates anyways. How do I do this correctly?

  • perchance@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    11 months ago

    The reason this doesn’t work:

    char = {[contestant.consumableList]|[host.consumableList]}
    

    Is because you’re essentially defining a “list” where [contestant.consumableList] or [host.consumableList] will be randomly chosen every time you write [char]. So, to be clear, you’re basically creating a fresh consumable list every time you write [char].

    This is unfortunately a bit confusing for newbies - it’s a common misunderstanding.

    What you probably want is something like this:

    output
      [makeChar] ..........
    
    makeChar
      [char = contestant.consumableList, ""]
      [char = host.consumableList, ""]
    

    So, at the start of your ‘output’ you ‘execute’ the makeChar which creates the char variable for you based on a random choice between those two makeChar items.

    Hopefully that helps!