Using gosub & if/else in conjunction with hide_reuse

The problem:

I would like to have the player choose 1 OR 2 races. Some of the races have a subroutine for specific ethnicities. For example:

*comment -------------------------------------------- CHOOSE RACE --------------------------------------------
*label choose_race
*choice
	#American Indian or Native Alaskan
			*gosub race_amer_ind_submenu
	*if (race_counter < 1)
		#White or Caucasian
			*set race1 "White or Caucasian"
			*set race_counter +1
			*goto no_more_races_one
	*else
		#White or Caucasian
			*set race2 "White or Caucasian"
			*set race_counter +1
			*goto no_more_races_two


*comment --------------------------- RACE: AMER IND SUBMENU ---------------------------
*label race_amer_ind_submenu
*choice
	*if (race_counter < 1)
		#Apache
			*set race1 "apache"
			*set race_counter +1
			*goto no_more_races_one
		#Navajo
			*set race1 "navajo"
			*set race_counter +1
			*goto no_more_races_one
	*else
		#Apache
			*set race2 "apache"
			*set race_counter +1
			*goto no_more_races_two
		#Navajo
			*set race2 "navajo"
			*set race_counter +1
			*goto no_more_races_two
*return

They are then taken to a confirmation choice.

*comment -------------------------------------------- RACE CONF --------------------------------------------
*label no_more_races_one
You are of $!{race1} descent. Do you want to make any changes?
*choice
	#Yes, I would like to choose a different race.
		*set race1 ""
		*set race_counter 0
		*goto choose_race
	#Yes, I would like to add a second race.
		*goto choose_race
	#No, this race is fine.
		*goto choose_hair

*label no_more_races_two
You are of $!{race1} and $!{race2} descent. Do you want to make changes to your selections?
*choice
	#Yes, I would like to choose different races.
		*set race1 ""
		*set race2 ""
		*set race_counter 0
		*goto choose_race
	#No, these races are fine.
		*goto choose_hair

If the player selects 1 race (or 1 ethnicity from a subroutine), i want them to be unable to select the same race for their second choice. Right now, they can choose the same race twice. (E.g. "You are of Apache and Apache descent.) Obviously, that’s… not what i want, lol.

I’ve been scouring previous help threads looking for a way to use hide_reuse alongside gosub, but I’m not really sure how to also make sure that the races are assigned to their own variables. Would it be better to set every race / ethnicity as booleans and have the user’s selection make them true?

It’s not the end of the word if there is no clean way to do this, just thought I’d reach out to more experienced coders. Thank you for any help C:

Just put a

*selectable_if (race != "Apache") #Apache

(I didn’t checked if the () are correctly placed)

5 Likes

THANK YOU
oh my god i could kiss you i can’t believe it was that simple

<333333

2 Likes

Well, I’m single but really there’s no need, don’t worry. Sometimes we get kind of blind when trying too hard to solve the code, it just happens.

2 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.