1
submitted 2 weeks ago* (last edited 2 weeks ago) by _afb@lemmy.world to c/perchance@lemmy.world

It's great if the author of the nested plugin is reading this, but even if you aren't the author I hope you read this.

Thank you.

Questions for experienced Perchance users in general

  • When you are figuring out how to pull some piece of data out of an object created by a Perchance plugin, how do you figure out what the Javascript name of that object is?
  • Is there some standard way of figuring out which account maintains a Perchance plugin is if their name is not displayed on the plugin's page?

Question for people familiar with using the nested plugin (or its author)

This is a location generator for a fictional world I'm working on. I am trying to create a second panel in the web page that show the currently selected item in the nested hierarchy at the top and show the description fields from the entire chain leading to it.

In this mockup I have a static div at the bottom with placeholder text saying "Star description. Celestial body description. Feature description. Region or point-of-interest description."

I would like it to dynamically pull the description attributes of the currently selected node and the entire chain of nodes leading to it. So, it would look like this...

A late-epoch system around a red dwarf: compact, old, and far more typical than Sun-like systems in PW50B. >> The surface regime here is defined by frost, fracture, and deep cold rather than rain, rivers, or active seas. >> The object is small enough that shape, mass distribution, and surface coherence have all given up on elegance. >> This is terrain that has lost coherence, becoming a field of fragments rather than a single intact crust.

... which is what the descriptions leading from the root to the currently selected node say.

By the way, is there a way to display the description field of a non-terminal node besides in a tooltip?

top 2 comments
sorted by: hot top new old
[-] Adventurous_Step2911@lemmy.world 2 points 2 weeks ago
  • When you are figuring out how to pull some piece of data out of an object created by a Perchance plugin, how do you figure out what the Javascript name of that object is?
    • Not sure I understand correctly. Do you want to extract a list out of a plugin? Then something like this should do the trick: "root.$moduleSpace["nested-plugin"].world". Or do you want to understand how to find it? I do that through inspecting the root object in the browser console
  • Is there some standard way of figuring out which account maintains a Perchance plugin is if their name is not displayed on the plugin’s page?
    • Not that I know of

Now to your main problem: Afaik, perchance objects are static and don't save their state when they're evaluated. You have to inspect the DOM with JavaScript and traverse the parent elements to gather all descriptions. At least that's how I got it https://perchance.org/ah70cbqlqk#edit

I'm not really good at explaining, please ask if something is unclear. What I've done in the example is, I've overwritten the javascript onclick handler defined in the nested-plugin. This onclick handler is executed when expanding a header element. This allowed me to inspect the DOM that was generated through the nested-plugin. If the currently expanding element is a leaf, it traverses each parent header element and extracts the description of it and overwrites the content with all gathered descriptions.

[-] _afb@lemmy.world 2 points 2 weeks ago

I’m not really good at explaining, please ask if something is unclear. What I’ve done in the example is, I’ve overwritten the javascript onclick handler defined in the nested-plugin.

Thank you! You are better at explaining than you think. Yes, this definitely looks like what I'm trying to achieve. I'll try it and post an update on how it goes.

this post was submitted on 16 Apr 2026
1 points (100.0% liked)

Perchance - Create a Random Text Generator

1844 readers
33 users here now

⚄︎ Perchance

This is a Lemmy Community for perchance.org, a platform for sharing and creating random text generators.

Feel free to ask for help, share your generators, and start friendly discussions at your leisure :)

This community is mainly for discussions between those who are building generators. For discussions about using generators, especially the popular AI ones, the community-led Casual Perchance forum is likely a more appropriate venue.

See this post for the Complete Guide to Posting Here on the Community!

Rules

1. Please follow the Lemmy.World instance rules.

2. Be kind and friendly.

  • Please be kind to others on this community (and also in general), and remember that for many people Perchance is their first experience with coding. We have members for whom English is not their first language, so please be take that into account too :)

3. Be thankful to those who try to help you.

  • If you ask a question and someone has made a effort to help you out, please remember to be thankful! Even if they don't manage to help you solve your problem - remember that they're spending time out of their day to try to help a stranger :)

4. Only post about stuff related to perchance.

  • Please only post about perchance related stuff like generators on it, bugs, and the site.

5. Refrain from requesting Prompts for the AI Tools.

  • We would like to ask to refrain from posting here needing help specifically with prompting/achieving certain results with the AI plugins (text-to-image-plugin and ai-text-plugin) e.g. "What is the good prompt for X?", "How to achieve X with Y generator?"
  • See Perchance AI FAQ for FAQ about the AI tools.
  • You can ask for help with prompting at the 'sister' community Casual Perchance, which is for more casual discussions.
  • We will still be helping/answering questions about the plugins as long as it is related to building generators with them.

6. Search through the Community Before Posting.

  • Please Search through the Community Posts here (and on Reddit) before posting to see if what you will post has similar post/already been posted.

founded 2 years ago
MODERATORS