Gender/Sexuality Randomization

Hey, I’m a bit new to coding games so please correct any mistakes I’m sure I’m making haha. (And please lmk if I’ve formatted this post wrong!)

I’ve put a bit into the startup text here after the player selects their gender and the gender(s) they want to be able to romance.

*fake_choice
	#Men.
		*if gender="male"
			*set orientation "gay"
		*if gender="female"
			*set orientation "straight"
	
	#Women.
		*if gender="female"
			*set orientation "lesbian"
		*if gender="male"
			*set orientation "straight"
			
	#Men and Women
		*set orientation "bisexual"
		
	#I'm not interested in romance.
		*set orientation "asexual"

And then we have this…

*if (gender="male") and (orientation="gay")
	*gosub lover_male
		
*if (gender="female") and (orientation="straight")
	*gosub lover_male
	
*if (gender="male") and (orientation="straight")
	*gosub lover_female

*if (gender="female") and (orientation="lesbian")
	*gosub lover_female 

*if (orientation="bisexual") or (orientation="asexual")
	*gosub gender_random

I’m essentially trying to have straight male/lesbian MCs get the option to have all ROs be female (and I’ve followed with a code under *label lover_female that sets the names and etc of ROs to female, and the same for men with gay male/straight female MCs). And then a bi or ace MC will have the RO genders randomized. I’ve coded in dice for that option, but the issue is that single-gender-attracted MCs are getting randomized RO genders as well. Like a straight male MC should be getting the ROs all female, but they’re about half male and half female. I’m not sure what I’m doing wrong here, so help is much appreciated.

Could you post the code in the lover_female, lover_male and gender_random subroutines? I wonder if there’s something there that isn’t setting the way you’re after.

1 Like
*label lover_male
*set hazel "Hugo"
*set h_him "him"
*set h_his "his"
*set h_he "he"
*set h_man "man"
*set freya "Freddie"
*set f_him "him"
*set f_his "his"
*set f_he "he"
*set f_man "man"
*set grace "Gavin"
*set g_him "him"
*set g_his "his"
*set g_he "he"
*set g_man "man"
*set ciara "Ciar"
*set c_him "him"
*set c_his "his"
*set c_he "he"
*set c_man "man" 
*set c_prince "prince"
*label lover_female
*set hazel "Hazel"
*set h_him "her"
*set h_his "her"
*set h_he "she"
*set h_man "woman"
*set freya "Freya"
*set f_him "her"
*set f_his "her"
*set f_he "she"
*set f_man "woman"
*set grace "Grace"
*set g_him "her"
*set g_his "her"
*set g_he "she"
*set g_man "woman"
*set ciara "Ciara"
*set c_him "her"
*set c_his "her"
*set c_he "she"
*set c_man "woman"	
*set c_prince "princess"
*label gender_random
*rand dice 1 10
*if dice >=6
	*set hazel "Hugo"
	*set h_him "him"
	*set h_his "his"
	*set h_he "he"
	*set h_man "man"
*if dice <=5
	*set hazel "Hazel"
	*set h_him "her"
	*set h_his "her"
	*set h_he "she"
	*set h_man "woman"
	*set numberfemale +1
	
*rand dice 1 10
*if dice >=6
	*set freya "Freddie"
	*set f_him "him"
	*set f_his "his"
	*set f_he "he"
	*set f_man "man"
*if dice <=5
	*set freya "Freya"
	*set f_him "her"
	*set f_his "her"
	*set f_he "she"
	*set f_man "woman"
	*set numberfemale +1
	
*if numberfemale >=2
	*set grace "Gavin"
	*set g_him "him"
	*set g_his "his"
	*set g_he "he"
	*set g_man "man"
*if numberfemale < 2
	*set grace "Grace"
	*set g_him "her"
	*set g_his "her"
	*set g_he "she"
	*set g_man "woman"
	
*if numberfemale >=2
	*set ciara "Ciar"
	*set c_him "him"
	*set c_his "his"
	*set c_he "he"
	*set c_man "man" 
*if numberfemale < 2
	*set ciara "Ciara"
	*set c_him "her"
	*set c_his "her"
	*set c_he "she"
	*set c_man "woman"

Here it is!

1 Like

I think you need a goto “scene name” after lover_male and lover_female.

Do you mean I insert *goto sceneone after each of the label blocks? It gave me a bad label error when I did that and I’m unsure why

1 Like

Yes, it looks to me that it’s running all three subroutines, which will happen if there’s no *goto at the end of each one, as @Urban said. So when it gets to the end of the male one, it moves straight into the female, then into the gender_random. This would explain the issue you’re having.

I’m not sure why you’d get a bad label error though, provided the label you’re sending the player to does actually exist later. It should just be a case of adding *goto sceneone (not indented) at the end of each block.

1 Like

I’m guessing these blocks of code come one after the other. So even if you call *goto lover_male, it’s going to run through the others.

What you need is a sub-routine. Use the comand *gosub instead of *goto and make sure to include a *return command at the end of each routine.

Alternatively, you can use a *goto at the end of each of these routines to redirect the flow of the engine before it goes over the other routines.

1 Like

Do you have return statements after each subroutine?

I think I’m using subroutines already, is this what you mean?

*if (gender="male") and (orientation="gay")
	*gosub lover_male

When I put *return at the end of each block (so after *set c_prince “prince”, for one) it returns an error of “invalid return; we’ve already returned from the last gosub”.

The bad label error is confusing me. The first scene file is called “onecarnival.txt”, and when I put “*goto onecarnival” after *set c_prince “prince” and so on it returns this error message. Am I not putting it in the right place? I’m assuming by “block” you guys mean everything that comes after the label.

That’s right.

I’m only guessing here, but I think you’re not controlling the flow. After it returns, your code keeps running until it hits the same lines again.

  • Make sure that after you return from the sub-routine you redirect the CS Engine to an actual piece of text. Something like this:
*if (gender="male") and (orientation="gay")
	*gosub lover_male
	*goto_scene onecarnival
  • It is a good practice to keep your sub-routines after the *finish command in a scene so that the Engine won’t hit sub-routines by accident.

  • If you’re redirecting the Engine flow to a different scene than the one you’re currently on, you need to use the *goto_scene command instead of the *goto, which only works inside the scene.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.