[SOLVED] Trying to create a simple math minigame. Strange list index out of range error?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Trying to create a simple math minigame. Strange list index out of range error?

#16 Post by Remix »

or perhaps:

chess_answer_list.append( (str(correct_value), True))
others = renpy.python.rng.sample( [k for k in range(-7,0) ]+[ k for k in range(1,8) ], 4 ) ## <-- get 4 unique choices from the list (without zeros)
for k in others:
chess_answer_list.append( (str(correct_value + k), False))
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], GetOutOfMyLab, Semrush [Bot], VESTED