Randomly selecting between multiple scenes


#1

@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?


#2

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


#3

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


#4

#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?


#5

Yep.


#6

@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


#7

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


#8

#9

Scratch that; the subroutines fatten it.


#10

@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!