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.
Hey! So in addition to the regular position of the menu, I have two others I use occasionally: at the middle and at the bottom. But I'm having some problems. When the bottom menu is activated, everything looks good EXCEPT that the menu choices are shown again at the top left of the screen. They're not in the button, it's just the text. Then, when those menus are deactivated, the regular menu buttons don't show up at all, including the text. However, if I just have the bottom or the middle menus coded and setup in the screens section, everything works fine. It's when I have both of them that it starts being weird. I'm sure I did something wrong. I just made this by looking around the forums and tweaking stuff myself, so it's probably a simple fix lol. I just can't pinpoint the problem. Anyway, help would be appreciated. Here's the code.
lindsay-jb wrote: ↑Wed Jun 09, 2021 10:32 pm
Hey! So in addition to the regular position of the menu, I have two others I use occasionally: at the middle and at the bottom. But I'm having some problems. When the bottom menu is activated, everything looks good EXCEPT that the menu choices are shown again at the top left of the screen. They're not in the button, it's just the text.
That's what your else clause said to do: put a vbox with textbuttons in it on the screen.
I'm wondering if you think your "if" cases are all mutually exclusive, because they're not coded that way. if it's possible for "middle" and "bottom" to both be True, then renpy will try to display both blocks. If you want to guarantee that renpy will only show one or the other, the second and subsequent ones should be `elif`.
It also might be instructive to look at the content of your screen, stripped of all the style and layout information:
screen choice(items):
if middle:
window:
vbox:
for i in items:
textbutton i.caption
# this is the start of an entirely new if/elif/else statement, independent of anything above it
if bottom:
window:
vbox:
for i in items:
textbutton i.caption
# this is the start of an entirely new if/elif/else statement, independent of anything above it
if (timeout_label is not None) and persistent.timed_choices:
bar value AnimatedValue(old_value=0.0, value=1.0, range=1.0, delay=timeout)
timer timeout action Jump(timeout_label)
else:
vbox:
for i in items:
textbutton i.caption
The third if/else statement in particular doesn't seem right, but I don't understand what you intend, really.
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM
Thank you! I figured my code was sort of messy... I'm a writer/musician who had an idea for a VN and decided to learn to program so my codes are usually weird mixes of different tutorials/answered questions I find lol. I didn't know about the enif, that's super helpful! I'll use your suggestions to clean up the coding.