Is there an easy way to randomize the order/position of all the options in a *choice?

I often think about how the player sometimes tries to “guess” which option is the correct one via its positioning in the “list”, and about how I would like to have a way for the same options to appear in different spots, especially when I want the player to be able to select just a few of them before going on.

The only way I think of doing that would be by creating several instances of the same options, each with a number conditional associated to them, and then randomize the number, like this:

Example of what I'm trying to achieve: 

*choice
 *if (diceRoll = 1) #Option A
 *if (diceRoll = 1) #Option B
 *if (diceRoll = 1) #Option C
 *if (diceRoll = 2) #Option B
 *if (diceRoll = 2) #Option A
 *if (diceRoll = 2) #Option C
 *if (diceRoll = 3) #Option C
 *if (diceRoll = 3) #Option A 
 *if (diceRoll = 3) #Option B
 

But it does not sound very intuitive, and it can get a bit messy when I have many options I want to assignate random orders.

Does anyone have a better idea?

CLARIFICATION:
I think I should have phrased it better, but it’s kinda hard to explain: The main purpose of the question was to find a way to randomize every option on the choice, not because there is only a right one, but because I want the player to enter in a limited-usage loop that he will exit before selecting all of the possible options.

Think of this as an interrogation with a question limit. You can only ask 3 questions before something happens and the story moves on, but there are 8 questions available.

Now, the trouble is not implementing the described that mechanic(it’s fairly easy), but making so that all the questions are randomized, so the players won’t always try the first three ones on the list and then move on during a first playthrough.

(I don’t want to tell the player that he can only select 3 options beforehand)

(I also don’t want to enter a discussion about whether players tend to select the first three options or not, I’m just assuming that based on my own experience and I’m working under my assumptions. I’m not trying to state it as a fact or anything of the sort.)

Well, the problem is that there’s no dedicated way to sort the order/position of a *choice options :confused:

I’m afraid the “only” way to do it is what you’re suggesting… unless we can code something like :thinking:

Select a stuff:

*choice
*gosub option

*label option
   #Option 1
   #Option 2
   #Option 3
*return

And somehow, via the subroutine, those option can be displayed in any order as the author wants.

1 Like

What says there only needs to be one correct option? :confused: Even if only one option is correct, there should be no need to randomise individual choices, as you can just rearrange the order yourself (e.g. ABC one choice, CBA the next). Unless a person remembers the order for any particular choice on their previous playthrough (or you use the same exact choice multiple times), then it shouldn’t be a problem.

But if you’re dead set on actual randomisation, this is probably a more elegant way to write it (although it’s basically still the same):

*choice
 *if (diceRoll = 1)
  #Option A
  #Option B
  #Option C
 *if (diceRoll = 2)
  #Option B
  #Option A
  #Option C
 *if (diceRoll = 3)
  #Option C
  #Option A 
  #Option B
1 Like

Nothing. It is, as things usually should be, situational. Sometimes the best way to go is by having only one right option.

I’m not even using it for that in this specific case, it was just a fitting example on the applicabilities of it.

Thanks. I keep forgetting that writing it like that is a thing.

@ParrotWatcher has a more compact solution than I was going to suggest, which was the different dice rolls would take you to separate *choice commands. You’d probably have to repeat yourself a lot less with their idea.

Another thing to be aware of: in order to truly cover every possible sequence, you would need 6 dice roll possibilities for 3 options (3! or 3x2x1). This will get out of hand pretty quickly (4 options would need 24 possibilities, 5 would need 120, etc.).

Your aim is to stop people guessing the correct option in a list. I’d keep it very simple and just randomise the position of the first option.

*creat rand_no 1

*randomise rand_no 1 3

*choice
  *if (rand_no = 1) #First choice

  #Second choice

  *if (rand_no = 2) #First choice

  #Third choice

  *if (rand_no = 3) #First choice

This will give you 3 random choice orders. If choice 1 is the ‘correct’ choice then it will be sufficiently randomised.
This is just 4 lines of code more than a normal choice for the effect you need.

1 Like

If I had to do this I would have done it like this

*if diceroll = 1 
    *goto 1
*if diceroll = 2 
    *goto 2
*if diceroll =3
    *goto 3
( I don't like too many options in one choice )

*label 1
*choice
    #bla
    #bla
    #bla also

*label 2
*choice
    #blabla
    #bla
    #blablabla

*label 3
*choice 
    #blablabla 
    #bla
    #blabla

@ysalmari Yup, it just isn’t viable.

@andymwhy Thanks. I think that works for the situation where only one answer is the right one and it solves one of the problems.

I think I should have phrased it better, but it’s kinda hard to explain: The main purpose of the question was to find a way to randomize every option on the choice, not because there is only a right one, but because I want the player to enter in a limited-usage loop that he will exit before selecting all of the possible options.

Think of this as an interrogation with a question limit. You can only ask 3 questions before something happens and the story moves on, but there are 8 questions available.

Now, the trouble is not implementing the described that mechanic(it’s fairly easy), but making so that all the questions are randomized, so the players won’t always try the first three ones on the list and then move on during a first playthrough.

(I don’t want to tell the player that he can only select 3 options beforehand)

(I also don’t want to enter a discussion about whether players tend to select the first three options or not, I’m just assuming that based on my own experience and I’m working under my assumptions. I’m not trying to state it as a fact or anything of the sort.)

Hope I made myself clear. It’s kinda of a confusing concept, IMHO. I’ll edit the first post too.

@DUNGEON_MASTER Thanks. I guess that works better for the purpose I mentioned.