Code help for heterochromial eyes

hello hello. I would like to give players an option to choose their eye colors and while I have a set list for regular eye colors: amber, green, brown, hazel, gray; if the player chooses the heterochromial eyes option, how would I be able to get them to write in their option for both left and right and have it pop up in the stats screen under eye color?

note: I can see ppl are gonna be like “seems like a waste if you won’t give it a moment to shine in game”, but I have a character who has heterochromia and I would like for player and character to have a moment to shine on the people who do have heterochomia! let it be an option every one in awhile:)

1 Like

Based on the questions you have asked in the past days, you should be equiped to tackle this problem. I feel like giving you the answer will hinder your development as a coder.

I do however acknowledge that “thinking in code” is a skill that has a steep learning curve. I want to hear what your thought process is in abstracting the problem so I can guide you in having the corect frame of mind to tackle this problem.

After you have the right abstraction in mind, I want you to write the code yourself and if you struggle with it, share it here.

But first, tell us how you approached this problem from a logical flow point of view and where did you get stuck?

3 Likes

love that you’re challenging me, good idea. ok, so (I have this all on one page now, one step forward:) I have:

*fake_choice 
     #amber irises 
          *set eyecolor "amber" 
(I have other choices here, but skipping to my point of interest)
     #heterochomial eyes
          *goto heterochromia

*label heterochromia

now, I want to add the text box to enter your own text

What is the color of your right eye?
*imput_text eyecolor
*go to heterochromia2

*label heterochromia2
What is the color of your left eye?
*imput_text eyecolor 

should I make a second *create eyecolor2 on startup because I already have *create eyecolor " "?

Before you write any code, think about what you are trying to acheive, where you are currently and how to get beteen those two points.

Right now you have functional code for same color for both eyes I assume and you want to pick each color individually.

What would you need to change and where in order to support this feature (heterochromial eyes)? I’m asking in a more abstract sense, not refering to code yet. If you were a player, what would the game have to show you to convince you that this feature is there?

I guess it wouldn’t show that this feature is there. there’s nothing quite leading up to it, there’s no big reveal. I would like to have it there for people who do have differences. I wish to do this for skin tone too—for vitiligo. because its not talked about. we’re not perfect creatures, why should we gatekeep people who are “other”? I may not have heterochomia or vitiligo, but I sure as hell know there are people out there who do. somebody is out there reading the same “blue eyes, brown hair” all over again and its redundant and sad. give people a chance to see themselves in media and get excited over someone just like them even if its a character. representation is what I’m aiming for.

edit: even if all I was doing this for was just for fun customization; who cares? its my book, I just want people to be immersed and have fun. what is so wrong about that??

2 Likes

That answers the “why”, but not the “how”. I assume that you will either have a list of eye colors and at the end “eyes of different color” that will take you to a list of colors for each eye or input the color yourself.

Starting from this feature definition you can think about things like:

In how many distinct ways will I display the eye colors in the stat page?
How many variables do I need?

For starters, focus on this question, and let us know what you think:

How many variables do I need?

1 Like

You can’t do this because it will just overwrite the first colour with the second. For my game, I set eyes to “hc” and then had a choice for each of the eyes in turn. After that, you could set eye_colour to “${left_eye} and ${right_eye}” for any time it needs to come up.

1 Like

that seems like a way to do it. I was thinking on my startup to write

*create eyecolor2 " " 

and have the reader type in the eye color. would that work?

Yes, you need two variables (one for each eye, or you can use the second as a signifier that the player chose different colors for each eye and store the second color in that variable).

Next you to set their values

1 Like

You can definitely set a second eye colour that way; you just need a way to have it be mentioned in-game, e.g. ${eyecolor} @{(eyecolor2 != " ") and ${eyecolor2} |} eyes.

does this need to have a squigly bracket } towards the end? or leave it with the closed parenthesis at the end?

Oh, the multireplace works like this:
@{(variable check) text if true | text if false }
In this case, the variable check is if eyecolor2 is not " ", i.e. if the player has input their own value. If they have, then it reads “and ${eyecolor2}”, and if not, it reads the stuff between the | and the }, i.e. nothing. It’s basically equivalent to:

${eyecolor} 
*if eyecolor2 != " "
    and ${eyecolor2}
eyes.

(Edit: if you do use it, don’t forget the pipe | between the two texts, which is usually hidden somewhere around the edges of your keyboard.)

2 Likes

awesome the multire thingy seems lit!! thank you for helping me out!! this was insanely helpful. I still haven’t got a hold on a 2nd variable and the @ symbol with squigglys but I have made a note in my journal. but that’s just par for the course as you go. thank u again