BluePower

I make generators on Perchance.org and do a bunch of other cool things.

Links:

  • 105 Posts
  • 357 Comments
Joined 10 months ago
cake
Cake day: March 24th, 2024

help-circle












  • Here’s my solution so far - create a variable that’ll hold the generated types in and then change the code of the sentence list to never use any of these already-generated types:

    // Create a new "takenTypes" array variable to store the already generated types
    takenTypes = [[]]
    
    sentence
      [takenTypes = [], ""]You find yourself in {a} [d=description.selectOne] [b=biome.selectOne].<br> As the area is [d.singularForm.lowerCase], [td = typesdescription.selectOne, uniqueReturn(td)] type 'mons are rather prolific. That is in addition to the [removeDups(others[b]).selectUnique(2).map(x => uniqueReturn(x)).join(" and ")] types that live in the [b] already. <br>Oddly enough, there also seem to be some [s=removeDups(stragglers).selectOne, uniqueReturn(s)] type 'mons in the area as well.
    
    // Returns a new list that does not contain the entries already shown in the output
    removeDups(list) => return list.selectAll.filter(x => !takenTypes.includes(x));
    // Adds the entry into the "takenTypes" variable so they never show up again in the same output
    uniqueReturn(i) => takenTypes.push(i); return i;
    








  • Turns out this also happens in one of my oldest generators, Power Hangman, and not just in the Generator Manager. Someone in the comments of that page reported this quite recently, so I just fixed that generator to use the var i solution instead of let i. I should probably create a post on the Perchance community about this so everyone can have a catch.

    In short, multiple let declarations on the script tag in the HTML would now cause an error in the generator. I haven’t encountered these errors before, so if you happen to experience that same error as well, let me know!