Issues with an *elseif

CUrrently, I have 4 different *elseifif’s due to previous variables:

*if (vomit_t =true)
	${t_name}, and ${mc_first} with said still slung over a shoulder as well as both being cloaked in shadow come into sight at the other end of the hallway before
	*goto encounter
*elseif (vomit_l =true)
	${l_name}, with ${mc_first} still cradled in 1 arm  come into sight at the other end of the hallway before
*goto encounter
*elseif (vomit_n =true)
	${n_name} and ${mc_first}, who is still floating in the air beside ${n_them} come into view at the other end of the hallway before
	*goto encounter
*elseif (vomit_d =true)
	${d_name}, with ${mc_first} still slung over the ${d_person}'s shoulder come into sight, ${d_name}'s head on fire again, before
	*goto encounter

3 of them are taking but when I try to run the forth, the last one, it seems to just jump over it, and I am not sure why. From what I can tell, the indent is correct and the variables used are correctly put out as true.
With that, would someone be able to help me figure out what’s wrong here, and how I can fix it?

Anyway, I hope that you all have a good rest of your day.

The second goto encounter indentation seems off.

1 Like

yup the the second *goto encounter is not properly indented
should be:

*if (vomit_t = true)
	${t_name}, and ${mc_first} with said still slung over a shoulder as well as both being cloaked in shadow come into sight at the other end of the hallway before
	*goto encounter
*elseif (vomit_l = true)
	${l_name}, with ${mc_first} still cradled in 1 arm  come into sight at the other end of the hallway before
	*goto encounter
*elseif (vomit_n = true)
	${n_name} and ${mc_first}, who is still floating in the air beside ${n_them} come into view at the other end of the hallway before
	*goto encounter
*elseif (vomit_d = true)
	${d_name}, with ${mc_first} still slung over the ${d_person}'s shoulder come into sight, ${d_name}'s head on fire again, before
	*goto encounter
1 Like
*if (vomit_t)
	${t_name}, and ${mc_first} with said still slung over a shoulder as well as both being cloaked in shadow come into sight at the other end of the hallway before
	*goto encounter
*if (vomit_l)
	${l_name}, with ${mc_first} still cradled in 1 arm  come into sight at the other end of the hallway before
    *goto encounter
*if (vomit_n)
	${n_name} and ${mc_first}, who is still floating in the air beside ${n_them} come into view at the other end of the hallway before
	*goto encounter
*if (vomit_d)
	${d_name}, with ${mc_first} still slung over the ${d_person}'s shoulder come into sight, ${d_name}'s head on fire again, before
	*goto encounter

Try this.

1 Like

Another thing that comes to mind is the way the code is structured is error-prone. Why do you have 4 separate variables for vomiting? Can all 4 characters vomit in different permutations, or is vomiting a mutually exclusive event? If the latter is the case, then you can use a single variable for that particular state. Something like this:

*if (vomit = "t")
	${t_name}, and ${mc_first} with said still slung over a shoulder as well as both being cloaked in shadow come into sight at the other end of the hallway before
	*goto encounter
*elseif (vomit = "l")
	${l_name}, with ${mc_first} still cradled in 1 arm  come into sight at the other end of the hallway before
	*goto encounter
*elseif (vomit = "n")
	${n_name} and ${mc_first}, who is still floating in the air beside ${n_them} come into view at the other end of the hallway before
	*goto encounter
*elseif (vomit = "d")
	${d_name}, with ${mc_first} still slung over the ${d_person}'s shoulder come into sight, ${d_name}'s head on fire again, before
	*goto encounter

If you use your current code and leave my mistake a variable on true, for example, the first you check, then the others will never execute.

4 Likes

In this case, a little while back, depending on the relationship variables, the MC could vomit on any one of the 4 others, said being T L N and D.
I did change the variables by taking out true, and it seems to work, although I have no idea why, it seems to work, Would one of you be able to explain that to me, if you can?

Also, thanks for all the help with this. Didn’t notice the second *goto encounter wasn’t indented correctly because the third variable worked fine and that doesn’t usually happen if the variable directly above that isn’t correct.

In ChoiceScript, a variable itself can be a boolean (true or false). So, if you write *if (vomit_t), it checks if vomit_t is true.

The reason why your code works after removing true is because the variables vomit_t, vomit_l, vomit_n, and vomit_d are likely boolean variables. When you say *if (vomit_t), it’s equivalent to saying *if (vomit_t = true).