How to use a 'word' multiple times without it being invalid (for already having it)

Dare to ask I suppose. I have been lurking for a while now, and on and off started writing. However the code often scares me off until I dare come back to give it another shot.
I am sorry if the answer is painstakingly easy to find (but I couldn’t) but what to do with repeating titles you want to fill. For example if I want to create a list of people in the stats and want it to look like:
Name: P1
Interests: XXX
Name: P2
Interests: YYY
Name: P3
Interests: ZZZ
How do I fill ‘name’/‘interests’ in multiple times without my program telling me I already created ‘name’ & ‘Interests’.
This line comes up: startup line 20: Invalid create. name was previously created on line 8

I hope I explained it well enough, like I said I still need some practice with coding (and lingo).

You have to give every Name a different variable.
For example:
player1name or short p1name
In the code you create them at the start up

every variable should be unique so the Programm can Tell the Differenzen. Also the names of the variables should be selfexplaining so that you even in a year know which variable belongs to which thing.

Yes I understand the idea that the game needs to differentiate, but that’s where I get a bit lost. Where would I write p1name, without it actually showing up like that but as ‘name:’

That’s my issue atm, sorry I feel a bit ridiculous for asking but I’ve gotten errors a few times too many by now.

Afternoon, Em

The way I would go about this is this:

So, characters A and B and C would be
*create character_a “”
*create character_b “”
*create character_c “”

The above is used if there is a difference in name based off gender, such as character_a being Avery or Anna. It would read, in the game:

*set character_a “anna”

For interests:
*create hobby1 “hiking”
*create hobby2 “dancing”
*create hobby3 “watch movies”

$!{character_a} is interested in ${hobby2}
→ Anna is interested in dancing.

There’s a whole lot of ways to go about it. On my end, I tinkered a lot and read the wiki and ghosted the forum. The above is rather simple, but it’s a starting point. This is generally how I would begin, and then I’d build up as needed. I play with ChoiceScript for the fun of it. It’s a good intellectual wonderland that gets my brain working.

4 Likes

Maybe I am doing it wrong but this is what I am ending up with. Is there any way to change character_a in game now to just ‘name’ while the program still can recognize her as character_a

afbeelding

afbeelding

These are my codes atm

So, here’s the stats in Startup

*create a_fn “willow”
*create a_ln “georgiou”
*create likes1 “drawing”
*create likes2 “daydreaming”
*create likes3 “birdnoises”
*create a_trust 100
*create a_suspicion 0

Then, in ChoiceScript Stats

Character Name: $!{a_fn} $!{a_ln}
*line_break
Personality: Artsy
*line_break
Likes: Drawing, Daydreaming, Bird Noises

*stat_chart
percent a_trust Trust
percent a_suspicion Suspicion

Part of it also changes depending on if you discover these likes of this character and then it shows up, or if its a side note. If the likes are shown after discovering, using a Boolean is my goto (IE, true/false statements)

a_fn is my way of saying “a_first_name”
I shorten it so it’s easier to code

When putting it into the game, when you have $!{a_fn}
The game automatically replaces

Also, if A’s likes aren’t discovered, it isn’t too much an issue on having a variable with it unless there are places where you have to use said likes in scripted conversations or checks, but that’s an entire different beast to tackle

That “*create” name you made (like “name_interests_1”) doesn’t need to be the name you see in the stat screen…

*create name_interests_1 " "
*set name_interests_1 "Having fun"
*stat_chart
  text name_interests_1 $!{name}s Interests

So there are three things.

  1. The “name_interests_1” which you can make for coding only (if you want), making it that you’ll never see it in the end game.

  2. The “interest” which is between the " ", and will automatically come behind the “name_interests_1” in the stat screen “text”.

  3. The third is the text behind the “text name_interests_1” which doesn’t need “_” and this third text will automatically replace the “name_interests_1”, and that’s what I meant with the fact that you can make that “name_interests_1” hidden from the finale game.

Echoing what TheChaosArchivist has said, you need to add a few things if you want to customize what appears in the stats page.

For the text stats, you can ignore *stat_chart command and straight up write them like this:

Name: ${character_a}
*line_break
Personality: ${personality_a}

… and so on. As for the number or percent stats, you add the custom word after the variable.

*stat_chart
	percent Trust_a Trust
	percent Suspicion_a Suspicion
1 Like