Hi, I'm asking a lot of questions recently.
I want choice boxs to be on the right and left.
If they were four, they would put two down on the left and right.
I do not know much about programming, so if you can give a simple explanation. Thankful
[SOLVED]choice box
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.
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.
[SOLVED]choice box
Last edited by AoiMF on Sun Jul 14, 2019 1:42 am, edited 1 time in total.
Re: choice box
Hmm... I don't know for sure, but I assume you'll need to edit screens.rpy for this (or create your own screen for custom choice boxes and call that... but you said simple explanation and making your own custom screen isn't exactly simple :p )
My best guess is to search for the area that defines the Choice screen, approximately 200 lines in. If you were to change the existing
into
It would in theory make 2 columns of choices... HOWEVER this would only work if you always use exactly 4 choices... any more or any less and it would surely give an error, so I'm positive that this is not the correct solution.
I'm not sure there's an actual "easy" way to do this. It probably takes a lot of fancy coding to determine how to lay it out based on the items pulled (so most likely the correct code actually goes after the "for i in items:" part)... but I'm not that good at Python to know what exactly you'd wanna do here. I'm sure someone will come along with the exact method that you can just copy and paste into your project though...
My best guess is to search for the area that defines the Choice screen, approximately 200 lines in. If you were to change the existing
Code: Select all
vbox:
for i in items:
textbutton i.caption action i.action
Code: Select all
vbox:
grid 2 2:
for i in items:
textbutton i.caption action i.action
I'm not sure there's an actual "easy" way to do this. It probably takes a lot of fancy coding to determine how to lay it out based on the items pulled (so most likely the correct code actually goes after the "for i in items:" part)... but I'm not that good at Python to know what exactly you'd wanna do here. I'm sure someone will come along with the exact method that you can just copy and paste into your project though...
Re: choice box
As Crazy Li said, you need to modify choice screen in screens.rpy. Try it like
https://www.renpy.org/doc/html/screens.html#grid
https://www.renpy.org/doc/html/style_pr ... properties
https://www.renpy.org/doc/html/style_pr ... erty-xfill
https://www.renpy.org/doc/html/style_pr ... properties
https://www.renpy.org/doc/html/style_pr ... properties
Code: Select all
screen choice(items):
#style_prefix "choice"
# let's make a grid of 2 columns
$ rows, reminder = divmod(len(items), 2)
if reminder > 0:
$ rows += 1
grid 2 rows spacing 10:
align (0.5, 0.5)
xfill True
for ind, i in enumerate(items):
textbutton i.caption action i.action:
background Solid("#ccc")
xminimum config.screen_width/3
if ind%2 == 0:
xalign 0.1
text_xalign 0.1
else:
xalign 0.9
text_xalign 0.9
for n in range(2*rows-len(items)):
null
label start:
"..."
menu:
"Choice 1":
pass
"Choice 2":
pass
"Choice 3":
pass
"Choice 4":
pass
"Choice 5":
pass
"?!"
https://www.renpy.org/doc/html/screens.html#grid
https://www.renpy.org/doc/html/style_pr ... properties
https://www.renpy.org/doc/html/style_pr ... erty-xfill
https://www.renpy.org/doc/html/style_pr ... properties
https://www.renpy.org/doc/html/style_pr ... properties
Re: choice box
I wanted to work on two boxs, as you said, the choice screen is a good idea. thanks anywayCrazy Li wrote: ↑Sat Jul 13, 2019 4:52 am Hmm... I don't know for sure, but I assume you'll need to edit screens.rpy for this (or create your own screen for custom choice boxes and call that... but you said simple explanation and making your own custom screen isn't exactly simple :p )
My best guess is to search for the area that defines the Choice screen, approximately 200 lines in. If you were to change the existingintoCode: Select all
vbox: for i in items: textbutton i.caption action i.action
It would in theory make 2 columns of choices... HOWEVER this would only work if you always use exactly 4 choices... any more or any less and it would surely give an error, so I'm positive that this is not the correct solution.Code: Select all
vbox: grid 2 2: for i in items: textbutton i.caption action i.action
I'm not sure there's an actual "easy" way to do this. It probably takes a lot of fancy coding to determine how to lay it out based on the items pulled (so most likely the correct code actually goes after the "for i in items:" part)... but I'm not that good at Python to know what exactly you'd wanna do here. I'm sure someone will come along with the exact method that you can just copy and paste into your project though...
Re: choice box
Thank you, this is great. I'm sure to use thisAlex wrote: ↑Sat Jul 13, 2019 8:35 pm As Crazy Li said, you need to modify choice screen in screens.rpy. Try it likeCode: Select all
screen choice(items): #style_prefix "choice" # let's make a grid of 2 columns $ rows, reminder = divmod(len(items), 2) if reminder > 0: $ rows += 1 grid 2 rows spacing 10: align (0.5, 0.5) xfill True for ind, i in enumerate(items): textbutton i.caption action i.action: background Solid("#ccc") xminimum config.screen_width/3 if ind%2 == 0: xalign 0.1 text_xalign 0.1 else: xalign 0.9 text_xalign 0.9 for n in range(2*rows-len(items)): null label start: "..." menu: "Choice 1": pass "Choice 2": pass "Choice 3": pass "Choice 4": pass "Choice 5": pass "?!"
https://www.renpy.org/doc/html/screens.html#grid
https://www.renpy.org/doc/html/style_pr ... properties
https://www.renpy.org/doc/html/style_pr ... erty-xfill
https://www.renpy.org/doc/html/style_pr ... properties
https://www.renpy.org/doc/html/style_pr ... properties
Who is online
Users browsing this forum: babayi0827, Bing [Bot], Majestic-12 [Bot], Semrush [Bot]