How do I use selectable_if to exhaust a choice and then move to a new choice?

Hi. I want to create a dialogue with three options/questions. Every time you ask a question, you get an answer and then you go back to the dialogue and the question is now unavailable. When you ask all three questions, either you move to the next scene or a new option appears and takes you to the next scene. Is these possible?

3 Likes

I’m sure it’s possible, since I’ve seen it in existing games. I wouldn’t know exactly how to do it, but I’m sure it involves hide_reuse.

I’m quite new to coding but this is what I got.

Create a temporary variable, say, xyz, and set it false.

Then,

*label next
*hide_reuse
*choice

*selectable_if ( xyz = false)
#question 1
Answer 1.
*goto next

*selectable_if ( xyz = false)
#question 2
Answer 2.
*goto next

*selectable_if ( xyz = false)
#question 3
Answer 3.
*goto next

*selectable_if (xyz = true)
#last question.
Last answer.
*set xyz = true
*goto next_1

*page_break
*label next_1

put *hide_reuse at the top of the document so it looks something like this

*hide_reuse

*label dialoguetree
*choice
  #"Who am I." 
    "Myself, of course." 
    *goto dialoguetree
  #"Where am I."
    "Wherever I happen to be." 
    *goto dialoguetree
  #"I'm done asking questions." 
    *goto nextscene

You need both *hide_reuse to hide used options and a temporary variable for counting how many options you’ve used. Put those before your dialogue tree label. When an option is used, add 1 to your question count. When enough options are used, check for this variable to open a new option for moving to the next label:

*hide_reuse
*temp question_count 0
*label dialogue_tree
What will you ask next?
*choice
    #"There is the detonator???!!!!"
        *set question_count +1
        *goto dialogue_tree
    #"Why so serious?" 
        *set question_count +1
        *goto dialogue_tree
    *if (question_count >= 2) #I have no more questions.
        *goto next_label

Alternatively, use this option to automatically go to next label:

*hide_reuse
*temp question_count 0
*label dialogue_tree
*if (question_count >= 2)
    Suddenly, you are rudely interrupted by a huge explosion!
    *goto next_scene
What will you ask next?
*choice
    #"There is the detonator???!!!!"
        *set question_count +1
        *goto dialogue_tree
    #"Why so serious?" 
        *set question_count +1
        *goto dialogue_tree
    #"Martha!!! Save Martha!!!"
        *set question_count +1
        *goto dialogue_tree

This is all very helpful. Thank you guys so much.

2 Likes

Check out the Wiki, Hide reuse | ChoiceScript Wiki | Fandom.