this post was submitted on 07 Jan 2024
3 points (71.4% liked)

Perchance - Create a Random Text Generator

448 readers
19 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 1 year ago
MODERATORS
 

i'm trying to make a function that creates a multi-level list. i've got function code that makes a single-level list, and that works fine, but my attempted extrapolation of that code to make a two-level list isn't working. could anyone tell me what i've done wrong and how to fix it?
thank you in advance! <3

you are viewing a single comment's thread
view the rest of the comments
[–] VioneT 1 points 10 months ago (1 children)

Linking the generator would be helpful to also see your previous attempts. Also, i'm not sure if I understand but, you want a prA variable that holds the values from the input? You can do that without having it inside the function like so:

prA
  sub = ''
  obj = ''
  det = ''
  pos = ''
  ref = ''

Also, you can directly have the variables on the function like so, without needing to create a list inside of it:

makePronounList() =>
  let sub = []
  let obj = []
  let det = []
  let pos = []
  let ref = []
  ...

If you want to create a new 'list' from the user's input, see this user input example.

[–] starrymoonbow 1 points 10 months ago (1 children)

here's the link to my generator: https://perchance.org/dcpau0freu#edit.
i'm trying to make a list called prA (meaning pronoun A) that holds several single-item lists (sub/obj/det/pos/ref) that each contain a value from each input. (i need them to be in the list prA because i want to make five more separate pronoun lists like it, one for each Person.) this much of the code is working fine.
my issue is that i would like the values to receive the highlight color to match the color that "Person A" is highlighted in. in my current code, it seems to be ignoring the function that should be applying the highlight color. i'm very inexperienced with HTML and javascript, so i'm not sure how to edit the function to make it work.

[–] VioneT 2 points 10 months ago (1 children)

See this modification of your generator

On that generator, I essentially hard coded all of the items that you dynamically need to create. It is much easier to use since you can change those values with inputs easily instead of pushing stuff into an array which might throw errors.

[–] starrymoonbow 1 points 10 months ago* (last edited 10 months ago)

oh that's interesting! it works nicely i think, but there's just one problem. i'd like for the highlight to apply automatically to the names and pronouns, even when edited by user inputs, which is why i was going through a function that applied the formatting to the names, and attempted to do the same with the pronouns. if that isn't possible, i understand, it would just make editing more convenient for me. thank you for helping me this far! :0