view the rest of the comments
Perchance - Create a Random Text Generator
⚄︎ 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.
- The full rules are posted here: (https://legal.lemmy.world/)
- User Rules: (https://legal.lemmy.world/fair-use/)
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-pluginandai-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.
https://perchance.org/doc-t2i-framework-plugin-v2
You can use the visible()=> property of components to control their display using conditions. If you set the same display conditions for multiple components, you can group them so that they only appear together.
If you want to access a component through the html code panel, for example, select this persona, then you can use:
or completely ctn of this component:
example of use, hide this component:
Thank you so much this helped a lot.
Is there a way to modify the lists dynamically? Let's say based on the value of a checkbox?
For example I have a checkbox to check or uncheck if the user wants to filter shirt options from the clothing dropdown. I've got something like this where I check the value of shirtOptions.checked and try to add an entry to the list if it's true and not if it's false.
in the HTML part of course I have:
<input type="checkbox" id="shirtOptions" checked oninput="update()"/>However, this is not creating an error in the source but does display "Syntax Error" in the drop down list.
well... It's possible, but it's more complicated than it seems. The problem is that the select elements are static, and in order to change them, you either need to manually interact with the each element or recreate the select by simulating its "update" and giving its
options, but since the checkbox has changed, the elements will also change.I almost got it to work by taking the script for creating these selects from the framework and slightly modifying it to use it to the html of the select element. However, due to issues with Perchance, it reads [ ] as text instead of executing the contents.
Here is the link if you want to see
If you really need it, you can give the codes in the html code panel that I added in to AI chat bot and tell it to evaluate this key that has [brackets] before adding a new option
if you don't want to bother, just split these categories into different Selects (drop down lists)
or.. idk, maybe someone more knowledgeable can correct me
Thank you so much. This put me on the right track. Ended up not being too bad. I used javascript on the website to futz with the list directly after it was created. Probably not the most ideal way to do this.
So what this does is shortly after the page loads runs through each option in the
settings.userInputs.artStyle.optionslist and looks to see ifnsfw = true. If so it adds adata-nsfwtag to the option entry itself on the html side. It then stores the entire option list inartStyleDropdown.When the checkbox is clicked the
toggleNSFWfunction runs. If the check box is ticked it displays all the entries that were initially saved when the page was loaded. If it's unticked it'll filter out any of the options withdata-nsfwset to true then assigns the resulting list back to the dropdown.For the newbies like me in the html side below the
data-name="artStyle"]is finding the drop down control related to the artStyle list. This should generally match the name of the list.Here's the javascript I used:
I added an entry in the list to tag which entries to show and hide. Here it's the nsfw = true/false. In this example I'm labeling anime as nsfw.
Good idea