Need help coding in CSIDE

Hi, everyone! I need help with coding gender/gender variables in CSIDE. Currently, I’ve searched for people having the same issues as me both in here and on Reddit, I also looked up a few tutorials in Youtube and tried the combination of variables I saw others using, but none worked.

I’ve been trying to code gender like this;

*create gender “male”

*set he “he”

*create gender “female”

*set she “she”

And the warnings that appears to me are:

line 5 of startup: Invalid create. gender was previously created on line 4

And

line 13 of startup. Invalid indent? Expected an #option here, not *set

Am I dumb? I’ve been trying every combination I see but none work. I use CSIDE in the desktop version, too! I appreciate any help.

*create gender “male”
*set he “he”
*set him “him”
*create gender “female”
*create she “she”
*create her “her”
*create gender “nonbinary”
*set they “they”
*set them “them”
(Other combinations don’t work either, the warnings I put above always appear.)

Once you use

*create gender “male”

Then gender has been created as a variable and you’re not supposed to create it again. Instead, you should modify the value of the variable with the set command.

Try this:

*create gender "unknown"
*create he " "
*create him " "

When the player declares themselves as male

*set gender "male"
*set he "he"
*set him "him"

Or if female

*set gender "female"
*set he "she"
*set him "her"

And so on…

Ah, I see your logic here!

You’re trying to create various versions of what the variables are. So you want to set up everything for what a male character would be, and then next you want to set everything up for what a female character would be.

The way it works in ChoiceScript games is that these are defined based on the player’s choices as they play.

First, in startup, create all of your variables.

*create gender ""
*create they ""
*create them ""
*create their ""
*create theirs ""

You can’t break up *create with other commands; gotta lump them all together at the top of startup.

Later on, present a choice to the player with what gender they want, and you can set the different genders there.

*fake_choice
  # Male
    *set gender "male"
    *set they "he"
    *set them "him"
    *set their "his"
    *set theirs "his"
  # Female
    *set gender "female"
    *set they "she"
    *set them "her"
    *set their "her"
    *set theirs "hers"
(etc)

One thing I do so I don’t have to hunt around is to add comments in startup for the different ways I’ll use a variable. You can stick comments between *create functions, it’s fine.

*create gender ""
*create they ""
*create them ""
*create their ""
*create theirs ""

*comment Male: he/him/his/his
*comment Female: she/her/her/hers
*comment Ploingo: plee/plim/ploer/ploers

*create another_variable ""

*comment function of the variable

*create etc_etc_etc ""

*comment etc ...

That way you still feel as though you’re collecting and defining everything right at the top.

2 Likes

Basically as the two early replies have stated, you are supposed to leave the variable blank and then change it later in the chapter or whatever. You are trying to force the code to be two things at once, when it can’t.

The solutions the others have provided above will work fine. If you want a more reusable approach (in case you have multiple characters that have selectable genders), you can check out this post I made a few years ago.

Efficient solution for managing pronouns + easy support for custom pronouns - Game Development / ChoiceScript Help - Choice of Games Forum

My solution requires more technical knowledge (arrays for example), but after you get the hang of it, you can reuse this solution in all your stories without worrying that you forgot to set a variable somewhere.

Thank you so much!!!

1 Like

Ah, I understand now. Thank you so much!!! You and the others helped me immensely.

It makes sense! I’ll keep that in mind. Thank you!

1 Like

Thank you a lot! I’ll definitely check it out.

Did it work?

Hello! Yes, it worked :blush: I playtested it a bunch of times and everything’s working, it made me sooo happy. Thanks for the help once again!!

1 Like