# Randomly selecting between multiple scenes

**URL:** <https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447>\
**Category:** ChoiceScript Help\
**Created:** [June 9, 2013, 10:57pm UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447 "2013-06-09T22:57:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ADNox](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/adnox/32/1115_2.png) [@ADNox](https://forum.choiceofgames.com/u/ADNox)\
**Post date:** [June 9, 2013, 10:57pm UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/1 "2013-06-09T22:57:49Z")

</div>

@2Ton and other skilled scripters.

I know it’s possible to select a random scene file, but is it possible to use a goto random within a single scene file? For example, say there’s a central room and from it you can choose #Go adventuring. How would the subsequent goto randomly select one of say, twelve possible adventures?

---

<div class="post-metadata">

**Author:** ![ADNox](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/adnox/32/1115_2.png) [@ADNox](https://forum.choiceofgames.com/u/ADNox)\
**Post date:** [June 9, 2013, 11:02pm UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/2 "2013-06-09T23:02:26Z")

</div>

Also, how would you make some adventres repeat only once and others play multiple times?

---

<div class="post-metadata">

**Author:** ![FairyGodfeather](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fairygodfeather/32/16709_2.png) [@FairyGodfeather](https://forum.choiceofgames.com/u/FairyGodfeather)\
**Post date:** [June 9, 2013, 11:07pm UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/3 "2013-06-09T23:07:28Z")

</div>

I would do

```

*temp randscene

*rand randscene 1 12

*if randscene=1
	*goto_scene adventure1
*if randscene=2
	*goto_scene adventure2

```

And so on.

Oh wait did I misread? If you want all the adventures in the same file, just do it as

```

*temp randscene

*rand randscene 1 12

*if randscene=1
	*goto adventure1
*if randscene=2
	*goto adventure2

```

instead and be sure to “\*label adventure1” etc

---

<div class="post-metadata">

**Author:** ![ADNox](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/adnox/32/1115_2.png) [@ADNox](https://forum.choiceofgames.com/u/ADNox)\
**Post date:** [June 9, 2013, 11:10pm UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/4 "2013-06-09T23:10:24Z")

</div>

#fairygodfeather

And add another variable that monitors if a scene has been played, followed by a reroll to pick another, for the scenes intended to only run once?

---

<div class="post-metadata">

**Author:** ![FairyGodfeather](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fairygodfeather/32/16709_2.png) [@FairyGodfeather](https://forum.choiceofgames.com/u/FairyGodfeather)\
**Post date:** [June 9, 2013, 11:17pm UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/5 "2013-06-09T23:17:43Z")

</div>

Yep.

---

<div class="post-metadata">

**Author:** ![Redgrave](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/redgrave/32/619_2.png) [@Redgrave](https://forum.choiceofgames.com/u/Redgrave)\
**Post date:** [June 10, 2013, 1:45am UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/6 "2013-06-10T01:45:22Z")

</div>

@FairyGodfeather @ADNox

Remember that, with the latest version of ChoiceScript, \*create and \*temp commands need to have a value assigned:

```

*temp variable1 50
*temp variable2 true
*temp variable3 "variable"

```

The above will work. The below, will not:

```

*temp variable1

```

---

<div class="post-metadata">

**Author:** ![Caddmuss](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/caddmuss/32/424_2.png) [@Caddmuss](https://forum.choiceofgames.com/u/Caddmuss)\
**Post date:** [June 10, 2013, 2:44am UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/7 "2013-06-10T02:44:30Z")

</div>

@Redgrave - Only \*create requires you to declare a variable in the update. \*temp allows but doesn’t require a starting value.

> **[New ChoiceScript: \*create has changed, mygame.js is optional](https://forum.choiceofgames.com/t/-/1291/6)**
>
> Yes, \*temp has also been updated to allow (but not require) a value. You don’t have to change anything, but if you’d like, you can now write “\*temp winner true”.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [June 10, 2013, 3:25am UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/8 "2013-06-10T03:25:48Z")

</div>

> **[System mini-scenes](https://choicescriptdev.fandom.com/wiki/System_mini-scenes)**
>
> Download Link: http://www.mediafire.com/?0pyhv0fga8hjpet This, as is the rest of the wiki, is covered under Creative Commons Attribution-Share Alike License 3.0 (Unported) (CC-BY-SA). To install, copy and paste code below into a blank scene file (or...

---

<div class="post-metadata">

**Author:** ![ADNox](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/adnox/32/1115_2.png) [@ADNox](https://forum.choiceofgames.com/u/ADNox)\
**Post date:** [June 10, 2013, 4:41am UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/9 "2013-06-10T04:41:31Z")

</div>

Scratch that; the subroutines fatten it.

---

<div class="post-metadata">

**Author:** ![Redgrave](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/redgrave/32/619_2.png) [@Redgrave](https://forum.choiceofgames.com/u/Redgrave)\
**Post date:** [June 10, 2013, 1:18pm UTC](https://forum.choiceofgames.com/t/randomly-selecting-between-multiple-scenes/1447/10 "2013-06-10T13:18:28Z")

</div>

@Caddmuss ah! Thanks for that! I haven’t had time to play around with the latest version of ChoiceScript but I really must do, it seems.

@FairyGodfeather @ADNox sorry for that, and doubly sorry if I confused you!
