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.
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.
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.
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.