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

Links:

  • 37 Posts
  • 156 Comments
Joined 3 months ago
cake
Cake day: March 24th, 2024

help-circle


  • While the event is starting, I want to mention some more thoughts I’ve been keeping earlier after hosting the event midnight, about some planned updates for the Events page in the future (and probably going to implement them in the next Preview updates right away):

    • Some of the big events (like image contests and big moment updates like “A Venture for the Big Update”) will be integrated into the Hub for greater visibility (so the event will also be shown as a Hub event in the Events tab), but some smaller events (like break times or Silent Days) will only be exclusively shown on the Generator Manager Events page
    • The description will also use Markdown since I feel that wasn’t well-polished enough and would sometimes break out when writing down for the first event
    • Probably also planning for an entire UI overhaul/rearrangement for the event page as well
    • Also planning to implement an events flyout somewhere in the sidebar or the Home page (similar to the Events flyout in the Hub)
    • etc, etc…

    (Will write down more once they start to pour in)



  • You can prevent the output from accidentally evaluating the selectOne of empty n arrays by just not evaluating the <span contenteditable ... part when that empty array has no length (basically you put a condition in which if n isn’t empty then evaluate the span word element, which eliminates that syntax error problem):

    You can also check for n.length > 0 instead of n.length. Also pretty cool generator concept! A random letter generator button might be a good idea. Here’s how would you implement this using a list and a button:

    letter
      ["{A-Z}".selectMany(Math.floor(Math.random()*4)+1)]
    
    <input id="acronymInput" oninput="acronym = this.value" placeholder="type an acronym :)" value="TPK" />
    <button onclick="ltr = letter.evaluateItem, acronymInput.value = ltr, acronym = ltr, count = -1, update()">random letter</button>
    







  • <br>Death Chance: <select oninput="aListName.Death_Chance = this.value">
      <option value="Moral Blow">Moral Blow</option>
      <option value="Tragedy">Tragedy</option>
      <option value="Destruction">Destruction</option>
      <option value="Devastation">Devastation</option>
      <option value="Calamaty">Calamaty</option>
      <option value="Plague">Plague</option>
      <option value="Eradication">Eradiction</option>
      <option value="Extinction">Extinction (WARNING: DON'T) </option>
    </select>
    <p id="out1">[warningList]</p>
    <button onclick="update(out1)">Show</button>
    <br>Illness type: <select oninput="aListName.Illness_type = this.value">
      <option value="Whitecough">Whitecough</option>
      <option value="Carrionplace Disease">Carrionplace Disease</option>
      <option value="Tainted prey">Tainted prey</option>
    </select>
    

    Here is a modified code for the dropdown menus so that they assign the values to the variables properly (since Death_Chance and Illness_type are apparently stored into some sort of parent list, so you can rename aListName to the name of that list). Also, if the dropdown menu doesn’t work, try changing oninput to onchange.

    You’ll also need to associate the variables written in dynamic odd notations in lists to reference the parent list as well (e.g., [Death_Chance == "Moral Blow"] to [aListName.Death_Chance == "Moral Blow"]).


  • Okay, so first you add the quotes between these curly brackets wrapped syntaxes (and remove the quotes around the none part) so they’ll be evaluated properly:

    And then change the rarity picking mechanism (evaluateItem first, create a matchable version, and then display the evaluated version instead of just selectOne and then display) so it’ll be matched properly when picking a gimmick and an ability, to this:

    [ra1 = rarity.evaluateItem, ra = ra1.match(/[A-Z]+/g)[0], ra1]













  • If what you mean is changing the background color around the fields, I think there isn’t any support yet, but you still can do that, through a simple hacky solution:

    description
      ...
      width = min(750px, 100%); background: #cd3838 // this is where the ; will be inserted
    
    negative
      ...
      width = ; background: #cd3838
    

    Essentially you could insert any CSS after the width value (or just use width = ; <css> without specifying the width as well), just omit the ; at the end because the t2i framework will append that after the value.

    Though, this way, upon testing on the regular AI image generator, it only works on the description and the negative prompt fields. But there’s another way, using some scripts. First, define a function in the list:

    setupColors() =>
      // some magic that make all of that work
      for (let el of [...document.querySelectorAll(".input-inner")]) {
        inputChild = el.querySelector(".input-wrapper *");
        inputName = inputChild.dataset.name;
        if (Object.keys(colors).includes(inputName)) {
          el.style.backgroundColor = colors[inputName];
        }
      }
    

    And then put this at the bottom of the HTML panel:

    <script>
      // Here you can define the colors of the fields that you can associate with the respective userInputs list names on the left
      let colors = {
    
        "artStyle": "#8b574d",
        "numImages": "#014765"
        // add more input names here if you want to
    
      }
    </script>[setupColors(), ""]