Hello everyone! A few years ago I got some help with a randomizer of mine and it made it into a wonderful little tool to play around with. Link to it here!

I’ve since expanded upon it, and come into a small problem with the more I add to it: unique outputs.

There are, in total, 4 outputs I’m concerned with the most (the types). Is there any way to make it so that the code keeps track of all 4 outputs and insures they are all unique?

I’ve looked over the documentation and I think it’s a touch out of my current skillset. Thank you to anyone who takes the time to help out!

  • VioneTM
    link
    English
    2
    edit-2
    11 days ago

    @[email protected]’s Solution works wonderfully.

    Here is another way using the exclude-items-plugin:

    exclude = {import:exclude-items-plugin}
    
    sentence
      [takenTypes = [], ''] You find yourself in {a} [d=description.selectOne] [b=biome.selectOne].<br> As the area is [d.singularForm.lowerCase], [td = typesdescription.selectOne.evaluateItem, takenTypes.push(td), td] type 'mons are rather prolific. That is in addition to the [typesbiome = exclude(others[b], takenTypes).selectUnique(2).map(a => (takenTypes.push(a), a)).joinItems(" and ")] types that live in the [b] already. <br>Oddly enough, there also seem to be some [s=exclude(stragglers, takenTypes).selectOne, takenTypes.push(s), s] type 'mons in the area as well. <br><br> Pokemon Types: [td] ([d]), [typesbiome] ([b]), [s] (stragglers)
    

    The td = typesdescription.selectOne.evaluateItem makes sure that you have the Type instead of the description stored on the takenTypes list. If you don’t want to add the evaluateItem you could remove the dynamic odds using the d and use td = typesdescription[d].selectOne to select only the type. We push the selected types on the takenTypes list and use it to exclude the already selected types on the next selection with the exclude-items-plugin.