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.
-
Grifin
- Newbie
- Posts: 2
- Joined: Sun Nov 24, 2019 9:52 am
-
Contact:
#1
Post
by Grifin » Sun Nov 24, 2019 10:01 am
So i have code for
ypos change in the choicemenu which I need once
Code: Select all
screen choice(items):
if name == "True":
style_prefix "choicen"
else:
style_prefix "choice"
vbox:
for i in items:
textbutton i.caption action i.action
define config.narrator_menu = True
style choicen_vbox is vbox
style choicen_button is button
style choicen_button_text is button_text
style choicen_vbox:
xalign 0.5
ypos 700
yanchor 0.5
spacing gui.choice_spacing
style choicen_vbox:
xalign 0.5
ypos 700
yanchor 0.5
spacing gui.choice_spacing
style choicen_button is default:
properties gui.button_properties("choice_button")
style choicen_button_text is default:
properties gui.button_text_properties("choice_button")
size 30
style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text
style choice_vbox:
xalign 0.5
ypos 700
yanchor 0.5
spacing gui.choice_spacing
style choice_vbox:
xalign 0.5
ypos 500
yanchor 0.5
spacing gui.choice_spacing
And then in the script, I do
When I want
ypos to change
But I know this is quite dumb way to do
How I can optimize this?
-
Angelo Seraphim
- Regular
- Posts: 32
- Joined: Tue May 21, 2019 8:00 am
- Completed: Enamored Risks (NaNoReNo 2020)
- Projects: 616 Charagma
- Organization: GLSUoA
- Deviantart: glsuoa
- itch: glsuoa
- Location: London, UK
- Discord: Just A Concept#9599
-
Contact:
#2
Post
by Angelo Seraphim » Sun Nov 24, 2019 10:48 am
Firstly;
Is this suppose to be a boolean type variable? If so, then it should just be
True without quotation marks.
What's the difference between "choice" and "choicen" in your styles? Is that just for changing the
vbox?
You probably don't need to do:
Code: Select all
if name == "True":
style_prefix "choicen"
else:
style_prefix "choice"
...but instead maybe do:
Code: Select all
screen choice(items):
style_prefix "choice"
vbox:
if name:
ypos 500
else:
ypos 700
for i in items:
textbutton i.caption action i.action
-
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:
#3
Post
by Remix » Sun Nov 24, 2019 11:21 am
You could use the _mode parameter of the menu system...
Code: Select all
screen choice(items):
style_prefix "choice"
vbox:
ypos (700 if renpy.get_mode() == "lower_menu" else 500)
for i in items:
textbutton i.caption action i.action
Then, just add it as wanted
Code: Select all
label start:
"lower menu"
menu (_mode="lower_menu"):
"A":
pass
"B":
pass
"normal menu"
menu:
"A":
pass
"B":
pass
"..."
-
Grifin
- Newbie
- Posts: 2
- Joined: Sun Nov 24, 2019 9:52 am
-
Contact:
#4
Post
by Grifin » Mon Nov 25, 2019 4:41 am
Thank you, I'll you use mode parameter, it's more convenient
Users browsing this forum: Bing [Bot]