I'm a little stuck on coding - I need help with character building!

My coding sounds something like this

What did you do as a child?
#I spent time with my friends
#I read loads of books
#I played games
#I went out shopping
#I played basketball

What I want to do is make some of the options only acssessed by male players and some only by female players. Not trying to be sexist at all here, but how do I diffrentiate?
If I wanted shopping to be girl only, I tried to write
*if (gender) girl #I went out shopping
*if (gender) boy #I played basketball

*if (girl) #I went out shopping
*if (boy) #I played basketball
But they didn’t work, so what should I write?

*if (gender = “girl”) #I went crocodile hunting
*if (gender = “boy”) #I built a robot

you can do it like JimD suggested an alternate way is to create a variable for male and another for female and set them in mygame.js as false then set them true when they pick genders. then this will work

*if (male) #male only choice
*if (female) #female only choice

Would this be ok?

on mygame.js under
// Specify the default starting stats here

stats = {
something else: “robot”
,male: false
,female: false

And then when they choose female
I write: *set female true

@JimD thanks for your help, but it didn’t work so I’m going to go for the variable thing :slight_smile:

Yeah then

*if (female) #choice

should work

@kkuomi BTW, having both a female variable and a male variable isn’t necessary unless you’re planning to allow characters who are neither or both. Instead of checking two variables, you can just check one (ie. female and not female -or- male and not male). Instead of two *if’s you can also use an *if and an *else.


*if (female) #ChoiceFemale
*else #ChoiceMale


*if not (female) #ChoiceMale

If you always strive to keep the logic as simple as possible it will over the long haul reduce the amount of time you spend stomping bugs.


I need to point out that when I started using

*if not (variable)

While they game worked fine online, two people playing on the Kindle fire were getting errors.

I don’t believe *if not has ever been valid CS. Rather,
*if (female = false)


Pity. Unfortunately I don’t have a Kindle Fire to test it out. Is @dfabulich aware of this problem with not on the Fire? ie. Do you know if it’s been reported?


I’m not sure, I removed the ‘not’ and it worked so I personally didn’t report it.

@jasonstevanhill It’s in the Advanced Choicescript Guide:

in the Advanced *if statements section under And/or/not . The example given is: not(strength > 70).

Hmm…I just noticed that there is no space between the not and the opening parenthesis in the example. For the code I’ve tested in Firefox, I’ve been successfully using it with a space in between.

Well it’s likely similar to female=false working as well as female = false - :smiley:

@CJW True, yet I haven’t heard of any reports of either female=false or female = false blowing up on the Kindle Fire. So I dunno. :-??