# \*if (variable = variable) \*goto

**URL:** <https://forum.choiceofgames.com/t/if-variable-variable-goto/19792>\
**Category:** ChoiceScript Help\
**Created:** [August 16, 2016, 6:25am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792 "2016-08-16T06:25:14Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![Charles\_Parkes](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/charles_parkes/32/13554_2.png) [@Charles\_Parkes](https://forum.choiceofgames.com/u/Charles_Parkes)\
**Post date:** [August 16, 2016, 8:33am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792/21 "2016-08-16T08:33:03Z")

</div>

I’m actually not getting a yellow bug on mine… that I notice. How are you testing it?

* * *

you just made me use booleans for the first time!

---

<div class="post-metadata">

**Author:** ![Lordirish](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lordirish/32/238051_2.png) [@Lordirish](https://forum.choiceofgames.com/u/Lordirish)\
**Post date:** [August 16, 2016, 8:34am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792/22 "2016-08-16T08:34:10Z")

</div>

Give ma a few more minutes as I think I, crossing my fingers, have it worked out 😉

Never mind that kind defeat the propose in the first place going to have to think on this a bit more.

I found the bug test some more to make sure this time lol.

---

<div class="post-metadata">

**Author:** ![Lordirish](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lordirish/32/238051_2.png) [@Lordirish](https://forum.choiceofgames.com/u/Lordirish)\
**Post date:** [August 16, 2016, 8:49am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792/23 "2016-08-16T08:49:57Z")

</div>

Alright the only way I could stop the long loop it break it up into groups of four.  
So you have randomization within each block but only by threes. I may come up with a better way later on but sleep is calling to me here soon. I’ll pm you later if I come up with something better or one of the Guru’s of CS give you better code. Here is what I have that test consistently.

Bad code removed

Sorry I could not come up with something better tonight.

---

<div class="post-metadata">

**Author:** ![Charles\_Parkes](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/charles_parkes/32/13554_2.png) [@Charles\_Parkes](https://forum.choiceofgames.com/u/Charles_Parkes)\
**Post date:** [August 16, 2016, 8:52am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792/24 "2016-08-16T08:52:36Z")

</div>

I think you’re doing awesomely. Thanks!

---

<div class="post-metadata">

**Author:** ![Lordirish](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lordirish/32/238051_2.png) [@Lordirish](https://forum.choiceofgames.com/u/Lordirish)\
**Post date:** [August 16, 2016, 8:56am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792/25 "2016-08-16T08:56:21Z")

</div>

Thanks, but not a great programer but do not like to give up on something hehe.

---

<div class="post-metadata">

**Author:** ![Lordirish](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lordirish/32/238051_2.png) [@Lordirish](https://forum.choiceofgames.com/u/Lordirish)\
**Post date:** [August 16, 2016, 9:05am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792/26 "2016-08-16T09:05:42Z")

</div>

Alright lol this looks like the answer, WHY it stops the long loop problem not sure, added two fake lines to the code on a hunch and results are great. they are no longer broken up into sections. Testing does not freeze up. Not seeing a repeat of the color anywhere. This code looks good.

startup

```
*title gosub rand
*author Lordirish
*comment your code here

*create pink false
*create yellow false
*create orange false
*create red false
*create brown false
*create purple false
*create grey false
*create green false
*create blue false
*create black false
*create white false
*create first_colour_adjective ""
*create two_colour_adjective ""
*create three_colour_adjective ""
*create four_colour_adjective ""
*create five_colour_adjective ""
*create six_colour_adjective ""
*create seven_colour_adjective ""
*create eight_colour_adjective ""
*create nine_colour_adjective ""
*create ten_colour_adjective ""
*create eleven_colour_adjective ""
*create var 0
*create na false
*create an false
*goto_scene color
```

Color

```
*choice
  #Lets start
    *goto reset

*comment any time you need to use the code always start with reset
*label reset
*set pink true
*set yellow true
*set orange true
*set red true
*set brown true
*set purple true
*set grey true
*set green true
*set blue true
*set black true
*set white true
*set na true
*set an false

*label double_colour_adjective
*temp hold ""
*rand var 1 11

*gosub fill
*set first_colour_adjective hold
*gosub fill
*set two_colour_adjective hold
*gosub fill
*set three_colour_adjective hold
*gosub fill
*set four_colour_adjective hold
*gosub fill
*set five_colour_adjective hold
*gosub fill
*set six_colour_adjective hold
*gosub fill
*set seven_colour_adjective hold
*gosub fill
*set eight_colour_adjective hold
*gosub fill
*set nine_colour_adjective hold
*gosub fill
*set ten_colour_adjective hold
*gosub fill
*set eleven_colour_adjective hold
*gosub fill4
*goto some_place

*label fill
*rand var 3 13
*if ((var=13) and (blue))
  *set hold "blue "
  *set blue false
  *return 
*if ((var=12) and (black))
  *set hold "black "
  *set black false
  *return 
*if ((var=11) and (pink))
  *set hold "pink"
  *set pink false
  *return
*if ((var=10) and (yellow))
  *set hold "yellow"
  *set yellow false
  *return 
*if ((var=9)and (orange))
  *set hold "orange"
  *set orange false
  *return 
*if ((var=8) and (red))
  *set hold "red"
  *set red false
  *return 
*if ((var=7) and (brown))
  *set hold "brown"
  *set brown false
  *return 
*if ((var=6) and (purple))
  *set hold "purple"
  *set purple false
  *return 
*if ((var=5) and (grey))
  *set hold "grey "
  *set grey false
  *return 
*if ((var=4) and (green))
  *set hold "green "
  *set green false
  *return 
*if ((var=3) and (white))
  *set hold "white "
  *set white false
  *return 
*else
  *gosub fill
  *return
  
*label fill4
*rand var 1 2
*if ((var=2) and (blue))
  *set hold "blue "
  *set blue false
  *return 
*if ((var=1) and (black))
  *set hold "black "
  *set black false
  *return 
*else
  *if (na)
    *set na false
    *return
  *if (an)
    *set an false
    *return
    
*label some_place
${first_colour_adjective}
*line_break
${two_colour_adjective}
*line_break
${three_colour_adjective}
*line_break
${four_colour_adjective}
*line_break
${five_colour_adjective}
*line_break
${six_colour_adjective}
*line_break
${seven_colour_adjective}
*line_break
${eight_colour_adjective}
*line_break
${nine_colour_adjective}
*line_break
${ten_colour_adjective}
*line_break
${eleven_colour_adjective}
*page_break Restart
*goto reset
```

Hope this helps any other bugs you may find let me know and I will tackle this again. But from what I am seeing works spot on for a change 😁

---

<div class="post-metadata">

**Author:** ![Charles\_Parkes](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/charles_parkes/32/13554_2.png) [@Charles\_Parkes](https://forum.choiceofgames.com/u/Charles_Parkes)\
**Post date:** [August 16, 2016, 9:07am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792/27 "2016-08-16T09:07:30Z")

</div>

🎈💫✨🎉 well done! Very impressive

---

<div class="post-metadata">

**Author:** ![Lordirish](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lordirish/32/238051_2.png) [@Lordirish](https://forum.choiceofgames.com/u/Lordirish)\
**Post date:** [August 16, 2016, 9:08am UTC](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792/28 "2016-08-16T09:08:53Z")

</div>

Well I am sure it will make those that are coders cringe but for whatever reason it works hehe. And thanks it was a fun challenge to tackle.

[Previous page](https://forum.choiceofgames.com/t/if-variable-variable-goto/19792.md?page=1)
