String type variables (text)

Hello, I would like to ask for any advice about using string type variables - those which store text in in. We use then while naming the character, but is there any way to give value to the variable in the code, instead of letting user input it? The user input is great for customs, but sometimes I would really use a variable which I set up myself, because it would make the code much cleaner. For example for pronouns, If I let the player choose gender, I would set pronouns and then use them in the code, like this:

NARRATOR
Do you want to play as a man or a woman?
choice (gender)
“Man” {
[nom_pron] = “he”
[akuz_pron] = “him”
[pos_pron] = “his”
}
“Woman” {
[nom_pron] = “she”
[akuz_pron] = “her”
[pos_pron] = “her”
}

And in the code
CHARACTER1
I don think [nom_pron] would like the idea of you eating [pos_pron] sandwich. I bet it’ll upset [akuz_pron].

instead of
if (gender = “Man”)
{
CHARACTER1
I don think he would like the idea of you eating his sandwich. I bet it’ll upset him.
}
else
{
CHARACTER1
I don think she would like the idea of you eating her sandwich. I bet it’ll upset her.
}

I know here it doesn’t make big difference, but in the story it would lead to basically having to script the whole story twice, changing just the pronouns, which is some real mess. And there is lot of more use of this than just for pronouns.
So, if you know any way to give value to a variable, please let me know, Thank you.

2 Likes

this option exists for choice name

so if you will make choice

NARR
What do you want to eat?
choice (choice_food)
"banana"{
}puding"{
}

You can then later in dialogies use:

NARR
So here is your [choice_food]!

and it will display in the dialogue banana or puding based on readers choice.

So if you will make 3 separate choices named choices nom_pron, akuz_pron and pos_pron, you then can use it exactly the way you intended.

3 Likes

Wow you can really do that??? :exploding_head:

@nuha.episode
This will make providing name choice to your readers easier! Check this out!

2 Likes

Alternatively, the closest I could think of to not double code the script is to create characters: NOMPRON, AKUZPRON, POSPRON as the value, and let readers input their pronouns with typed-in choices.

label gender

input What is your pronoun? | What is your pronoun? He/She | Done (NOMPRON)

if (NOMPRON is “He”){
}
elif (NOMPRON is “She”){
}
else{
NARRATOR
Please try again.
goto gender
}

Then ask the readers to input the rest of the pronouns for AKUZPRON (him/her) and POSPRON (his/hers). So that whenever you need to insert the reader’s pronoun in the dialogues, you just have to code in the script name (for NOMPRON, AKUZPRON or POSPRON).

Example the script name I have for NOMPRON is NOMPRON1:
NARR
[NOMPRON1] is blah blah blah.

The result will be:
He is blah blah blah ← For those readers who input their pronouns as “He”
She is blah blah blah ← For those readers who input their pronouns as “She”

1 Like

yep.:grinning:

2 Likes

omg, thank you so much!

1 Like

That is amazing! But is possible to carry these variables to other chapters?

I was thinking about this too, but wanted to find better solution. But I thought about another one - is it possible to change display name of a character in the code? if yes, it would help a lot. I saw some stories where the name got changed like that.

yes named choices are remembered similary as gains so you can use it throug chapters

1 Like

for changing name is usualy used duplicate character. You cant change display name by coding

I tried to use the @character becomes @anothercharacter, but it didn’t work completely. If I wanted to use the name [character] is still displayed character, not anothercharacter.

If you want to change the name to [anothercharacter] then you should go the the character creator page of @character and change the display name to [anothercharacter]. Because the becomes command only duplicates the appearance and that also happens only for the characters of the same gender.

as said above change the other character display name

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.