Search
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!
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.
mainly relevant to JS devs: each generator now has its own localStorage
Previously all generators shared the null.perchance.org
subdomain, but now thanks to Cloudflare moving wildcard DNS from the enterprise plan to the free plan (announcement post) I've given each generator its own subdomain. I really should have done this a year ago when they announced it - just got around to it today.
I've added some code to transfer localStorage
data across to the new subdomains, but unfortunately this code has to run the first time you visit any generator, and causes a refresh to happen a second or two after page load. This'll be a bit annoying, but I can remove this code after a few months - it's just to make sure that any important data is transferred across. If someone hasn't visited a particular generator in a few months, then the localStorage
data (e.g. from the remember-plugin
) probably isn't very important (and if it is, it's still recoverable - they'd just have to make a post here on the lemmy community to get help on how to do it).
If, for some reason, you need to easily & programmatically access the new subdomain, you can use the global generatorPublicId
variable (akin to generatorName
which already existed). The full URL of the embedded iframe is https://${generatorPublicId}.perchance.org/${generatorName}
. The null
versions of generator embed URLs are auto-redirected to the new generatorPublicId
versions, so you can still embed your generator in other websites using the normal embed code:
html <iframe src="https://null.perchance.org/my-generator-name" style="width:100%; height:600px; border:none;"></iframe>
That iframe will redirect to:
https://50e67e76966106ad99d72edb729943b7.perchance.org/my-generator-name
Please let me know if you run into any troubles with this, or have any feedback/suggestions .𖥔 ݁ ˖