I am trying to create a random question generator on perchance.org for practice in responding to french questions. I have a generator that selects questions from a list of questions (“outputa”) (https://perchance.org/4ewrtclbl5#edit).

For example, I have:

<h1>[title]</h1> <h2>[title2]</h2> <h3>[title3]</h3> <br> Select Random Question

<br><br>

<h4>[title4]</h4> <div>

[outputa] </div>

and defined the following:

title=Random Question Generator title2=Second Language Evaluation – Oral Language Assessment title3=French Level B & C title4=Question: title5=Des trucs et des astuces:

outputa //Decriver ou expliquer au present Où travaillez-vous? Où vous situez-vous au travail? Expliquez et précisez le rôle de votre ministère. Expliquez et précisez le rôle de votre direction. …

//Raconter au passé Comment votre travaille a affecté par la pandemie ? Durant votre carrière, qu’est-ce qui a été le plus satisfaisant jusqu’ici? …

This works well right now, but I would like to improve the generator to be more helpful. Essentially, within the list of questions, there are a number of different styles of questions (“Decriver ou expliquer au present”, “Raconter au passé”, etc.). Each style of question has a strategy to follow when responding to it, so I would like to add some standard text under the question to provide some tips for responding based on the type of question.

I was thinking this could be done by first randomly select a style of question from one list, and then based on the style of question selected, I could select a random question of that style, and then print the random question along with the standard text. Is there a straightforward way to do this?

Thank you in advance!!

  • GroteStreet 🦘@aussie.zone
    link
    fedilink
    English
    arrow-up
    9
    ·
    8 months ago

    You may get a better answer if you follow the suggestion in the comment at the bottom of your source:

    // - Ask our friendly community members if you need help: lemmy.world/c/perchance

    The syntax is specific to Perchance, a website that 99% of the general public have never heard of.

  • TylerDurdenJunior@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    8 months ago

    Sounds like you are about to write a relational database.

    The dropdown could help you with selecting questions in related to the style of questions.

  • hi_its_me@lemmy.world
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    8 months ago

    From our friend ChatGPT:

    Certainly! You’re on the right track with your idea of selecting a style first and then selecting a random question based on that style.

    Here’s how you can structure this on Perchance:

    1. Define the question styles and tips:
    style
    Decriver ou expliquer au present
    Raconter au passé
    [... more styles ...]
    
    tipsForStyle
    [style:Decriver ou expliquer au present] 
    Tip for this style: [Tip for Decriver ou expliquer au present]
    [style:Raconter au passé]
    Tip for this style: [Tip for Raconter au passé]
    [... more tips for each style ...]
    
    1. Define questions for each style:
    questionsForStyle
    [style:Decriver ou expliquer au present]
    Où travaillez-vous?
    Où vous situez-vous au travail?
    [... more questions for this style ...]
    
    [style:Raconter au passé]
    Comment votre travaille a affecté par la pandemie ?
    Durant votre carrière, qu’est-ce qui a été le plus satisfaisant jusqu’ici?
    [... more questions for this style ...]
    
    1. Structure the main generator output:
    output
    <h1>[title]</h1>
    <h2>[title2]</h2>
    <h3>[title3]</h3>
    
    <h4>[title4]</h4>
    
    
    [style]
    
    
    [questionsForStyle]
    
    
    [tipsForStyle]
    
    1. Use this in the HTML area:
    <div>
        **[output]**
    </div>
    

    With this structure:

    1. A style will be chosen randomly.
    2. A question will be chosen from that style.
    3. The tip for the selected style will be shown below the question.

    You can further modify and expand upon this structure to customize the output to your liking!