Temp Counter within choices for multiple Questions

I’m not sure if it changed or if I’m just doing it wrong, but I used to be able to make a choice that would go back to the choice once you picked an option.

It passes the quickest so I know these aren’t like non existent commands or anything, but I feel like I’m doing it wrong?

Here is an example:

I have some questions.
*label questions
*temp counter 0
*choice
    #Question 1
        Blah
        *hide_reuse
        *set counter 1
        *if counter>6 
             *goto questions
        *else
             *goto forms 
    #Question 2
        Blah
        *hide_reuse
        *set counter 2
        *if counter>6 
             *goto questions
        *else
             *goto forms 

         

So on and so forth. Obviously this is janky asf and is literally just for developmental purposes right now.

I would of course limit them to four and then add another if statement based on whether they have a counter or not and it all seems very tedious. I am aware using this I will run into the issue of counter numbers getting mixed up but…. Idk. Is there and easier and simpler way to do this?

I assume you want the “counter” to tell you how many #options a player has chosen? For that, instead of *set counter 2, you should *set counter +1 for every option.

If counter = 1, then the player has asked one question/chosen one dialogue question, so on and so forth for other numbers.

If you want to know which questions/#options specifically the player has chosen, you would be better served to use boolean variables:

*temp counter 0
*label questions
*fake_choice
  #Question 1
    *set q1 true
    *set counter +1 
    Text
    *if (counter <= 4)
      *goto questions
    *else
      *goto next
      *comment this will happen by default with fake_choice or if you are using implicit control flow
  #Question 2
    *set q2 true
    *set counter +1 
    Text
    *if (counter <= 4)
      *goto questions
    *else
      *goto next
      *comment this will happen by default with fake_choice or if you are using implicit control flow
  #etc

*label next

Also take note of the code above with regards to *temp counter 0. This should go before your label, otherwise when your code goes back to the top, it’ll automatically reset the counter. Best practice is to put your *temps at the top of the page.

I hope that answered your question, but please let me know if I missed the mark!

5 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.