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?

4 Comments
perchance@lemmy.world · 3 pts · 2y
The reason this doesn't work:
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:
So, at the start of your 'output' you 'execute' the
makeCharwhich creates thecharvariable for you based on a random choice between those twomakeCharitems.Hopefully that helps!
AssPennies@lemmy.world · 2 pts · 2y
Rule 2: Be kind and friendly.
You're putting me off on participating here, and I've been nothing but kind and friendly. And you?
AssPennies@lemmy.world · 1 pts · 2y
Try this:
Here you're creating a placeholder (aka variable) for the character you've selected so you can reference it later on. I also added
titleCaseso the character name gets capitalized.EDIT: The above does do random, but not unique. Here's a working example I wrote:
https://perchance.org/41mlspb7hk#edit
Code:
AssPennies@lemmy.world · 1 pts · 2y
It did both, but not unique. I added an edit with a more robust solution.