Name choice

Hi I'm struggling how to add a variable for a choice of two names and have it set as one of them throughout the story. I want it so when they click on a gender of either male or female it sets a name automatically for them throughout the story. Thus I can make the story more compact and easier. I'm very new into all this and I've been trying to get it to work with "IF" statements but I dunno if I'm doing it correctly.


Here's how I've done it in other games. I'm also showing how you can add gender-based words to permit the game to flow better...

[[test]]:

Select your gender:

[[male]] [[female]]

[[male]]:

@set name=Jack
@set gender=male
@set hisher=his

Your name is now {name}. Welcome to your [[adventure]].

[[female]]:

@set name=Jill
@set gender=female
@set hisher=her

Your name is now {name}. Welcome to your [[adventure]].

[[adventure]]:

So one day, {name} was walking through the woods in {hisher} {gender} sort of way...

Also, if you want to do this with IFs (you mentioned you were having problems with it) you could do the same thing this way:

[[test]]:

Select your gender:

[[male]] [[female]]

[[male]]:

@set name=Jack
@set gender=male
@set hisher=his

Your name is now {name}. Welcome to your [[adventure]].

[[female]]:

@set name=Jill
@set gender=female
@set hisher=her

Your name is now {name}. Welcome to your [[adventure]].

[[adventure]]:

So one day, {name} was walking through the woods in
{if gender=male:his male}
{else:her female}
sort of way...

This has helped me so much thank you I've been stuck on this all day trying to figure out a way.


No problem. Every time you learn something, it gets easier!


Ok I ran into another problem... I have the name set and what not however when I use {name} during a sentence it appears as the name "null" even though it is AFTER the @set name


This is the code I'm using. I tweaked your code a bit as I didn't need some of it

EDIT: I saw what I did wrong and I will keep the code up for others to see. I can't have two links of the same it seems.


Are you [[male]] or are you [[female]] ?


[[male]]:

@set name=Darfer
@set gender=male
@set hisher=his


[[female]]:

@set name=Lily
@set gender=female
@set hisher=her

[[male]]:
Your choice has been recorded.

[[Start]](Go)

[[female]]:
Your choice has been recorded.

[[Start]](Go)

[[Go]]:

You wake up to your Mother's shouting.

Your Mother: "Hey, {name} wake up! It's time for you to go to your new school."

Yeah, you get trapped in [[male]] and [[female]]. Welcome to squiffy :)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums