Permission Denied

Oh I see what your problem is, it’s not the one I thought but it’s just you need to add choice everytime your going to a different line

Okay I sent it back should work

Got it. Now I just don’t know how to do something simple…again. I want to be able let the player choose if they’re male or female, and I want to keep their choice constant throughout the game. How would I set up the variabe(s) for that?

put a stat called ‘gender’ in your mygame.js



Male, or Female?

*fake_choice
  #male
    *set gender "male"
  #female
    *set gender "female"


It tells me that ‘set_gender’ is nonexistant, and I’m not putting a _ between the two words

XD dont put a _ remove that

@2Ton

He said he isn’t doing the “_”.

That means it must be in your game somewhere id use search in notepad++ and type that in and look for wherever it’s at so you can fix it

@computermouse123 – did you create “gender” as a variable in mygame.js before you ran your game with the “set gender” line? e.g.

    ,gender: "none so far"

In general, there are three types of variables in ChoiceScript - string (where it shows a string of characters, like “male” or “George”), number (0, 13, 204, etc), or Boolean (true/false). @2Ton is suggesting that you create gender as a string, with either “female” or “male” as the values. That should work just fine once you’ve figured out, but it does mean that you’ll need to write out

*if gender = "female"

or

*if gender = "male"

every time you want gender to affect something in your game.

We recently had a thread on this – forget which one it was, or I’d link to it – and the consensus was that it’s generally better to have gender as a Boolean. That would mean that when you create the stat in mygame.js, it would look like:

    ,female: true

you’d then write

*set female false

in whatever part of your game where a reader can choose to be male, and you’d only need to write

*if female

(which is shorthand for “if female = true”) or

*if (not)female

(which is shorthand for “if female = false”) when you want it to affect some future text. Doing it this way will let you know immediately if you’ve misspelled something… you’ll get an error message if you write

*if ffmale

whereas your game will keep running smoothly

*if gender = "ffmale"

but leave out whatever you’d actually wanted your readers to see.

Edit - I took the time to check, and the recent thread on this topic is here.

@Havenstone

In your game, if you have this set up can you just show me what it looks like? You’re giving a very detailed answer, but I’ll understand better if I see it infront of me. From what you’ve said it sounds like using a Boolean would be the best way, so if you could show what that would look like in mygame.js and in a scene with a choice that would be great.

@computermouse123, I’ll show you what my first CS game attempt looked like, if you don’t mind.

mygame.js

First Scene
(Look specifically at the gender choice. Ctrl+F “What sex”)

Ignore the writing, political incorrectness, and the unnecessary garment descriptions. I was just messing around in the beginning.

@Caddmuss

Okay, so I added ,gender: “unknown” in my myagme.js and in my choice I did *set gender “male” and on another line *set gender “female”. But when I opened the index an error came up that said Expected “]”

ummm, if there is any ]s I would get rid of them I would go to like notepad++ and look under the search file and see if there is any stray ]s anywhere to be found in mygame.js

In mygame.js, look at your Scene Navigation. Make sure there’s a closing square bracket.
It should pair with a regular parenthesis, like this ]).

That should fix that.

Edit:
Don’t delete the square brackets or parenthesis, they’re necessary coding.

@computermouse123, regarding the error you’re getting: if your mygame.js file doesn’t have square brackets before and after your scene list like this:

nav = new SceneNavigator([
	"intro"
    ,"scene1"
    ,"scene2"
    ,"ending"
    ,"death"
    
]);

it won’t work. So don’t delete all of the () business – they’re not “strays”!

OK, here’s what the gendered bit of my stats section looks like:


// Specify the default starting stats here
stats = {
    female: true
    ,femalepref: true
    ,malepref: false
    ,he: "she"
    ,him: "her"
    ,his: "her"
    ,hers: "hers"
    ,woman: "woman"
    ,milady: "milady"
    ,girl: "girl"
    ,xhe: "she"
    ,xhis: "her"
    ,xhim: "her"
    ,xmilady: "milady"
    ,xgirl: "girl"
    ,zhe: "he"
    ,zhis: "his"
    ,zhim: "him"
    ,zmilady: "milord"
    ,zgirl: "boy"
};

Ignore the ones that start with x and z for a minute. The “female: true” up top is the Boolean for what sex you are. “femalepref” and “malepref” are Boolean stats for who you’re attracted to. The first set of pronouns and labels, ending in “girl” are for “you,” the main character.

If you don’t want any NPCs to gender-flip, then that’s all you need. In my game, the choice of sex comes when your father addresses you as either…

*choice
  #"... son."
    *set female false
    *set he "he"
    *set his "his"
    *set him "him"
    *set hers "his"
    *set woman "man"
    *set girl "boy"
    *set milady "milord"
    *goto whathappened

  #"... daughter."
    *goto whathappened

(The stat values don’t need to change if you’re a daughter, because the default settings are all female).

Once we know your sex, I use “if female” and “if not(female)” later when the player is choosing things like their name, where sex gives different options:

  Your name is:
  *choice
    *if female
      #Thekla.
        *set fname "Thekla"
        *goto lastname
      #Alkyone.
        *set fname "Alkyone"
        *goto lastname
    *if not(female)
      #Iasoun.
        *set fname "Iasoun"
        *goto lastname
      #Kadmos.
        *set fname "Kadmos"
        *goto lastname

And all those pronouns and labels come in handy when NPCs talk about you. So, for example, if things go badly when you try to rescue some slaves from a magician, the magician will interrogate the slaves about who you are:

  The Theurge looks around, her eyes dangerously flat.  
  "Who is this ${woman}?"

  "That's ${milady} ${fname} ${lname}."  The hesitant response comes 
  from one of the helots who worked on your cousins' estates.

  "Don't call ${him} '${milady}'," Chirex retorts at once.  "$!{He} has 
  forfeited all right to the title.  Call ${him} Shame-Veined, for ${his} 
  treachery brings disrepute on all who share ${his} blood."

Hope that’s reasonably straightforward. :slight_smile: Now, I’ve also got a big love-interest plot that I want all players to be able to access, so that means I need gender-flippable pronouns for several NPCs as well.

So the second list of pronouns in mygame.js with “x” in front are for flippable NPCs of your preferred sex (or, if you’re bi, the first sex you report being attracted to). The third set with “z” in front are for flippable NPCs from the sex you don’t find attractive (or, if bi, the second sex you report being attracted to).

The first chance you get to find someone attractive looks like this:

  You were surprised to feel an immediate pang of attraction to the
   bold young helot.
  *choice
    #He was small and lean, but his easy smile and thoughtful, fearless
    demeanor spoke of deeper strengths.
      *set femalepref false
      *set malepref true
      *set xhe "he"
      *set xhis "his"
      *set xhim "him"
      *set xmilady "milord"
      *set xgirl "boy"
      *set zhe "she"
      *set zhis "her"
      *set zhim "her"
      *set zgirl "girl"
      *set zmilady "milady"
      *goto sermon
    #She was short and sunburned from field work, but her warm
    demeanor and boldness were a compelling combination.
      *goto sermon

(Again, the values only need to change if you choose to be attracted to a man, because the defaults are all set the other way).

From that point on, the person you’re attracted to gets ${xhe} and ${xhis} etc. for all his/her pronouns.

At a later point, there’s a further choice where you can confirm that your character is attracted to the “zhe” sex too, at which point “femalepref” and “malepref” would both be set to true. That choice looks like this:

$!{Zhis} infatuation is as clear as if ${zhe} had dropped
to one knee to confess it.  It seems you'll need to deal with...
  *choice
  *if femalepref
    #Simon's disappointment when he realizes you aren't attracted to men.
      It's a shame, but you simply couldn't be attracted to Simon if
      you tried.  Hopefully his passion for your cause will survive a little
      heartbreak.
      *goto anarchy_check
  *if femalepref
    #the temptation of an attractive young nobleman who plainly admires you.
      *set malepref true
      *goto seduction

Clear as mud?

Just as an addendum to what @Havenstone said about gender as a boolean variable, I personally have two, a male set as a boolean, and female set as a boolean. Then, when you want some small changes to shows up depending on gender, rather than:


This shows up for everyone.
*if male
  This shows up for men.
*if male = false
  This shows up for women.

You can instead use:


This shows up for everyone.
*if male
  This shows up for men.
*if female
  This shows up for women.

@Reaperoa, that’s brilliant. And so much easier to read/write than *if gender=“male”.

Would it be too much trouble to send one of you the file? I’m still trying to get used to ChoiceScript and coding and such, and even though parts of it make sense it’s a little overwhelming.

@computermouse123, if you wouldn’t mind being my guinea pig, would you do this and just forum mail me that link, I’ll peruse the whole of it :smiley:

No problem, I’m sure I can figure that out ^^;

But yeah, if you could set up all the gender settings in the files that would be great.

@Caddmuss

Okay, Dropbox only allows me to put in seperate files, not entire folders. It might be easier just to upload files such as mygame.js, the gender selection “scene”, etc.