If and Fake Choices

Another topic, I know I’m hopeless :sweat_smile:

My first issue is that the second portion of choices aren’t showing up

*choice
  #Glance at the red book, with frayed edges and a cracked spine?
    *goto todo
  #Glance at the green book, with padded covers?
    *goto todo

[code]

*fake_choice
#Listen closer to the man’s stories
*set intelligence %+3
*set charm %+4

*selectable_if (prowess >= 15)
#Glance at the book in the bag under the table, with a flesh toned leathery cover.
*goto todo [/code]

and my second issue is I doubt I’m setting the if statement up correctly. I want it to trigger if prowess is at or over 15%

Your spacing is an issue - to provide sample code you might want to use: [code] and [/ code] let me see if I can fifure what is going on. This will be a learning experience for me too.

1 Like

Hi, maybe try this?

   *choice
    	#Glance at the red book, with frayed edges and a cracked spine?
    		*goto todo
    	#Glance at the green book, with padded covers?
    		*goto todo

*fake_choice
	#Listen closer to the man's stories
		*set intelligence %+3
		*set charm %+4

	*selectable_if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
		*goto todo
2 Likes

evil twin ninja’s me :dolphin: :japanese_ogre:

1 Like

Not quite sure what “the second portion of choices” means – do you mean that the *fake_choice block isn’t showing up after the *choice block, or that the second option of each choice/fake_choice isn’t showing up?

In the fake_choice, you need to indent the selectable_if to the level of the other options, not the level of the *fake_choice command. [Edit: whoops! @Vendetta corrects me, there’s only one right way to do this You could do it one of two ways:

*fake_choice
#Listen closer to the man’s stories
*set intelligence %+3
*set charm %+4
*selectable_if (prowess >= 15)
#Glance at the book in the bag under the table, with a flesh toned leathery cover.
*goto todo

or all on one line:

*fake_choice
  #Listen closer to the man's stories
    *set intelligence %+3
    *set charm %+4
  *selectable_if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
    *goto todo

And while I believe you can use a *goto to leave a fake_choice, one of the only reasons people go to the trouble of typing *fake_choice rather than *choice is that they want to be spared the *gotos!

As it stands, at the end of your fake_choice a high-prowess character will be taken to *label todo, while anyone else will go to whatever line of code immediately follows the fake_choice. If that’s your intention, great.

Edit:[quote=“Gavorn, post:1, topic:18014”]
I doubt I’m setting the if statement up correctly. I want it to trigger if prowess is at or over 15%
[/quote]

You’ve set it up great for that – my comments on the indent level and *goto aside. It will trigger if prowess is at or over 15.

[Must be my day for nit-picking… sorry! :fearful: ]

The above will result in a parsing error. Unlike an ordinary *if, *selectable_if must be in-line, e.g.:

That one will work fine.

4 Likes

Thanks, the real problem was that the selectable_if was counted as a fake_choice because of the sequence I wrote them in.

Another question (sorry) what would the code be to set a conditional goto?

Say you could choose a choice regardless of your Fire ability, but you wanted different outcomes based on it

Would you set it up as an “if” choice for the different options or could you to *if (fire >=12) goto or would you set up conditional elseif statements?

I’m asking because I’m doing the *elseif wrong too

*if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover. *goto todo *elseif (prowess >=10) #Glance at the blah blah blah *goto todo

and

*if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover. *goto todo *elseif (prowess >=10) #Glance at the blah blah blah *goto todo

Both don’t show the elseif when the condition for it but not the if is met

Got it. You may have figured this out, but you can’t have a mixed choice/fake_choice (which I now think is what you were trying to do there?). All four options need to be under a single command, either *choice or *fake_choice, if you want them to show up together.

So you could do it this way:

*choice
  #Glance at the red book, with frayed edges and a cracked spine?
    *goto todo
  #Glance at the green book, with padded covers?
    *goto todo
  #Listen closer to the man's stories
    *set intelligence %+3
    *set charm %+4
    *goto todo
  *selectable_if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
    *goto todo

or like this:

*fake_choice
  #Glance at the red book, with frayed edges and a cracked spine?
  #Glance at the green book, with padded covers?
  #Listen closer to the man's stories
    *set intelligence %+3
    *set charm %+4
  *selectable_if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
*goto todo

and they’d do the same thing. (If *label todo comes immediately after this block of choices, you wouldn’t even need that final *goto todo in the fake_choice example… the game will continue with whatever line of code follows the fake_choice block)

And I think this will do what you’re looking for in terms of conditional gotos:

*choice
  #Fire!
    *if fire > 5
      *goto burnt
    *elseif fire > 2
      *goto toasted
    *else
      *goto lightly_browned
  #Water!
    *goto wet

Now it’s doing

*choice #Glance at the red book, with frayed edges and a cracked spine? *goto todo #Glance at the green book, with padded covers? *goto todo #Glance at the book in the bag under the table, with a flesh toned leathery cover. *if (prowess >= 15) *goto todo *elseif (prowess >=10) #Glance at the blah blah blah *goto test

“prologue line 672: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.”

but if I do

*choice #Glance at the red book, with frayed edges and a cracked spine? *goto todo #Glance at the green book, with padded covers? *goto todo #Glance at the book in the bag under the table, with a flesh toned leathery cover. *if (prowess >= 15) *goto todo *elseif (prowess >=10) #Glance at the blah blah blah *goto test
“prologue line 671: unknown variable Glance”
but glance is a choice so I’m confused

When you write *choice, you’re telling Choicescript to look for a bunch of choices one indent deeper than the *choice command. So it shouldn’t be:

*choice
#Glance...

but

*choice
  #Glance...

Then you need to make sure that all the options under the choices are indented to the same level. Right now, you’ve got the option that appears if prowess is less than 15 (“Glance at the blah blah blah”) indented much deeper than the others.

Each option will start either with a #Something (if you want it to be visible under all circumstances) or with an *if, *elseif, or *else, (if you want it to be invisible under some circumstances) or *selectable_if (if you want it to be grayed out under some circumstances). The # or the * needs to be indented to the same depth for every option.

If you cut out “#Glance at the blah blah blah” and make sure you’ve got the initial indent right, your code should work fine, with three always-visible options starting in #:

*choice
   #Glance at the red book, with frayed edges and a cracked spine?
     *goto todo
   #Glance at the green book, with padded covers?
     *goto todo
   #Glance at the book in the bag under the table, with a flesh toned leathery cover.
     *if (prowess >= 15) 
       *goto todo
     *elseif (prowess >=10) 
       *goto test

The last option can take you to two different blocks of text, depending on your prowess, but the choice would be the same. Like you said a couple of posts up, “you could choose a choice regardless of your ability, but you wanted different outcomes based on it.”

But maybe you want a couple of the choices to only be visible if the character has high prowess:

*choice
   #Glance at the red book, with frayed edges and a cracked spine?
     *goto todo
   #Glance at the green book, with padded covers?
     *goto todo
   *if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
     *goto todo
   *if (prowess >= 10) #Glance at the book that's slightly less noticeable somewhere else.
     *goto todo

With this code, a character with 10 prowess will see three choices, a character with 15 prowess will see four.

You could use elseifs…

*choice
   #Glance at the red book, with frayed edges and a cracked spine?
     *goto todo
   #Glance at the green book, with padded covers?
     *goto todo
   *if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
     *goto todo
   *elseif (prowess >= 10) #Glance at the book that only moderately observant people can see.
     *goto todo

…but this will have the odd effect that a 15 prowess character will never see the fourth book (or whatever option you had in mind for “blah blah blah”), when it seems like a high-prowess character should be able to take in all the possibilities.

The *elseif could be useful if you wanted to drop a hint:

*choice
   #Glance at the red book, with frayed edges and a cracked spine?
     *goto todo
   #Glance at the green book, with padded covers?
     *goto todo
   *if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
     *goto todo
   *elseif (prowess >= 10) #I feel like there's another book somewhere around here.  If only my prowess were higher...
     *goto todo

Which is what people generally use *selectable_if for. In this example, it will tantalize the low-prowess reader with the knowledge that a book exists that she can’t actually see.

*choice
   #Glance at the red book, with frayed edges and a cracked spine?
     *goto todo
   #Glance at the green book, with padded covers?
     *goto todo
   *selectable_if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
     *goto todo

Is that at all helpful?

To see how *if/*elseif*else work in coding choices, plug the whimsical code below into CSIDE, change the value of monkey to 4 and 10, and see which choices pop up. You’ll never see more than 2 choices.

*create monkey 0

Do you want a monkey?
*choice
	#Monkey!
		*goto monkey
	*if monkey > 5
		#Lots of monkey!
			*goto monkey
	*elseif monkey > 3
		#More monkey!
			*goto monkey
	*else
		#No monkey.
			*goto monkey2
*label monkey
You have a monkey.
*finish

*label monkey2
You have no monkey.
*finish
1 Like

Using the code you provided (for the person with 15 prowess only seeing three options not four, because prowess is your level of understanding so you see the extra book but it has different effects if you’re at 10 or 15) removes the error, but that’s because it removes the option. Using the weird indents was the only way I’ve gotten the option to show, if I just use your code it does this

What does it show if you add ${prowess} just before the *choice?

It displays 10 but not the option

but if prowess is 15 it displays the option

So it’s not showing the elseif for some reason even if its terms are met but not the if terms

Apologies, I’ve given you misleading advice again! (Somebody shoot me).

It’s the opposite of my last mistake, where I told you that you could use *selectable_if with a line break, when actually it needs to be all on the same line.

Here, the problem is that *elseif won’t work on the same line – if you want to use it in a choice, you need to indent the #Option below it.

This code works in CSIDE.

*choice
  #Glance at the red book, with frayed edges and a cracked spine?
    *goto todo
  #Glance at the green book, with padded covers?
    *goto todo
  *if (prowess >= 15) 
    #Glance at the book in the bag under the table, with a flesh toned leathery cover.
      *goto todo
  *elseif (prowess >= 10) 
    #Glance at the book under the table, with a cover you could probably see better if you had higher prowess.
      *goto todo

Edit: If you’re just using an *if to determine an option, you can put it all on one line:

  *if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
      *goto todo

But if you do this, ChoiceScript won’t recognize that *if as the start of an *if/*elseif/*else cascade, so this code:

  *if (prowess >= 15) #Glance at the book in the bag under the table, with a flesh toned leathery cover.
    *goto todo
  *elseif (prowess >= 10) 
    #Glance at the blah blah blah.
      *goto todo

would never give you the “blah blah blah” option, even if your prowess is 10; it just won’t recognize the *elseif.

Sorry again for my confusion! Hope it’s encouraging that most of us are still figuring this stuff out as we go along. :slight_smile:

1 Like

Yeah, that one worked! Thanks for the help.
I switched programs halfway through coding last night so I’m still getting used to the interface and the way it handles indents.

I know it’s a little late to reply to this with a different question but ;

How do you set up a fake choice so that, say you have four options,

Option A displays its own set of text, and shows all four options still but now Option A cannot be reselected so you click option B and it displays its text, and now both options can’t be reselected and so on? That’s not to say it has to be in an order, but you could select one of the four and it couldn’t be reselected but the other three could until you did all of them

*hide_reuse <- this would hide any choice made prior.

That hides the options if they loop to the same page, so how do I get the text to change from

Blah Blah Blah group 1

to

Blah Blah Blah group X

while staying on the same page?

*Figured it out, I wanted a fake_choice, but now it’s saying my indents are wrong

*fake_choice #Choice 1 Blah Blah Blah #Choice 2 Brah Brah Brah #Choice 3 Blah Blah Blah *goto todo

gives a “expecting indent 0 was 3” after I click Choice 1 (the only one that shows)
If I take out the indent it still only shows Choice 1 but clicking it then says “was expecting #choice

I think this is what you’re looking for:

*hide_reuse *label loopStart *choice #Choice 1 *goto loopStart #Choice 2 *goto loopStart #Choice 3 *goto loopStart #Choice 4 *goto loopStart #Stop Choosing *goto continue *label continue

How do I get that to do the extra dialogue thing? That’s why I was using fake choices.