Getting Started: Various Questions

I had some various questions

  1. I’m not sure how to put in the code for the player’s name I’ve tried putting in as ${name} but when I tried it the game didn’t seem to acknowledge the option.
    2.For my stats one of them is showing friendship stats for various characters but for some of the options I want the stats to increase for individual characters and was wondering what do I put in so the game knows which character’s stat to increase
  2. In my game I want the player to be able to pick their boyfriend and wanted to know how to code the game
  3. I want the stats for my game to start at a specific value and was wondering and was wondering how to do that

Thanks for the help and hope my questions make sense.

1 Like

I recommend exploring the below thread. Work through the tutorials–there’s lots of information and examples. And welcome to the forums!

1 Like

@amethyst I second what @Gower noted: starting with the tutorials will really help you get a stronger grasp of coding ChoiceScript! In case you’re still struggling for your answers after checking it out, though, almost all of your questions can be answered with the *create command or *set command.

You create variables in the startup.txt file of your game. For your player’s name or for friendship stats, it would look like this:

*create name "?"
*create Bobfriendship 0
*create Alicefriendship 0
*create boyfriend "?"

You need to be sure you assign a value to any variable you set: for something like a name, which would be a text or “string” variable, you put quotation marks after the variable you create (see above); for a stat that will be tracked using numbers, you put a number. (You can change the zeroes above to any number that you want to start at, as you say in Question 3.)

When you’re writing the game, you then proceed to *set your variables to change them. For example, when you create the name in the startup file, it’s just “?” But in a scene file, you’d write,

Choose your name.
*choice
     #Bob.
      *set name "Bob"

Whenever you want to refer to the name you’ve set later on in the game, that’s when you would use $!{name}, E.g.:

"Hey, how are you doing, $!{name}?"

Which will appear as whatever variable you’ve set as your name. Hope that helps!

2 Likes

Yes it’s very helpful, thanks for both your posts

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the @moderators.