I figured most of this out! It’s very late here, so I’ll post tomorrow if I can with the additional fixes that let me have unreasonably high expectations of my generator’s capabilities!
This absolutely would not have been possible without @[email protected]’s very cool example!! Thank you again, wthit56!!!
I made another copy of my test generator to experiment with, so here’s the one where I’ve figured out the fixes:
https://perchance.org/kzttwn1wna#edit
I used your code to make the user input box in place of the other code I had originally used, and I just changed some of the names of things within it to match categories already in my generator (so I’d have to change fewer total things). Now every generated prompt shows the user inputted character names on the first click of the generate button (instead of only updating the 3rd line on the first click).
I moved the line of code that defined [one] and [two] to above the line those categories are associated with in the body’s “text” output – that fixed the issue of those spots pulling up as “undefined” on the initial page load/refresh. (I felt like a dummy - but what a relief!)
I changed this – [b] & [b] – to this – [one] & [two] – on the specific prompt possibilities where one or both characters are mentioned in the same line again. And I’ve left other prompt possibilities as [b] or [c] or [q] so that if a user inputs more than two characters, other characters can still show up on other lines of the prompt.
I do have one last question I can’t seem to find a fix for. I’ve been unable to duplicate one part of how your example generator works. For my current generator, when the user inputs character names, the output updates on each “return” after entering each character name. I can’t figure out how to get it to remain static until the user has inputted all of the names they want and then only change when they press the generate button. I think it might be related to whatever I’m running into here:
On my generator I left the button information as: onclick=“update()” — In your generator, it says: onclick=“update(output)”
But when I put the word output inside the parentheses, my button stops working entirely. I haven’t been able to puzzle out what I’m doing or what I’m missing. Do you have any insight?
Thank you again!