Trouble with player name and displaying extra content on stats screen

Hello, I’m developing my first choicescript game and it’s been a steep learning curve. I’m struggling with how to allow a character to choose their own name as well as how to display character background information on the stats screen. If you respond, noting what’s supposed to be in the startup text and what’s supposed in the stat screen text would be very helpful. Here’s what I’ve got:

Sorry for the poor quality, I dont have internet at my apartment yet and had to take pictures of the screen.

Any help is much appreciated!

Next time, you can copy your code into your comment, choose it and hit Preformatted text button.
About the name variable:
When you create or set a variable, you don’t need ${}. Do *create name "Unknown", or *create name "".
For inputting text, you just need *input_text name (see here).
I suggest giving a player a set of names in addition to player-created name, to give examples of normal names in your setting.
Example:

What is your name?
*fake_choice
	#Horacio.
		*set name "Horacio"
	#Irene.
		*set name "Irene"
	#Sara.
		*set name "Sara"
	#Summer.
		*set name "Summer"
	#Let me write down my name.
		*input_text name

I’m a little confused with your role and background variables. If your character only needs one background, use a single variable mc_background instead if several separate true/false variables:
*create mc_background "unknown" in startup;
let the player to choose a background:

What is your background?
*fake_choice
	#I am a runaway.
		*set mc_background "runaway"
	#I am a student.
		*set mc_background "student"

For displaying background in stats, you can do this:
Background: ${mc_background}
Or this:

Your background
*line_break
*if (mc_background = "student") 
	You are a bookish student.
*if (mc_background = "runaway") 
	You run away from home when you were still a baby.
*if (mc_background = "unknown") 
	It is unknown.

If you character can, for example, have more when 1 role (be both a healer and an animal handler), you need several true/false variables.
Like this:

*create animal_handler false
*create healer false

Let the MC choose a role:

What do you want to do?
*choice
	#I want to practice healing.
		*set healer true
		*goto healing_practice
	#I want to tame a wild animal.
		*set animal_handler true
		*goto tame_animal

I think someone in the comments has already explained how to display this type of variables in stats.

4 Likes

First, I would suggest you use the Choicescript IDE because it’ll show you where you’ve made an error and what kind.

Secondly, this is the correct syntax

*create name ""
*create surname""

Use ${variable} only when you have to display the value of a variable, not when you set it’s value or create it

Also, for fixing the value of variable, simple use

*set name "john"

Don’t use ${variable}

While using input, you don’t need to use the *set command. It’ll automatically store the input value in the assigned variable

Stat screen problem:
You need to check the value of the variable in the *if command to execute it’s block
For example

*if var= "true"

That’s pretty much all the problems I think

2 Likes

There are some errors in your stats screen, you want this to display information only, not to set any variables.

Have a look at this:

[b]Role:[/b]
*line_break
*if role = "handler"
    Animal Handler
*if role = "healer"
    Healer

There are lots of different ways you could do this, have a look at these two examples:

[b]Role:[/b] ${role}

or

[b]Role:[/b]
*line_break
*if role_handler = 1
    Animal Handler
*if role_healer = 1
    Healer
3 Likes

Got it! Thank you all so much, I was scratching my head about this for days.

1 Like