# Issues with an \*elseif

**URL:** <https://forum.choiceofgames.com/t/issues-with-an-elseif/147535>\
**Category:** ChoiceScript Help\
**Created:** [January 13, 2024, 3:38pm UTC](https://forum.choiceofgames.com/t/issues-with-an-elseif/147535 "2024-01-13T15:38:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArchivistAlpha096](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/archivistalpha096/32/203655_2.png) [@ArchivistAlpha096](https://forum.choiceofgames.com/u/ArchivistAlpha096)\
**Post date:** [January 13, 2024, 3:38pm UTC](https://forum.choiceofgames.com/t/issues-with-an-elseif/147535/1 "2024-01-13T15:38:59Z")

</div>

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

```choicescript
*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.

---

<div class="post-metadata">

**Author:** ![quartz](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/quartz/32/174435_2.png) [@quartz](https://forum.choiceofgames.com/u/quartz)\
**Post date:** [January 13, 2024, 3:42pm UTC](https://forum.choiceofgames.com/t/issues-with-an-elseif/147535/2 "2024-01-13T15:42:57Z")

</div>

The second goto encounter indentation seems off.

---

<div class="post-metadata">

**Author:** ![coal8](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@coal8](https://forum.choiceofgames.com/u/coal8)\
**Post date:** [January 13, 2024, 3:50pm UTC](https://forum.choiceofgames.com/t/issues-with-an-elseif/147535/3 "2024-01-13T15:50:58Z")

</div>

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

```choicescript
*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

```

---

<div class="post-metadata">

**Author:** ![RedEmperor](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/redemperor/32/147485_2.png) [@RedEmperor](https://forum.choiceofgames.com/u/RedEmperor)\
**Post date:** [January 13, 2024, 3:56pm UTC](https://forum.choiceofgames.com/t/issues-with-an-elseif/147535/4 "2024-01-13T15:56:23Z")

</div>

```choicescript
*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.

---

<div class="post-metadata">

**Author:** ![quartz](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/quartz/32/174435_2.png) [@quartz](https://forum.choiceofgames.com/u/quartz)\
**Post date:** [January 13, 2024, 3:58pm UTC](https://forum.choiceofgames.com/t/issues-with-an-elseif/147535/5 "2024-01-13T15:58:37Z")

</div>

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:

```choicescript
*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.

---

<div class="post-metadata">

**Author:** ![ArchivistAlpha096](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/archivistalpha096/32/203655_2.png) [@ArchivistAlpha096](https://forum.choiceofgames.com/u/ArchivistAlpha096)\
**Post date:** [January 14, 2024, 3:14pm UTC](https://forum.choiceofgames.com/t/issues-with-an-elseif/147535/6 "2024-01-14T15:14:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![coal8](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@coal8](https://forum.choiceofgames.com/u/coal8)\
**Post date:** [January 14, 2024, 3:26pm UTC](https://forum.choiceofgames.com/t/issues-with-an-elseif/147535/7 "2024-01-14T15:26:17Z")

</div>

> [@ArchivistAlpha096](#):
>
> 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?

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