How to change Choice menu? [SOLVED]
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.
How to change Choice menu? [SOLVED]
We have the test part in our game. It works perfectly...
but we have problem with customising Choice menu.
We want to have all possible answers divided in two columns in place of one column.
I was looking for answer in cookbook or tutorial (and some parts of this forum) but I couldn't find an answer :<
I would be grateful for any help, I have no idea how to change screens.rpy and customise that ;3;
but we have problem with customising Choice menu.
We want to have all possible answers divided in two columns in place of one column.
I was looking for answer in cookbook or tutorial (and some parts of this forum) but I couldn't find an answer :<
I would be grateful for any help, I have no idea how to change screens.rpy and customise that ;3;
Last edited by Kaireen on Fri Aug 31, 2012 5:41 pm, edited 2 times in total.
- athenastar17
- Regular
- Posts: 57
- Joined: Fri Aug 31, 2012 10:56 am
- Contact:
Re: How to change Choice menu?
Under choices in screens, you should change the vbox to hbox. vbox will stack items in a window vertically; hbox will stack them up horizontally.
You can also get "grids" by putting hbox's inside of vbox's and vice versa. Think of it as having a bookshelf. You have a bookshelf with each shelf stacked vertically, one on top of the other, and then the books ON the shelves are stacked horizontally, from left to right.
Note that just changing this won't cause your choices to display COMPLETELY right...you'll have to go in and mess with the styles to make them the proper width on your screen.
You can also get "grids" by putting hbox's inside of vbox's and vice versa. Think of it as having a bookshelf. You have a bookshelf with each shelf stacked vertically, one on top of the other, and then the books ON the shelves are stacked horizontally, from left to right.
Note that just changing this won't cause your choices to display COMPLETELY right...you'll have to go in and mess with the styles to make them the proper width on your screen.
Re: How to change Choice menu?
Thank you for an answer..but I'm afraid I'm still slightly clueless xD;;;
I would like to make a greed so one answer go for left, next one for right and next one for the left but the row lower.
Obviously it do not work right xD; (it looked like it was only one vbox) I was that maybe I could add each vbox a place (like 0.25 and 0.75) or.. I don't know... I'm probably just lacking of experience to make it right. ;3;
the same code without " i " looks like in attachment but it only duplicate quiz xD;
I would like to make a greed so one answer go for left, next one for right and next one for the left but the row lower.
Code: Select all
window:
style "menu_window"
xalign 0.5
yalign 0.5
hbox:
if i==1:
vbox:
style "menu"
spacing 2
for caption, action, chosen in items:
if action:
button:
action action
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption style "menu_caption"
$ i += 1
else:
vbox:
style "menu"
spacing 2
for caption, action, chosen in items:
if action:
button:
action action
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption style "menu_caption"
$ i -=1
the same code without " i " looks like in attachment but it only duplicate quiz xD;
- athenastar17
- Regular
- Posts: 57
- Joined: Fri Aug 31, 2012 10:56 am
- Contact:
Re: How to change Choice menu?
Ah...we're talking about many more choices than just two. I'll mess around with it a bit and see what I can come up with. I'm not that familiar with the Choice section of screens.rpy myself, but I will look.
Re: How to change Choice menu?
Thank you so much!!athenastar17 wrote:Ah...we're talking about many more choices than just two. I'll mess around with it a bit and see what I can come up with. I'm not that familiar with the Choice section of screens.rpy myself, but I will look.
- athenastar17
- Regular
- Posts: 57
- Joined: Fri Aug 31, 2012 10:56 am
- Contact:
Re: How to change Choice menu?
Here we go. What I'm doing here is, basically, within each vbox, telling it to only display every OTHER item (increment i...if i is even, display the choice; if not, do nothing...and vice versa for the other vbox). So, if you numbered your choices, the left vbox only displays the odd items, and the right vbox only displays the even ones. It also works for odd numbers of choices, of course. 
By using %, you can actually add more vboxes to get more columns if you like, by making it i%3, i%4, etc...but you might have to mess with the i value a bit to do that, idunno. Haven't tested it.
The original problem with your code is that the if i==1 statement was BEFORE you declared your vbox... So whether the vbox displayed at all was dependent on your i value. Since it says "if i==1," display a vbox, and otherwise, display a different vbox...you're only ever going to get one vbox, not two...because i can't be both 1 and not 1.
Not a good thing at all.
Code: Select all
window:
style "menu_window"
xalign 0.5
yalign 0.5
$i = 0
hbox:
vbox:
style "menu"
spacing 2
for caption, action, chosen in items:
$i += 1
if i % 2 == 1:
if action:
button:
action action
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption style "menu_caption"
vbox:
style "menu"
spacing 2
for caption, action, chosen in items:
$i += 1
if i % 2 == 1:
if action:
button:
action action
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption style "menu_caption"
The original problem with your code is that the if i==1 statement was BEFORE you declared your vbox... So whether the vbox displayed at all was dependent on your i value. Since it says "if i==1," display a vbox, and otherwise, display a different vbox...you're only ever going to get one vbox, not two...because i can't be both 1 and not 1.
# ---------------------------------------------------
# Name's Gene. You're welcome to call me that, too.
# ---------------------------------------------------
# Name's Gene. You're welcome to call me that, too.
# ---------------------------------------------------
Re: How to change Choice menu?
I see.. thank you so so much. I knew I'm doing something wrong xD now it makes much more sense!
I tried your code and it works perfectly... for OTHER number of answer!
When there is EVEN number of answers it's duplicates every second answer @.@;;;;;; I have no idea why it should work differently for different number of answer... but it does .___.''
I tried your code and it works perfectly... for OTHER number of answer!
When there is EVEN number of answers it's duplicates every second answer @.@;;;;;; I have no idea why it should work differently for different number of answer... but it does .___.''
- athenastar17
- Regular
- Posts: 57
- Joined: Fri Aug 31, 2012 10:56 am
- Contact:
Re: How to change Choice menu?
Ohhhh...yes. It does. How strange...AH! I know why that is. Let me give it another go.
EDIT: Sorry for the derp. Here...add this in between the vboxes (make sure it isn't inside the first box!) :
This checks to see if we're on track to START putting even numbers in there, and changes i if we're not. Optionally, if you care enough about resetting i, you could write this:
EDIT: Sorry for the derp. Here...add this in between the vboxes (make sure it isn't inside the first box!) :
Code: Select all
if i % 2 == 0:
$i = 0
Code: Select all
if i % 2 == 0;
$i = 0
else:
$i = 1
# ---------------------------------------------------
# Name's Gene. You're welcome to call me that, too.
# ---------------------------------------------------
# Name's Gene. You're welcome to call me that, too.
# ---------------------------------------------------
Re: How to change Choice menu?
now it stopped working for odd number of answers. It's really strange....... ;3; ''''''
For some reason it worked for even when I used 2nd code.
EDIT : I change values 1 and 0 in 2nd code, then It started working for even!!! copy+paste - typo ( ; = : ) didn't change the way it behave!! sorry forgot to add this info
EDIT 2: 1st one with change:
works perfectly!!!!!!! thank you so much!!! you really saved my day ;3;!!!!!!
For some reason it worked for even when I used 2nd code.
EDIT : I change values 1 and 0 in 2nd code, then It started working for even!!! copy+paste - typo ( ; = : ) didn't change the way it behave!! sorry forgot to add this info
EDIT 2: 1st one with change:
Code: Select all
if i % 2 == 0:
$i = 1- athenastar17
- Regular
- Posts: 57
- Joined: Fri Aug 31, 2012 10:56 am
- Contact:
Re: How to change Choice menu? [SOLVED]
Yay! I helped!
Good luck with your game. BTW your graphics so far look pretty nice. 
# ---------------------------------------------------
# Name's Gene. You're welcome to call me that, too.
# ---------------------------------------------------
# Name's Gene. You're welcome to call me that, too.
# ---------------------------------------------------
- athenastar17
- Regular
- Posts: 57
- Joined: Fri Aug 31, 2012 10:56 am
- Contact:
Re: How to change Choice menu? [SOLVED]
Ah! Just thought you should know, I was looking around in the screen documentation a little more, and if you ever want more rows/columns, you can use this:
It works just like a v-box or h-box, except much simpler than what we did. Play around with it and see how how it goes.Grid
This displays its children in a grid. Each child is given an area of the same size, the size of the largest child.
It takes two parameters. The first is the number of columns in the grid, and the second is the number of rows in the grid. It takes the following property:
transpose
If False (the default), rows are filled before columns. If True, then columns are filled before rows.
spacing
The spacing between the rows and columns of the grid.
Code: Select all
screen grid_test: grid 2 3: #columns, rows text "Top-Left" text "Top-Right" text "Center-Left" text "Center-Right" text "Bottom-Left" text "Bottom-Right"
# ---------------------------------------------------
# Name's Gene. You're welcome to call me that, too.
# ---------------------------------------------------
# Name's Gene. You're welcome to call me that, too.
# ---------------------------------------------------
Who is online
Users browsing this forum: Bing [Bot]