[Solved]Jump to Random Label
Posted: Thu Apr 14, 2016 8:28 am
Maybe there's an easier way to do this, I'm not sure, but here's what I'm doing:
So if you couldn't tell, I want a pool of random questions to ask the player but I don't want the same one asked twice. So that's why I added a separate variable for each possible jump to label. Once it jumps to it, it shouldn't jump to it again because it's asking for djx to == 2, right?
Still in testing, I sometimes still get repeat questions and I have no idea why.
Any one have any idea why?
Or I'm open to simpler alternatives as well.
Thanks for reading!
Code: Select all
#define a bunch of variables
$mj1 = 0
$ dj1 = 0
$ dj2 = 1
$ dj3 = 1
$ etc ...
label questions_start:
if dj1 == 10:
jump after_questions
mu "Next question!"
label start_random:
$ mj1 = renpy.random.randint(2,16)
if mj1 == 2:
if dj2 == 2:
jump start_random
else:
$ dj2 = 2
jump question1
if mj1 == 3:
if dj3 == 2:
jump start_random
else:
$ dj3 = 2
jump question3
label question1:
$ dj2 = 2
"Blah blah"
$ dj1 += 1
jump questions_start
label after_questions:
"Blah"
Still in testing, I sometimes still get repeat questions and I have no idea why.
Any one have any idea why?
Or I'm open to simpler alternatives as well.
Thanks for reading!