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.
-
Booster
- Newbie
- Posts: 6
- Joined: Thu Jan 25, 2018 4:27 pm
-
Contact:
#1
Post
by Booster » Thu Jan 25, 2018 4:34 pm
Hi friends,
I installed Renpy 2 days ago and everything works just fine ! But now I have a little more complex question that wasn't answered in the tutorials and I can't find it with google. Thats why I'm here
I want to give the player 6 answers and he has to choose 3 on them. How could I realise that?
I'd be glad to hear from you

-
Andredron
- Miko-Class Veteran
- Posts: 535
- Joined: Thu Dec 28, 2017 2:37 pm
- Completed: Kimi ga nozomu renpy-port(demo), Albatross Koukairoku(demo)
- Projects: Sisters ~Natsu no Saigo no Hi~(renpy-port)
- Location: Russia
-
Contact:
#2
Post
by Andredron » Thu Jan 25, 2018 7:19 pm
Use the variables, in the training of ripping everything is quite clearly written like what to write
-
Booster
- Newbie
- Posts: 6
- Joined: Thu Jan 25, 2018 4:27 pm
-
Contact:
#3
Post
by Booster » Fri Jan 26, 2018 11:24 am
Hello Andredon, thx 4 the answer. What training do you mean? The tutorial Game in Ren'Py? I don't find something about "ripping" there

-
Booster
- Newbie
- Posts: 6
- Joined: Thu Jan 25, 2018 4:27 pm
-
Contact:
#4
Post
by Booster » Sat Jan 27, 2018 6:51 pm
Anderson sadly didn't answer anymore. Can anyone explain what he tried to tell me? I am sorry for not understanding

-
Ocelot
- Eileen-Class Veteran
- Posts: 1882
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#5
Post
by Ocelot » Sun Jan 28, 2018 4:14 am
You need to create a custom screen with needed functionality. A small example of one:
Code: Select all
# Create a new project and replace whole script.rpy content with this code:
# We need that to see which options are selected:
style choice_button_text:
selected_color "#F00"
# A helper function
init python:
def check_return(values, amount):
if len(values) == amount:
return values
# Make sure you check RenPy documentation.
# Especially Screen Language and Screen Actions
screen multiple_choice(items, amount):
default values = set()
style_prefix "choice"
vbox:
for index, name in enumerate(items):
textbutton name action [ToggleSetMembership(values, index), Function(check_return, values, amount)]
label start:
"Game start"
# to use multiple choice screen you need to write:
# call screen multiple_choice(
# <a list containig all choices>,
# <how many choices user should choose>
# )
call screen multiple_choice(["one", "two", "three", "four", "five", "six"], 3)
# After screen returns, a set of indices or chosen choices will be placed in _return variable
# So, if it contains 0, 2 and 3, then user selected "one", "three" and "four"
# This just builds string to display, disregard that
python:
txt = "You have selected choices"
for name in _return:
txt += " %s" % name
$ renpy.say(narrator, txt)
call screen multiple_choice(["one", "two", "three", "four", "five", "six"], 3)
python:
txt = "You have selected choices"
for name in _return:
txt += " %s" % name
$ renpy.say(narrator, txt)
return
< < insert Rick Cook quote here > >
-
Booster
- Newbie
- Posts: 6
- Joined: Thu Jan 25, 2018 4:27 pm
-
Contact:
#6
Post
by Booster » Wed Jan 31, 2018 12:06 pm
thank you very much ocelot!
this works, but then i had no idea how to use the input of the player choices. sadly i have no python knowledge. that's why i figured out a way i can do it with renpy alone. i am pretty sure there is a more elegant way, but this was my solution:
Code: Select all
label choices:
$ one = 0
$ two = 0
$ three = 0
$ four = 0
$ five = 0
$ six = 0
$ choices_count = 0
label counter:
if choices_count == 3:
jump choices_done
else:
$ choices_count += 1
jump three_of_six
label three_of_six:
menu:
"Choose 3 of those options."
"One" if one == 0:
$ one += 1
jump counter
"Two" if two == 0:
$ two += 1
jump counter
"Three" if three == 0:
$ three += 1
jump counter
"Four" if four == 0:
$ four += 1
jump counter
"Five" if five == 0:
$ five += 1
jump counter
"Six" if six == 0:
$ six += 1
jump counter
label choices_done:
Users browsing this forum: Bing [Bot], enaielei