Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)PE
Posts
26
Comments
452
Joined
2 yr. ago

  • Oh, maybe you mean that you want to allow users to write ANIMAL = {import:my-animal-list} directly in their scratchpad (without it being pre-imported by your generator's code)? If so you could maybe use regex to replace ANIMAL = {import:my-animal-list} with something like ANIMAL = [dynamicImport("my-animal-list")], assuming you have imported https://perchance.org/dynamic-import-plugin already. You may want to check that the parseVariables code in the t2i framework will be adjusted to support that, if it doesn't already. I think it should already support it, so only the regex transformation should be required (though I could be wrong).

  • Sorry I should have been more clear that the [ANIMAL=lists.animal, COLOR=lists.color, ""] should go in the HTML of the generator that you want to use the lists in, not in the furchancetxt generator. When you import a generator like furchancetxt, only the lists are imported - the HTML of furchancetxt will be completely ignored.

    And regarding the "cannot find generator" but it somehow works for noun gemeratpr: I think that's because you're importing noun already (possibly indirectly - i.e. importing a generator that imports noun)? The {import:furchancetxt} would only work if you have already imported it somewhere else. So you should either pre-import the things you want to use "dynamically", or use dynamic imports if there are too many things to pre-import (that may not be used very often):

    Also, I'm not sure if list = {import:furchancetxt} will work at all in scratchpad. IIRC it only parses all-caps variables, but maybe you have changed that part, idk.

    I think the TL;DR here is that you'll want to just put list = {import:furchancetxt} in your ai-furry-generator on a new line in the perchance lists editor, and then put [ANIMAL=lists.animal, COLOR=lists.color, ""] at the top of the the HTML editor of ai-furry-generator. Then you can use [ANIMAL] and [COLOR] in the scratchpad.

  • So if you have perchance.org/my-lists like this:

     
        
    $output
      animal
        mouse
        chicken
        frog
      color
        red
        green
        blue
    
    
      

    then in the other generator you have:

     
        
    lists = {import:my-lists}
    
    
      

    then you can write [lists.animal] and [lists.color] to access them. If you want them to be available as [ANIMAL] and [COLOR]¹, then you could put this at the top of your HTML panel:

     
        
    [ANIMAL=lists.animal, COLOR=lists.color, ""]
    
    
      

    You need to make sure that line is above any code that tries to use [ANIMAL] and [COLOR], since the square blocks in the HTML editor are executed in top-to-bottom (and left-to-right for square blocks on the same line) order.

    Let me know if I still misunderstand.


    ¹ Since IIRC, the t2i-framework-plugin-v2 requires use of all-caps variable names? That was mainly to avoid collision with built-in browser global variables (again, IIRC)

  • Can you share a minimal example of what you're trying to achieve?

    How do we custom a more complicated list gen like I can do in scratchpad and import it directly in prompt textarea

    To try to answer this question directly, if you have a generator like this called perchance.org/my-animal-list:

     
        
    $output
      mouse
      chicken
      frog
    
      

    then you should just be able to write:

     
        
    ANIMAL = {import:my-animal-list}
    
      

    in your generator that you want to 'use' that animal list in. And then just write [ANIMAL] wherever you want to use it.

    You can get a lot more complex than that, but that's the general gist of it. Let me know if there's a specific part you're struggling with or if I misunderstood.

  • Yep, it's intentional - it's actually motivated by a privacy consideration. Without removing the username for automated/bot submissions, it could leak that a person with username "foo" has visited generator "bar" via automated comment submission when they visit the page. Ideally that sort of "automated unmasking" of users should not be possible, and this design decision preserves that.

    Automated comment submission is of course possible, but the (~IP based) user tag is different for each generator, so they stay anonymous unless they specifically choose to comment with their username.

  • If you write:

     
        
    HUE1 = {CHARCOAL GREY|WHITE|CRIMSON|EMERALD}
    
      

    on a new line in the perchance code editor, then you should be able to use [HUE1] in your description box. If that doesn't work then there may be a bug somewhere, either in your code, or t2i framework, assuming you're using that. I just tested it and it seems to work fine for me though.

  • Yeah the second/third/etc. errors in the list can unfortunately be misleading - trick is to always solve the top one first since it's likely the root cause of all the others:

    An error has occurred near line number 203: There's a problem with the syntax of this expression: '[if (r.species != "dragonborn") {1} else {0}]'. Here's the message that was returned when execution failed: Cannot read properties of undefined (reading 'species').

    This is a poorly worded error message (directly from the browser's JS engine) which basically means "I tried to look at the 'species' property of r but r was undefined". It's because you define r after fh instead of before. So when it tries to calculate the odds, which depends on r being defined, it breaks.

    So to fix it you can change this:

     js
        
    fh=face_hue.selectOne.evaluateItem, ..., r=ancestry.selectOne
    
    
      

    to this:

     js
        
    r=ancestry.selectOne, fh=face_hue.selectOne.evaluateItem, ...
    
      
  • Have you been able to replicate the issue yourself, or notice any patterns in user reports you get? E.g. specific browsers or countries being affected, or the issue co-occuring with some other weird behavior?

  • Can you share a minimal example of what you've tried?

    I think you might be running into the issue where you need to wrap your object in parentheses, like this? foo = [({abc:123})] See the meta:tags lines in https://perchance.org/t2i-styles#edit for an example.

    You only need to do that if you're creating an object within square brackets without assigning it to a variable within those brackets. E.g. you can just write [foo={abc:123}] since the equals sign forces the JavaScript engine to interpret it as an object.

    The reason for this weirdness is technical - related to how JavaScript engines evaluate stuff. Basically, {abc:123} on its own (without parentheses or variable assignment) is interpreted as a block scope with a label.

  • Perchance - Create a Random Text Generator @lemmy.world
    dev

    New text model is still quite bad sorry - working on it

  • The user has same tag on mobile and desktop, one is banned, one is not.

    The system is simply detecting that their mobile device was previously using a tag that you banned. You should unban that other tag, and then their mobile device will not be banned anymore.

    The system works this way because otherwise people can evade bans by switching IP addresses, which is bad.

  • @RudBo@RudBo@lemmy.world Should be fixed now - thank you for providing the example URLs! Seems like Cloudflare added a buggy rule to their firewall.

    CC @Ruud@ruud@lemmy.world Heads up that currently Lemmy comments can't be edited, and I think it's might be caused by the same issue [Security > Security rules > Managed rules > Cloudflare Managed Ruleset] though I'm unsure which specific rule - I couldn't find an ordered-by-date-added list.

  • Sorry about this - some sort of strange Cloudflare issue. I think it's related to the reason comments on Lemmy (which also uses Cloudflare) can't be edited right now - same 403 Cloudflare response. Will comment here again when I've fixed it

  • And yeah I'm getting the 403 whenever I try to edit a Lemmy comment right now. Seems to be a temporary Cloudflare issue. Unsure if it's related to the Perchance save issue - looking into that now.

  • Perchance - Create a Random Text Generator @lemmy.world

    New feature: Collaborate with others on your generator (realtime/live shared editing)

    Perchance - Create a Random Text Generator @lemmy.world

    Why do we still not have better image generation?

    Perchance - Create a Random Text Generator @lemmy.world

    Helping perchance as an experienced dev

    Perchance - Create a Random Text Generator @lemmy.world

    Using $meta, you can now ~hide the header bar, and change its color/background, and add tags to your generator

    Perchance - Create a Random Text Generator @lemmy.world

    signup issues should be fixed now - let me know if you still aren't getting verification email

    Perchance - Create a Random Text Generator @lemmy.world

    The favicon-plugin allows you to change the browser tab icon from the default perchance dice logo to a custom image (even live-updated/animated, or using outputs of text-to-image plugin, etc)

    Perchance - Create a Random Text Generator @lemmy.world

    The dynamic import plugin now recursively imports dependencies, so now it's just like a normal ('static') import. This unlocks a handy use case:

    Perchance - Create a Random Text Generator @lemmy.world

    Browsers may eventually get built-in AI models (see linked article for Chrome's prototypes), meaning it may be possible to have a version of the /ai-text-plugin that doesn't need ads to fund it

    Perchance - Create a Random Text Generator @lemmy.world

    color:light-dark(blue,lightblue) is now available in all modern browsers - switch text/background/etc. colors automatically depending on whether the user's device is in light mode or dark mode

    Perchance - Create a Random Text Generator @lemmy.world

    Seventh Sanctum Data Archives

    Perchance - Create a Random Text Generator @lemmy.world

    If you've used evaluateItem on strings (rather than lists or list items), then please read this. This is likely only relevant if you're doing fancy JavaScript stuff in your generator.

    Perchance - Create a Random Text Generator @lemmy.world

    A cute way to remember text inputs (without the remember-plugin)

    Perchance - Create a Random Text Generator @lemmy.world

    AI bots in your comments, and more: c = commentsPlugin(options), c.submit("hello world!")

    Perchance - Create a Random Text Generator @lemmy.world

    How to create an MMORPG with the comments plugin as your database (using the new onComment feature)

    Perchance - Create a Random Text Generator @lemmy.world

    Tip: If your title and/or $meta.description doesn't include the specific keywords/terms that people are likely to type in a web search, then it makes it much harder for people to find your generator

    Perchance - Create a Random Text Generator @lemmy.world

    Text to Image Plugin Gallery Moderation Example

    Perchance - Create a Random Text Generator @lemmy.world

    Public service announcement: You can now use the 'reload' button without having to save the generator first (amazing and groundbreaking)

    Perchance - Create a Random Text Generator @lemmy.world

    Upload Plugin

    Perchance - Create a Random Text Generator @lemmy.world

    AI Hierarchical World Generator (kinda like the nested-plugin)