Doing Perchance.org things…

Links

  • 9 Posts
  • 82 Comments
Joined 1 year ago
cake
Cake day: June 21st, 2023

help-circle





  • Hello, you can check the changes here: https://perchance.org/vgs5qtexr3

    First, you don’t need to have multiple layers per color. You can just have one layer, on the generator its called base, then under it, is the images per color, then you can use Perchance’s dynamic odds to select the correct image.

    output
      [x = base.evaluateItem] [imageLayerCombiner(data)] ^[clicked == "lion"] // selects the base, then uses it for the selections.
    
    data
      ...
      layers
        ...
        base // base layer
          filter = [baseFilters.evaluateItem]
          https://i.imgur.com/B6nOqdc.png^[x == 'blank'] //blank
          https://i.imgur.com/4sFFKFS.png^[x == 'brownpinkBase']
          https://i.imgur.com/xxCVLzl.png^[x == 'redBase']
          https://i.imgur.com/IstBWcB.png^[x == 'blueBase']
          https://i.imgur.com/JIPN8jR.png^[x == 'lavendarBase']
          https://i.imgur.com/ZFlZfFp.png^[x == 'gingerBase']
          https://i.imgur.com/fpAEPbi.png^[x == 'goldBase']
    ...
    base // a separate list to select the base.
      blank
      redBase
      blueBase
      brownpinkBase
      lavendarBase
      gingerBase
      goldBase
    
    baseFilters // List of filter per base, selected with the dynamic odds.
      hue-rotate({0-40}deg) saturate({0-100}%) brightness({50-150}%)^[x == 'brownpinkBase']
      hue-rotate({0-10}deg) saturate({50-120}%) brightness({50-150}%)^[x == 'redBase']
      hue-rotate({0-35}deg) saturate({50-120}%) brightness({50-130}%)^[x == 'blueBase']
      hue-rotate({0-50}deg) saturate({50-120}%) brightness({50-130}%)^[x == 'lavendarBase']
      hue-rotate({0-20}deg) saturate({50-100}%) brightness({50-100}%)^[x == 'gingerBase']
      hue-rotate({0-10}deg) saturate({50-120}%) brightness({50-110}%)^[x == 'goldBase']
    










  • Here’s a code that might be what you want:

    const backgroundUrls = {
      'beach': 'https://user-uploads.perchance.org/file/a4c99b37a4d466b9a3fac8c9864d92b7.webp',
      'cottages': 'https://user-uploads.perchance.org/file/13a5f82ae06233afcd35df95c5ffe806.webp',
      // Add more background keywords and URLs as needed
    };
    
    const avatarUrls = {
      'ramon': 'https://user-uploads.perchance.org/file/c986b9d02086c6cf9833761199d2fc52.webp',
      'kylie': 'https://user-uploads.perchance.org/file/a6ba77a96dfd17a50101eba227435c07.webp',
      // Add more avatar keywords as needed
    };
    
    oc.thread.on("MessageAdded", function({message}) {
      if (message.author == 'user') { // you can change which reply can trigger the code, currently it is the user triggering the code
        let words = message.content.split(/[\s+']/gm).map(a => a.toLowerCase()) // just separates the text into words
        let foundBG = Object.keys(backgroundUrls).find((a) => words.includes(a)); // finds the keyword that is found on the message
        let foundAVATAR = Object.keys(avatarUrls).find((a) => words.includes(a));
        if (foundBG) oc.thread.messages.at(-1).scene = { 'background': {'url': backgroundUrls[foundBG]} }; // if a background keyword is found, change the bg
        if (foundAVATAR) oc.character.avatar.url = avatarUrls[foundAVATAR]; // if an avatar keyword is found, change the avatar
        message.expectsReply = false; // this just tells the AI not to reply to the user's message (remove if you need the AI to reply)
      }
    });
    

    Images are from my unfinished VN: a-trip-to-the-beach :)