Skip Navigation
Getting longer messages... how?
  • Hmm yeah the AI sometimes just follows the pattern of messages that came beforehand instead of following instructions properly. Can you try this: Instead of having the character name as Bob:, set it to Bob (long response): or something. It might work as a hack until I get around to writing a better prompt for message length. Let me know if that worked, since it'll be useful to know when prompt engineering. Also, if you can share any chats (here or via DM) where the AI was "stuck" making short messages (i.e. ignoring length instructions), that would be useful to help me implement a "message length" setting/option, but no worries if not.

    Edit: I've added a checkbox for longer messages. Under the hood it basically uses the above approach but hides the (long response) text from view. Let me know if you still have issues.

  • [Bug Report] Comments plugin does not validate password hash when posting a comment
  • It is not reproducible consistently though

    Please link to an example comment where you have replicated this, even just once (i.e. commenting using a username that you don't own). My guess is that when you refresh the page, you'll see that it didn't actually submit the comment under the username - i.e. you "tricked yourself", but didn't trick other users. But if I'm wrong here, then I'd definitely like to know about it! Either way, thanks for your report & concern.

  • [Bug] Upon running the `update()` function, the comments plugin's programmatic interaction features stopped working
  • @BluePower@sh.itjust.works @VioneT@lemmy.world This is a good point. Currently you'd need to write [com ? "" : com = commentsPlugin(options)] so it doesn't reassign the variable when you execute update(). It's not ideal, but for now at least I've added a note about it to the programmatic example generator:

    // NOTE: If you are calling `update()` in your generator, then due to the fact that comments plugin embeds
    // aren't updated like normal content (unless you set the replacedDuringUpdate=true option), you should
    // write [com ? "" : com = commentsPlugin(options)] instead of just [com = commentsPlugin(options)]
    // so it doesn’t reassign the variable when you execute update()
    // The square block [com ? "" : com = commentsPlugin(options)] means:
    //   Does `com` "exist" yet? If so, output "" (i.e. nothing), otherwise set `com` to `commentsPlugin(options)` and output it.
    // So it only "creates" `com` during the first update - i.e. during page load - and from then on it just outputs nothing, since the comments embed has already been created.
    
  • [Solved] Problems with saving and loading generators on Perchance
  • Sorry for the delay on this (and many other posts by you and others!). This is a super annoying bug - it's really important to me that Perchance is snappy, so I'm committed to solving this. I think I'm starting to get an idea of what's happening here.

    For some reason the server isn't properly closing the connection, or Cloudflare has a bug with HTTP/3 which means it sometimes doesn't recognize when the connection has been closed, and this causes the browser to think that the content download is still in progress, even though it finished long ago. And that causes a stall while it waits. But it's strange because I thought with HTTP/2 and HTTP/3 the browser could "multiplex" downloads over a single connection so I'm not sure why one download is stalling the others.

    I've disabled HTTP/3 for now to test if this was the issue. Can you let me know if it happens for you again? Also pinging @VioneT@lemmy.world in case you've run into this problem too. If this doesn't work, then I suspect it has to do with the server getting a bit overloaded, and not ending connections properly (though this still wouldn't explain the apparent lack of multiplexing, which I'll have to investigate - maybe there's still a concurrency limit and it's being hit somehow), and in that case maybe it's time for me to do a big server upgrade - in that case it'll probably take me a week or two of work but it'll be worth it.

  • AI text loading
  • Thank you!! You've helped me find and fix a bug - potentially helping a lot of other people with similar issues. Should be all good now (refresh page a couple of times to clear cache if needed) but let me know if you run into any other problems.

  • AI text loading
  • Hmm, can you refresh the page and try again now? I've just made some changes which may or may not have fixed this.

    Edit: Ah just a sec I think I made it worse.

    Edit2: Okay I've appiled a temporary fix until I get to the root of the original problem. Should be working fine again now.

  • AI text loading
  • Thanks for your patience here. In this image: https://lemmy.world/pictrs/image/b83164c5-d0dd-4539-8d95-9e69fb56ab5f.png I need to see what the rest of the error says at the bottom where it says "Invalid or unexpected token (at..." if you can widen the page and screenshot that would be useful.

    In addition to that, can you try clicking the blue "VM1225 about:srcdoc" link thing to the right of that message? When you click it, it should ideally switch to a different panel that shows the code which is the source of the error. If you can screenshot that, that might be all I need to solve this.

    Also, you're using Chrome, right? Or is it Edge/Brave, or something else?

  • [BUG] [PLZ HELP] I keep pushing save when the gen has errors. It gets stuck with errors.
  • Sorry! This should be solved now - it was an engine bug that didn't handle errors correctly for code like update("A6_D") - in this case you actually meant to write update(A6_D) I think? But either way it should have shown an error message instead of just stopping the whole page from loading. That should be fixed now - thanks for reporting.

  • AI Character chat stopped working entirely
  • Sorry about this, and thanks for your patience in helping debug it. Can you try disabling summaries in the character editor? Click the "more settings" button at the bottom and scroll down. Change the summary option from "summarize old messages" to "ignore old messages".

    all my chats stopped working [...] Other chats that i open in Opera GX or Chrome on my laptop work fine

    You mean the other chats on a different computer work, right? And I assume that it works if you use Chrome incognito too. I.e. it's just your normal computer, with normal chrome, where your existing chats aren't working?

  • roleplay bot not replying after long conversation
  • I've been working on upgrading the model behind the ai text plugin recently, so I might have introduced a bug somehow. If you're using perchance.org/ai-chat can you click the "share" button to generate a share URL and DM it to me? No worries if it's not something you can share. In that case, there are a few questions which might help me guess what the problem could be:

    1. Has it happened for just one chat? Or multiple separate chats do the same thing? (i.e. get slower and then stop replying)
    2. Is the chat in English, or another language? (this can sometimes affect the "tokenizer" - technical stuff)
    3. Have you had the tab open for a while? Can you try refreshing the tab and see if the issue persists?
    4. If you have access to another internet connection, can you try switching to that connection?
    5. Does it completely stop replying, or just much lower chance of replying? And if you leave it for e.g. 1 hour and come back, does it work for a little while, or still not works with that same chat?
    6. When you refresh the page, did you see any errors when you try to generate the first image? E.g. about a tokenizer not loading properly, or something?
    7. When the bot doesn't reply, do you see any errors? And if no errors, then how long does it take to reply? i.e. 10 seconds ish or closer to e.g. 60 seconds until you can click the "send message" button again
    8. If you temporarily scroll up and delete the most recent half of your chat, does it start working again?
    9. Which device and browser are you using? E.g. "Android Chrome"
    10. How many words is your story/chat? You can copy paste it into an online word count tool to check.
  • Blocked from accessing by Cloudflare for months now.
  • When it works on your mobile, are you connected to your home wifi, or using mobile data? That'll tell us whether it's caused by your router or something on your PC. If it works on your mobile when you're connected to the same internet as your PC, then as Edward suggested, it seems like it might have something to do with DNS (since you mentioned switching browsers didn't help, and I assume using incognito doesn't either), or some other PC networking settings.

    seems like my PC as a whole is being blocked

    Note that you're not being "blocked" here - it's an error with the request/response. E.g. router or computer is adding weird headers to the request, or DNS stuff is broken, or something weird like that.

    Another thing that might be worth trying is creating a new guest login account on your PC (i.e. go into OS settings, add a new user account, then login to that account) and testing from there. And if that still doesn't work, and you're willing to get your hands dirty, then you could create a bootable USB so you have a fresh installation of your OS. And if that doesn't work, then it's almost certainly something to do with your router/wifi. One thing to test before going to the trouble of doing that is to hotspot your phone's mobile data connection to your PC if possible - and if it works, then your wifi/router is the cause.

  • [Request] Create a "Oops Something went wrong" page if a generator fails to load on Perchance
  • One approach that might work here is to load your feedback button as the very first thing on the page - i.e. before any of the code that could have errors. That way there's always a feedback button hovering in the corner of the page. Or you could have a "loading screen" that sits in front of all your content, and has a feedback button in the middle, and that loading screen is deleted/hidden once you've detected that the page has successfully loaded.

  • HELP-Generator stuck in a starting loop
  • Thanks for that! So the problem is that the anti-bot verification is failing. Next step is to work out why. Can you show screenshots of the console in Guest mode? i.e. click the profile pic in the top-right of a normal chrome window (next to the 3 vertical dots) and click “Guest”. This will open a browsing session with all Chrome extensions disabled. Then open the console and see if you get the same "Cloudflare Turnstile" errors. Screenshot the logs you see there.

    Also, some questions:

    1. Is there anything unusual about your internet connection? Or is it just a regular home ISP? Or business connection? etc.
    2. If you visit https://ip-api.com/ and scroll down to the data on your ISP, does it say this at the bottom:
        "mobile": false,
        "proxy": false,
        "hosting": false
    

    I.e. are they all false, or is there a true value?

  • How do I reference a list by string?
  • If sel_case is a string (i.e. the name of the top-level list that you want), then root[sel_case] will give you the actual reference to the list. The special root variable refers to the "top-level" / "root" node in your Perchance "tree" of lists/sub-lists.

  • [Request] Create a "Oops Something went wrong" page if a generator fails to load on Perchance
  • Heads up that __currentPerchanceErrorCount, and all other global variables that begin with __ are "private" (engine-internal) variables, meaning that I may change their name at any time, causing generators to break that were using them. As I mentioned to Bluepower, if you find a variable in the console, you should first check if it's officially documented (likely on perchance.org/advanced-tutorial ) before using it, and if it's not, then it should be assumed to be private.

  • `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

    It basically allows you to specify to different colors - one for if the user's device is in light mode, and the other if they're in dark mode. Here's an example gen showing how to use it:

    https://perchance.org/css-light-dark-test#edit

    ```html <style> html { color-scheme: light dark; } /* this line is important! otherwise the code below won't work */

    body { background: light-dark(lightgrey, black); } </style>

    <p style=" color:light-dark(blue,lime); ">this text will be blue in light mode and lime in dark mode</p> ```

    Note that this is a very new browser feature, and a lot of people are on older browser versions, so for at least the next few months you should probably still add a default color before your light-dark color like color:blue; color:light-dark(blue,lime);. That way the older browsers will still get the right colors, but in the newer browsers the light-dark color will override the default color.

    1
    Seventh Sanctum Data Archives

    I know there are a few people here who enjoy archiving - e.g. https://perchance.org/vionet20-abulafia-conversions

    So I figured I'd mention this which I just stumbled across - from this post:

    https://www.stevensavage.com/blog/2023/09/seventh-sanctum-next.html

    > I’m going to start making my generator notes and data available to you. The data is pretty easy to just bundle up, but I also want to make some notes on how to use it. I’ll make this very visible on the site so you can just download it and go do your own thing.

    > Replicate my generators. Enhance them. Build your own. Learn from them. Whatever works for you.

    > I know I can’t maintain the site forever – if nothing else, I won’t be around forever.

    Perchance, on the other hand is going to be around until the heat death of the universe, so if anyone wants to help Steven preserve his work via Perchance versions of his gens, here's the data:

    https://www.seventhsanctum.com/archive/sanctumdata.zip

    If you work out the conversion rules, I or someone else can write the JavaScript code for a mostly-automated converter.

    2
    [dev] 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.

    First, some context:

    When you call list.evaluateItem, it evaluates the square and curly blocks of course, but it also removes backslashes that were before any square or curly blocks. Backslashes are used to tell the Perchance engine that a square or curly bracket should be interpreted 'literally' - i.e. not as a character with a special meaning.

    So, for example if we call evaluateItem on a list item like this: {1|2|3} \[cool\] the output will be something like 2 [cool]. If we didn't put the backslash before the square bracket, the Perchance engine would look for a variable/list called "cool" and if it didn't find one, you'd get an error. The backslash says "treat this as a normal/literal square bracket - not a fancy Perchance thing".

    Now to the point of this post:

    Notice how in the above example of using evaluateItem on a list, the output (2 [cool]) has the backslashes removed? As previously mentioned, that is the correct/desired behavior. But I just found a bug where if you call evaluateItem on a string like {1|2|3} \[cool\] it would output 2 \[cool\] instead of 2 [cool].

    I've just fixed this bug - so the backslashes are now removed (just like when using evaluateItem on lists and list items), but I've made it so the bugfix is only applied when you next save your generator - just in case there are any issues with the fix. So please go ahead and save your generator, and if you run into any issues, even if you fixed them, please let me know in the comments. Any examples of issues will help me build an understanding of the effect of this change.

    Thanks!

    2
    [Tip] A cute way to remember text inputs (without the `remember-plugin`)

    This likely won't be relevant to a lot of devs here, because the remember plugin does the job fine in most cases, but:

    Here's a normal text input (id is not needed for this example, but is almost always needed so adding it here): html <input id="thingyInput"> And here's one which remembers what you type into it even after page refresh: html <input id="thingyInput" oninput="localStorage.thingy=this.value" value="[localStorage.thingy || '']"> Of course, the remember-plugin can do this for you, but I often find myself reaching for the above pattern for its simplicity.

    localStorage is what the remember-plugin uses behind the scenes - whatever you store in it will be persisted even after page refresh. It's a built-in browser/JavaScript feature - not something that's specific to Perchance.

    The || '' in [localStorage.thingy || ''] means or ''. In other words, it means or output nothing. If you want a default value for when the user loads the page for the first time, you could write [localStorage.thingy || 'blah'] which means "use whatever is in localStorage.thingy if it exists, otherwise use 'blah'"

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

    (To be clear, since I realized just now that to non-devs the title might be misleading: This feature does not add AI bots to your comments plugin by default! The comments plugin and the AI plugins are completely distinct. But plugins can of course interact with one another, and this new feature of the comments plugin allows for some interesting interactions - the title just gives one of those as a fun example.)

    You can now "programmatically" submit comments on behalf of the user, and you can also get/set the contents of the input text box.

    If a comment was programmatically submitted, then a little icon is shown on the comment to indicate that the user didn't personally click the submit button.

    This feature, used alongside the onComment/onLoad feature can e.g. be used to create an AI bot that "lives in" your comments box, or create a multiplayer game of chess, or maybe add an auto-error-report log using window.onerror, and so on.

    Edit: Also, you can now use c.comments to get an array/list of the comments - but make sure to do that only after onLoad has triggered, since c.comments only returns loaded comments - so if comments box hasn't loaded yet, you'll get an empty array.

    Let me know if you find any bugs/issues!

    https://perchance.org/programmatic-get-set-submit-comments-plugin-example#edit

    I'll probably create a little AI bot example at some point, but you're welcome to beat me to it! (Please post it here on lemmy if you do)

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

    The comments plugin has a new feature that allows you to access the "stream" of comments as they are submitted to your comments box. So now you can "do stuff" on your page in response to comments that people make.

    Title is (mostly) a joke, but it wouldn't be toooo hard to create simple multiplayer games like chess or little point-and-click worlds that people can play on your page via the comments (just need to ignore invalid user moves/inputs based on the rules of the game you're making).

    I expect a few perchance devs to play around with some "mad science" along those lines, but for most people, probably the most useful thing here is that it allows you to completely customize the way comments are displayed. Including e.g. adding avatar pics to comments, changing the background image of every comment based on the keywords in it, making confetti fly across the page (for everyone) when someone says a secret/"easter egg" keyword, and so on.

    Examples:

    • Display the most recent comment in bold at the top of the page: https://perchance.org/simple-comments-plugin-oncomment-example#edit
    • Fully custom comments feed/style: https://perchance.org/comments-plugin-oncomment-example#edit
    10
    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

    For example, if you've made a world building religion generator, and you title it "The Arch Bible" or something like that (i.e. something that's more of a "brand" than a "description"), then people won't be able to use a web search engine to find it unless they already know its name. In other words, people don't search for "The Arch Bible" when they want to find a religion generator - they of course search something like "fantasy religion generator" or whatever - so make sure you put keywords like that in your $meta.title/$meta.description if you want to make it easy for others to find it.

    Search engines heavily weight the page title in their search, so it definitely pays to have a $meta.title which appropriately summarizes what your generator does in a few words. It's fine to have something like "Fantasy Religion Generator - The Arch Bible" as your title - i.e. a description, plus a "brand". Just don't leave out the key descriptive terms.

    I'm writing this post because I don't think people realize how the "popular" generators on Perchance actually tend to get popular - it's one of two things:

    1. (rare & temporary) The generator happened to go viral on social media somehow.
    2. (common & long-term) The generator's title and/or description was descriptive, and so random people around the world each day hit their page via a Google search, which can add up to thousands of visitors in just a few months if it's a popular "topic" that people search for.

    Popular generators almost always get popular via #2, and #2 often eventually leads to #1 - i.e. people find it via a search engine, and then share it with their friends on social media, and then at some point (for whatever reason) it goes viral. I think people tend to incorrectly assume that #1 is the main factor in a generator's popularity (it can be, but it's rare).

    TL;DR: Use appropriate descriptive terms in your title and description if you'd like your generator to become well known. Think about the sorts of keywords that people would type into a search engine to find your generator.

    17
    Text to Image Plugin Gallery Moderation Example

    Unfortunately for now it's just phrase banning (with regex pattern-matching supported) and user ID banning - i.e. no ability to "login" and delete stuff, like you can do with the comments plugin. Hopefully this will suffice until I get around to making it easier (I want to make moderation easier on comments plugin at some point too - e.g. 1-click bans alongside existing 1-click delete).

    • https://perchance.org/text-to-image-gallery-moderation-example
    • https://perchance.org/text-to-image-plugin

    There may be bugs! Please let me know if you find one in the comments below. I haven't thoroughly tested it, so I'm relying on y'all :)

    Edit: Also, a reminder that when I'm short on time (like lately) I'm most likely to fix things that people complain about often. Thanks to Allo and others for posting and complaining about this. Feel free to complain repeatedly and tag me often. It helps me prioritize.

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

    Note that the 'auto' checkbox doesn't actually clear variables - it just fully re-executes all the square/curly blocks in the HTML. So if you're doing stuff where your code needs variables to be "cleared"/fresh before the first generation, then you'll have noticed that you actually need to click the 'reload' button (or refresh the whole browser tab) to get your generator back to a completely "fresh" state. But, as the annoying message would inform you, clicking the reload button required saving your generator first. That's not required any more. I should have fixed this about 6 years ago. Took about 15 mins 😐

    1
    [dev] Upload Plugin

    New plugin: https://perchance.org/upload-plugin

    This plugin is like https://perchance.org/upload except in 'programmatic' form. So you can allow users to e.g. upload their generated text with a button click, and get the resulting URL to share with their friend.

    It does not require the user to be logged in, but as a result, the daily allowances (based on IP address) and max file sizes are significantly smaller than with perchance.org/upload - see plugin page for details.

    As an example of what you can do with it: I just used it to add a feature to https://perchance.org/ai-chat where you can easily share the AI character that you've made via a link.

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

    Just a little demo/example for now - feel free to fork and play around with the instructions and stuff, of course! https://perchance.org/ai-generated-hierarchical-world

    0
    In the comments plugin settings (gear icon) there's now a 'notify' command to enable notifications based on trigger words - BUT read this post for some caveats!

    Currently notifications aren't supported on mobile, and also you won't get notifications if you don't have a perchance comments section open somewhere on your computer. It doesn't matter which comments section you have open (i.e. it can be on any generator/page, regardless of which particular comments boxes that you've subscribed to), but it needs to be visible somewhere.

    Also, some browsers will "hibernate" a tab that is backgrounded/inactive which will pause the notification script, so it's best to pull the browser tab out into its own browser window so that the tab is deemed "active"/visible by your browser - that way it won't "hibernate" the tab.

    So, with the above caveats, you now have a crude way to get notified if someone comments on your generators! Or when people are active at your favorite hang out spot, etc. The caveats are annoying, but it's the first step! Please give feedback if there are any issues - I may not be able to fix them, or at least may not be able to fix them right away, but it'll be helpful to hear about the most annoying issues so I can plan future improvements here.

    0

    Example generators made with this plugin:

    • https://perchance.org/ai-character-design-example-simple#edit
    • https://perchance.org/random-character-chat-example#edit
    • https://perchance.org/ai-character-design-example#edit
    • https://perchance.org/ai-chat-example#edit
    • https://perchance.org/ai-text-plugin-render-example#edit
    • https://perchance.org/ai-text-plugin-text-to-speech-example#edit
    • https://perchance.org/ai-text-plugin-tester#edit

    See the plugin page for more. There will probably be issues/bugs! Thank you in advance to the pioneers who test this and report bugs/issues in these first few days/weeks 🫡

    (It was actually possible to discover this plugin a few days ago, but no one made it through all the clues lol ^^ some people did at least figure out the first step)

    0
    link-plugin donation to admin account?

    Wondering if someone can get in contact with Raggedflight to ask if they'd like to donate the link-plugin to the admin account so I can put it into the official plugin list? Credit to Raggedflight would be added at the top of the page just like in https://perchance.org/image-plugin of course. No worries if they'd rather not!

    0

    Simple example usage: https://perchance.org/url-params-plugin-example?blah=abc123

    It's really simple: ``` url = {import:url-params-plugin}

    output [url.blah] // this will output 'abc124' if URL has '?blah=abc123' on the end ``` This plugin allows you to, for example, have several "different" generators within the same generator page, where each sub-generator has its own URL. Or to just adapt the output of your generators based on the URL. E.g. you might have an English and a French version of your generator with URLs like this:

    • https://perchance.org/my-cool-gen?lang=en
    • https://perchance.org/my-cool-gen?lang=fr

    In that case, within your code you can use [url.lang] to determine which language the user is viewing, and adjust your list selection/odds/etc. based on that.

    You can also use it to e.g. link directly to a particular seed for the seeder plugin, and stuff like that.

    (Note for experienced Perchance users: The old document.referrer hack is no longer required since Perchance now copies all parameters over to the iframe when initializing it)

    0

    For images and other files that you need for your generators/plugins/etc. - rather than using base64 strings, or external file hosting services like catbox.moe

    https://perchance.org/upload

    0
    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
    perchance @lemmy.world
    Posts 17
    Comments 152
    Moderates