wthit56

joined 4 months ago
[–] wthit56 2 points 3 weeks ago (4 children)

Are you trying to make a new generator? How is this related to the character you have on the character AI chat?

[–] wthit56 1 points 3 weeks ago

The onclick takes JS code. The JS function called "update" updates the perchance stuff across the whole page. If you pass an element to the update function, it will only update that element.

So in my test, I have an element with the id "output." So just passing output to the update() function means I'm passing a reference to that element with the id "output." And then only that element is updated.

[–] wthit56 1 points 3 weeks ago (2 children)

Well done! If you let me know where to look, I'll check it out :D

[–] wthit56 1 points 4 weeks ago (5 children)

I've made a separate example. While yours may have been simplified there was still a lot of complexity and redirection throughout the perchance code which made it hard to really know what's what.

This example does what you want (I think), and is also very simple. I hope it helps. https://perchance.org/hw714l9a98#edit

[–] wthit56 1 points 1 month ago

A heads up: sign up, and while logged in you won't get ads anyway.

[–] wthit56 1 points 1 month ago (2 children)

Like the ai character chat?

You know anyone can make their own AI text generator, right?

[–] wthit56 1 points 1 month ago* (last edited 1 month ago)

Could you remove that giant thumbnail perhaps? Might have to remove the link of the post, and just put it in the body to do that. It's just taking over the main feed pretty heavily unfortunately. I don't know why it works like that on here.

[–] wthit56 1 points 1 month ago

What do you do to make it public? And what happens?

[–] wthit56 1 points 1 month ago

Ah cool. That fits.

[–] wthit56 1 points 1 month ago (2 children)
 

Would be useful to be able to see the images just in the page so we don't accidentally delete the wrong one, stuff like that. I know we can click on the link, but this would just be a nice feature to make it easier.

 

Another day, another learn...ing...s.

This covers everything from how to start editing/making a generator, to writing perchance code. (The more web-y stuff are covered in my other tutorial.)

 

Seems to be related to this: ___htmlToElements(). It takes a string which is the text, ignoring the fact that HTML entities are not normal characters and should not be interpreted as normal HTML. For example, &lt; will be interpreted as < which can open a tag.

Example: https://perchance.org/qzi72h52te#edit

So if an element contains any perchance code, and HTML entities, the HTML entities are essentially lost and become real characters. Which isn't what you want if you're trying to present plain-text code to the user.

Definitely does not work as expected at least.

 

For example, I'm linking to the Learn tab but that doesn't actually open the Learn tab.

 

No error message makes it to the display.

In the console there is:

Critical error in __createPerchanceTree: TypeError: Cannot read properties of undefined (reading 'startsWith')

And in the error messages there's just this:

Your generator's script seems to have errors in it. If you haven't recieved any other errors above this one which could indicate what went wrong, then this could be a bug in the Perchance engine. *etc...*

("recieved" should be "received" by the way 😜)

 

As seen here: https://perchance.org/p5bdhjbfv6#edit

So it still runs somehow? And accesses the grandparent somehow? Likely a bug with how escapes are stripped out--and perhaps recursively processed or something...

1
submitted 2 months ago* (last edited 2 months ago) by wthit56 to c/perchance
 

https://perchance.org/2p16eseroi#edit

Got a tricky situation here. If I do a .replace() on the html of an element (just some formatting stuff for code blocks), the update() is still referencing old text nodes. So it just doesn't care about the new ones that are there from the replace and they stay there. And it adds new ones that are actually updated.

Not sure what to do about that, honestly. Ideally I'd be able to do this replace before the initial update of code blocks is run. Is there some way of doing that?

The issue seems to only happen for code blocks? Maybe?

2
submitted 2 months ago by wthit56 to c/perchance
 

Based on the newly added explanation of the public API calls themselves, I've made a little plugin for using those APIs a little easier, along with the usual demos and explanations.

3
submitted 2 months ago* (last edited 2 months ago) by wthit56 to c/perchance
 

If I have padding on the body, it doesn't do much. Because there's height:100% on the body by default, which is actually incorrect and causes this issue for reasons. As seen here: https://perchance.org/o0demyuvpj#edit Whereas without any default styles the padding would work as expected.

It should be max-height:100% instead, which would not have the problem. Could I request that be changed?

3
submitted 2 months ago by wthit56 to c/perchance
 

A while back I put together everything I could find about perchance. One such document included all properties on objects on perchance pages (that aren't the built-ins from JS). On discord someone said how they wish there was such a reference. So... now there is!

1
submitted 2 months ago by wthit56 to c/perchance
 

perchance.org/api/getGeneratorList?max=123 - limit to a maximum of 123 generators

Are they latest-first?

It doesn't seem like this "max" has to do with how many generators are returned. But the number returned does scale with it. So... last-updated age, perhaps? Not sure what unit of time it would be though. Quite confused.

Could be that it's the max, before it removes private generators? Which would kind of make it not be the "maximum" anything really. Not a very useful parameter as it would be if it would actually give X number of generators--for paging, etc.

(Speaking of which is there a way of specifying "start from X generator number and later" for paging to work well?)

I don't know what the default "max" or whatever is for this api. Seems to fluctuate how many are returned, and it's not always a round number.

 

Does anyone know how to get the image url from the $meta object of another generator? I think there's an /api/ fetch I can do for it, but that stuff isn't documented anywhere, I don't think.

view more: ‹ prev next ›