Slighlty More Complicated Hiding Choices


#1

Hello. I’m trying to display a list of choice with a number of hidden ones that will only appear if the condition is met, thanks. As below (also, much appreciated if you know how i can line break… >_>):

*temp n1 0
*temp flatter


----------

*label approach
*choice
  #Flattery.
    *set flatter true
    Cassadia [i]hates[/i] flattery and will not treat a flamboyant individual seriously. You really hit the wrong mark on this one.


----------

*label cassadiatalk
*choice
  #q1.
    *set n1 1
    *if (flatter)
      Meh.
      *choice
        #Dig deeper.
          *goto q1set
    *else
      *label q1set
      test q1set
      *goto cassadiatalk


----------

*if (n1=1)
  #Time to move on.
    *finish

#2

It’s described in the ChoiceScript wiki. (That, and a whole lot of other things regarding choices you probably didn’t ask for :wink:)


#3

Well I know that, it’s just that my code is not working so I’d like to figure out why.


#4

What kind of error does it show?

use *line_break :wink:

Edit of edit:
Scratch that :sweat_smile: Didn’t look at the whole thing in context.


#5

It doesn’t show an error; the second choice ‘Time to move on’ just doesn’t show even though I’ve tested earlier that n1=1 and it should pop the choice out.

And uh, I actually mean line break here and not in my code lol.


#6

Just use the Enter key :neutral_face:


#7

Oh, that’s odd, because I thought if I *temp flatter it’ll automatically be set to true already.

What I’m trying to do is like this: If flatter is selected, flatter will be set to true, and when you select the list of choices - say q1 - it will check if flatter is true, and if it’s true it will display “Meh” first, prompting you with another choice to “Dig deeper”, then go to *label q1set (under *else) and display “test q1set” normally. Then it will loop back to cassadiatalk and allow you to select choices again.

And man I really need to be specific. I mean line breaks within the code block.


#8

I personally don’t use this approach when hiding choices, so I’m not too sure, but it might be because the second choice isn’t indented properly. I guess you should put the *if statement at the same level as the first choice.


#9

You mean like this?

*temp n1 0
*temp flatter

*label approach
*choice
  #Flattery.
    *set flatter true
    Cassadia [i]hates[/i] flattery and will not treat a flamboyant individual seriously. You really hit the wrong mark on this one.

*label cassadiatalk
*choice
  #q1.
    *set n1 1
    *if (flatter)
      Meh.
      *choice
        #Dig deeper.
          *goto q1set
    *else
      *label q1set
      test q1set
      *goto cassadiatalk

*if (n1=1)
  #Time to move on.

    *finish

Just remove the -'s


#10

I’m using [code] so just normally entering doesn’t work haha… The -s are there to separate it because it didn’t work.

Also, it is the indentation problem, thank you very much! One last thing, is it possible for you to show a simple example on how you hide choices? I have a problem not seeing the simpler solution until days after lol, so…


#11

For displaying code on the forum I just select the section of code and click the Preformatted text button (it looks like </>).

Found one. It’s a pretty simple example though :sweat_smile:. Apparently I don’t actually use non-selectable options nearly as often as I thought I did. (please ignore the text :wink:)

*choice
    *selectable_if (puppet < 80) #You close your eyes
        You don't care much about the whole political side of things, but you don't like being used as a target finder.
        Though you know that the act will have consequences for you, you slowly close your eyes. If they want to hit their target they'll have to find a different source of information.
        
        Retribution follows shortly.
        Sharp surges of pain shoot through your head. The pain is so intense that brightly colored flashes of light appear behind your closed eyelids and the world feels like it's spinning.
        You grit your teeth and remain upright by sheer force of will. [i]They[/i] are not going to get the upper hand this time.
        *page_break
        You are pulled away from your internal struggle by the sound of people gasping in horror. Knowing that you've already done everything in your power to deter your creator your eyes fly open
        just in time to see the diplomat's ship burst into pieces.
        *set puppet %-10
        *set choice "headache"
        *finish
    #You keep watching
        Whatever you might do, it's not going to change what's about to happen. [i]They[/i] are simply too powerful for one person to stand a chance against them.
        
        You watch the ship burst to pieces with a familiar sense of serenity. It's not your fault. There's nothing you could have done.
        
        It's not your fault.
        *set puppet %+10
        *set choice "noheadache"
        *finish

Basically you just place the *if statement in front of the option.


#12

Yup, I see that.

I know I unintentionally made my code more complicated than necessary, but I thought the n<5, n=n+1 standard doesn’t fit too well because I don’t want my players to select the same option 4 times and able to proceed to the next phase, so.

Once again, thank you very much for the help!