Name choice error

I’m having trouble with the character being able to choose their name.

This is what i have written there:

*label name
*choice
 #Jacob
 #John
 #Jonathan
 #Jack
 #Henry
*input_text name
 #Wait, these are not my names
 
  Your name is ${name}, is that right?
*choice
 #Yes
 #Wait, no it's not.
*goto name

My error looks like this:
startup line 34: Expected choice body

*choice
   #Jacob
      *set name "Jacob"

Repeat this kind of structure for every options

But i want the character to write their name down and select it, if you know what i mean.

Well, if you want to give the player a “create my own name,” you just need to add a separate option

   #I want my own name
      *input_text name
2 Likes

Then you don’t need the choice statement. Just print something to tell the player what they’re doing and follow it with the input statement.

Enter name:
*input_text name

The choice statement prints a list of options, each of which has to be followed by some text or an instruction.

1 Like

#Wait, these are not my names
*input_text name
Works.

Doesn’t work
*goto is
*label is
Your name is ${name}, is that right?
*choice
#Yes
#Wait, no it’s not.
*goto name
Error: Expected choice body.

Just like the previous one, you need some rando-bunch of text below the option

#option
   rando-bunch of text

CScript doesn’t like “empty” choices.

But it wants a choice after i put in *goto name … Why?

Because you put it back into the choice.
It doesn’t really matter, IMO. The player can always pick the “create my name” option again.

1 Like
Ok, and what is that?
*create name "Jacob"
*create name "John"
*create name "Jonathan"
*create name "Jack"
*create name "Henry"

(This is at the beginning of startup)

These are the choices:
#Jacob
  *set name Jacob
 #John
  *set name John
 #Jonathan
  *set name Jonathan
 #Jack
  *set name Jack
 #Henry
  *set name Henry

And this is the error:
startup line 35: Non-existent variable ‘jacob’

You can click the preformatted text button to put your code into, so we can see if there are any issues with spacing.

It’s the button that looks like this:

</>
1 Like

Ok yeah, you only need to create the name variable one time like this:

*create name ""

You can also put in a stand-in name just for now:

*create name "Default"

Because it will change when you set the name.
When you change a variable that you created with quotations, like the name variable, whatever you set it to also has to be in quotations. So, you’ll want to do…

*set name "Jacob"

And so on…

Because if you have *set name Jacob without quotes that means it’s trying to look for a variable called Jacob

1 Like

Version for idiots, please.

I mean, i already did that, i did *create name "Jacob" and then in the choice *set name Jacob So why is it telling me that the variable doesn’t exist?

Because Jacob is a variable and "Jacob" is a string.

And how do i fix that? Like i said, version for idiots, please.

Whenever you do *set name
You need to have quotes around the name, like *set name "Jacob"

1 Like
*label name
*choice
   #Jacob
      *set name "Jacob"
      *goto is
   #John
      *set name "John"
      *goto is
   #Jonathan
      *set name "Jonathan"
      *goto is
   #Jack
      *set name "Jack"
      *goto is
   #Henry
      *set name "Henry"
      *goto is
   #Wait, these are not my names
      *goto name_input

*label name_input
Then what's your name?
*input_text name
*goto is

*label is
Your name is ${name}, is that right?
*choice
   #Yes
      *goto next
   #Wait, no it’s not.
      *goto name_input

There you go

3 Likes

Since when did gods exist?

I could show you how to make a name-check subroutine scene and put it in there if you like?