"startup line 74: expected choice body"


#1

so… I have written the first chapter of my game but when playing it, I get this error message:

"startup line 74: expected choice body."
It's to do with this bit of script I have written:
All you know is that you're a:
*choice
  #Male
*set gender "male"
  *goto First_name_male
  #Female
*set gender "female"
  *goto_first_name_male

It’s the *set lines that are causing the error but as I am pretty new to choicescript, I don’t know why.

thanks in advance for your help.


#2

Just to be sure, are you indenting properly?

*choice
    #Male
        *set gender "male"
        *goto First_name_male
    #Female
        *set gender "female"
        *goto_first_name_male

(Just so you know, you can use the </> button to post code properly.)


#3

@Addicted do you mind putting < pre > < /pre > without all the spaces and your code between the two >< of the pre’s? This will allow us to properly see how your code is spaced out. As of now I would simply say you need to tab those choices.

Have you created gender in your startup page? and create a male and female for it?

Ah wait I think I see the problem, in your last line *goto_first_name_male that first underscore shouldn’t be there. Should be *goto first_name_male let me know if that solved your problem.

@seabean well you’re fast >.>


@addicted so it should look something like this if you’re doing it properly.

*choice
    #Male
        *set gender "male"
        *goto First_name_male
    #Female
        *set gender "female"
        *goto first_name_male 

If this doesn’t work make sure that your variables actually exist, including your labels.


#4

I was about to ask that too. @addicted whenever you’re pasting code on here be sure to select the text you pasted and use the “preformated text” option.


#5

Lol, yep. :stuck_out_tongue:

I just noticed that. Assuming your indenting is right, getting rid of the underscore could fix the issue!


#6

I see three possible errors:
Indents
Using #
The space on the female option of the *goto

All you know is that you're a:
*choice
     #Male
          *set gender "male"
          *goto First_name_male
     #Female
          *set gender "female"
          *goto First_name_male

#7

yeah sorry about that. I have used indentation when writing but I didn’t know how to write it on here.
as for the problem though… It’s saying that the problem is to do with the “*set”. I have created male and female labels so I don’t know why it’s saying that that’s an error.
Just to let you know, I haven’t indented the “*set” as when I did at first, it says that the indentation shouldn’t be there; so I removed it.


#8

@Addicted

You need to indent the set. @Seabean has shown the proper indentation.


#9

Well for indentation, it’s as @Arcania and @Lucid show. It always goes

*choice
>#male
>>*set gender "male"
>>*goto first_name_male

#10

Also, I’d just get rid of the capitalization in “First_name_male”, it can cause issues.

 *choice
      #Male
         *set gender "male"
         *goto first_name_male
      #Female
         *set gender "female"
         *goto first_name_female

The *set command needs to be indented along with the *goto as others have shown.


#11

Yeah. it’s worked now. It looks like I wasn’t doing enough indentation. Thanks all for your help.


#12

If the moderators don’t mind I would like to ask another question here. Although it is not to do with this problem, I don’t want to clog up the forum.

How when writing in choice script do you get it to put in “she, her etc” when writing about a female and “him, his etc” when talking about a male? yeah… I know this is pretty basic stuff but although I thought I had it, it turns out I haven’t.

Sorry for being a constant pest… :slight_smile:


#13
*choice
    #Male
        *set gender "male"
        *set hisher "his"
        *set heshe "he"
        *set himher "him"
        *set himherself "himself"
    #Female
        *set gender "female"
        *set hisher "her"
        *set heshe "she"
        *set himher "her"
        *set himherself "herself"

And so on. you can name the variables whatever you like, and add more of them as well. :smile:

These variables will basically work as pronouns and you’d define them in the text as such: {heshe} can take care of {himherself}.

If you aren’t familiar with displaying variables, take a look at this page: http://choicescriptdev.wikia.com/wiki/Displaying_variables


#14

We don’t mind, believe me. We’re all about helping out!

*create gender ""
*create his ""
*create him ""
*create he ""
*create mr ""
*create boy ""

Choose your gender

    *fake_choice
        #Man
            *set gender "man"
            *set his "his"
            *set him "him"
            *set he "he"
            *set mr "Mr"
            *set boy "boy"
        #Woman
            *set gender "woman"
            *set his "hers"
            *set him "her"
            *set he "she"
            *set mr "Ms"
            *set boy "girl"
            
    Well, ${he}'s a fine ${boy}.

#15

@Addicted I did a tutorial on this A Basic Tutorial on Name, Relationship and Gender Variables

Reaperoa also explains it in his guide.


#16
Hi there,

I have another question to ask you guys…

How do you get choicescript to only allow someone to use a particular item only if they have picked it up earlier in the game?

Here is something I have made up just for the mean time but it still includes everything that I have done in my actual game (including exact indentation).

At the start of the game:
*create item_one ""

*label demonstration_one

You walk in to a room and spot a pen lying on a table what do you do?
  #Pick it up
   *set item_one "pen"
   *goto write_letter
  #Leave the pen where it is.
   *goto write_letter

*label write_letter

You decide to write a letter. With what writing implimment do you do so?
  #pen
   *if item_one = "pen"
   You pick up the pen and start writing your letter.
*goto next_section
  #You don't have a writing implimment to write with.
   *goto next_section

And as always, I am ever greatful for the help you provide.
:smile:

#17

@Addicted Please follow the previous instructions I gave in order to properly format your code.


#18

That’s in the advanced section of my guide. The short is:

*create has_pen false

*if you get the pen at some point <-- your first choice
  *set has_pen true

*choice
  *if (has_pen) #Use the pen
    You used the pen
    *finish
  #Other options.

Does that make sense?

(Also, you need to highlight the code before you hit the </> button.)


#19

Yeah thanks. It works