A Main Menu with Multiple Images? [Solved]

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.
Post Reply
Message
Author
User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

A Main Menu with Multiple Images? [Solved]

#1 Post by Katy133 »

I'm trying to create a custom Main Menu in Ren'Py. I've figured out how to program the various elements, but I'm not sure how to combine them all into a Main Menu.
  • The side menu (Start, Load, Quit, etc).
  • A slideshow of images of various objects that dissolve from one to another. The player "unlocks" what images appear, by finding different endings. (If/Else switch and ending Flags).
  • An image with transparency, to show the layer beneath it.
  • An animated looping pattern.
I'm using Ren'Py's default UI code for the Main Menu and the Side Menu.

This is the code for the sildeshow of objects:

Code: Select all

image slideshowfade:
        "gui/main menu item 1.png" with dissolve
        2.0
        "gui/main menu item 2.png" with dissolve
        2.0
        "gui/main menu item 3.png" with dissolve
        2.0
        repeat
    
    show slideshowfade
Code for animated looping pattern:

Code: Select all

image menuscroll:
        subpixel True
        xpan True
        ypan True
        xalign 0.5
        yalign 1.0
        HBox ("gui/main_menu pattern.png", "gui/main_menu pattern.png")
        linear 60 xpos -0.5 ypos 2.0
        repeat
        
    show menuscroll
Last edited by Katy133 on Fri Apr 12, 2019 12:36 pm, edited 1 time in total.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: A Main Menu with Multiple Images?

#2 Post by Imperf3kt »

Just use "add" as if they were regular images.

Place the ones you want in front, nearer the bottom.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Re: A Main Menu with Multiple Images?

#3 Post by Katy133 »

Imperf3kt wrote: Thu Apr 11, 2019 4:06 pm Just use "add" as if they were regular images.

Place the ones you want in front, nearer the bottom.
Where in Ren'Py's default code for the Main Menu (screens.rpy file) should I insert them? I've tried playing the slideshow code in places like right under the
background "gui/overlay/main_menu.png"
code, but I keep getting "end of line expected" error messages. Ren'Py won't even display the VN at that point.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!


User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Re: A Main Menu with Multiple Images?

#5 Post by Katy133 »

XxrenxX wrote: Thu Apr 11, 2019 5:30 pm maybe this article would help?
Thank you. I found that section of code in the screen.rpy file and added this, and the image showed up properly! :D

Code: Select all

screen main_menu():

    tag menu

    style_prefix "main_menu"

    add gui.main_menu_background
    
    image "gui/main_menu image.png"#This is what I added
 
But then I tried to add the slideshow right underneath:

Code: Select all

    image slideshowfade:
        "gui/main menu item 1.png" with dissolve
        2.0
        "gui/main menu item 2.png" with dissolve
        2.0
        "gui/main menu item 3.png" with dissolve
        2.0
        repeat
    
    show slideshowfade
This caused the following error:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/screens.rpy", line 403: expected a keyword argument or child statement.
    "gui/main menu item 1.png" with dissolve
    ^

Ren'Py Version: Ren'Py 7.2.2.491
Thu Apr 11 20:49:36 2019
I don't know how to get past this. Any advice?
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: A Main Menu with Multiple Images?

#6 Post by XxrenxX »

Code: Select all

File "game/screens.rpy", line 403: expected a keyword argument or child statement.
Might be an indentation error? It says it's expecting a statement after the : for slideshowfade.

My only other thought is if you want it to be the whole page change the add to slideshowfade instead of the image. Add acts as the background so if you put the image call there maybe that will work?

Code: Select all

screen main_menu():
    tag menu
    style_prefix "main_menu"

    add slideshowfade
Also are the 2.0's under each iamge suppose to be the pause? you might have to say pause else idk if the game knows what you mean.

Edit: You should be able to use if statements in the image define to set up what images will show and more can be added once player unlocks them.

User avatar
Matalla
Veteran
Posts: 202
Joined: Wed Mar 06, 2019 6:22 pm
Completed: Max Power and the Egyptian Beetle Case, The Candidate, The Last Hope, El cajón del viejo escritorio, Clementina y la luna roja, Caught in Orbit, Dirty Business Ep 0, Medianoche de nuevo, The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: A Main Menu with Multiple Images?

#7 Post by Matalla »

In a screen you don't use show "image" and don't use transitions, those things are used inside the game.

For what you want to do, you first have to define the image outside any label or screen with atl. Your code for that seems right, but better check it if you're not sure.

https://www.renpy.org/doc/html/atl.html?highlight=atl#

Then, inside the screen, after the background add the image.

Code: Select all

add slideshowfade
Optionally you can include the position or other parameters directly or applying a transform with "at"
Comunidad Ren'Py en español (Discord)
Honest Critique

User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Re: A Main Menu with Multiple Images?

#8 Post by Katy133 »

Matalla wrote: Thu Apr 11, 2019 9:52 pm In a screen you don't use show "image" and don't use transitions, those things are used inside the game.

For what you want to do, you first have to define the image outside any label or screen with atl. Your code for that seems right, but better check it if you're not sure.

https://www.renpy.org/doc/html/atl.html?highlight=atl#

Then, inside the screen, after the background add the image.

Code: Select all

add slideshowfade
Optionally you can include the position or other parameters directly or applying a transform with "at"
I've now changed show slideshowfade to add slideshowfade , but I still can't figure out where to put the atl block of code. I've tried placing it before the Main Menu screen, but I keep getting a "slideshowfade not defined" error.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

User avatar
Matalla
Veteran
Posts: 202
Joined: Wed Mar 06, 2019 6:22 pm
Completed: Max Power and the Egyptian Beetle Case, The Candidate, The Last Hope, El cajón del viejo escritorio, Clementina y la luna roja, Caught in Orbit, Dirty Business Ep 0, Medianoche de nuevo, The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: A Main Menu with Multiple Images?

#9 Post by Matalla »

Katy133 wrote: Thu Apr 11, 2019 10:21 pm I've now changed show slideshowfade to add slideshowfade , but I still can't figure out where to put the atl block of code. I've tried placing it before the Main Menu screen, but I keep getting a "slideshowfade not defined" error.
Put it anywhere outside a label or a screen. I'd put it at the start of the script, where you declare variables with default and such things. No indentation.
Comunidad Ren'Py en español (Discord)
Honest Critique

User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Re: A Main Menu with Multiple Images?

#10 Post by Katy133 »

Matalla wrote: Thu Apr 11, 2019 11:47 pm Put it anywhere outside a label or a screen. I'd put it at the start of the script, where you declare variables with default and such things. No indentation.
I've placed it here in the script:

Code: Select all

label start:

    image slideshowfade:
        "gui/main menu item 1.png" with dissolve
        2.0
        "gui/main menu item 2.png" with dissolve
        2.0
        "gui/main menu item 3.png" with dissolve
        2.0
        repeat
But unfortunately, I'm still getting a "'slideshowfade' is not defined" error.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

User avatar
Matalla
Veteran
Posts: 202
Joined: Wed Mar 06, 2019 6:22 pm
Completed: Max Power and the Egyptian Beetle Case, The Candidate, The Last Hope, El cajón del viejo escritorio, Clementina y la luna roja, Caught in Orbit, Dirty Business Ep 0, Medianoche de nuevo, The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: A Main Menu with Multiple Images?

#11 Post by Matalla »

I said outside a label with no indentation. Label start is still a label. Try something like this:

Code: Select all

image slideshowfade:
    "gui/main menu item 1.png" with dissolve
    2.0
    "gui/main menu item 2.png" with dissolve
    2.0
    "gui/main menu item 3.png" with dissolve
    2.0
    repeat
        
label start:
    "Whatever"
    return
Comunidad Ren'Py en español (Discord)
Honest Critique

User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Re: A Main Menu with Multiple Images?

#12 Post by Katy133 »

Matalla wrote: Fri Apr 12, 2019 11:14 am I said outside a label with no indentation. Label start is still a label. Try something like this:

Code: Select all

image slideshowfade:
    "gui/main menu item 1.png" with dissolve
    2.0
    "gui/main menu item 2.png" with dissolve
    2.0
    "gui/main menu item 3.png" with dissolve
    2.0
    repeat
        
label start:
    "Whatever"
    return
I had tried that, but I got the same error.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

User avatar
Matalla
Veteran
Posts: 202
Joined: Wed Mar 06, 2019 6:22 pm
Completed: Max Power and the Egyptian Beetle Case, The Candidate, The Last Hope, El cajón del viejo escritorio, Clementina y la luna roja, Caught in Orbit, Dirty Business Ep 0, Medianoche de nuevo, The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: A Main Menu with Multiple Images?

#13 Post by Matalla »

My bad, I never did something like this. What I said would work to put it in a label (with show instead of add). You have to define it as a transform in order to put in the main menu, Same method, though. Outside label or screen, no indentation.

Code: Select all

transform slideshowfade:
    "yellow.png" with dissolve
    2.0
    "grey.png" with dissolve
    2.0
    "black.png" with dissolve
    2.0
    repeat
    
label start:

Code: Select all

    add gui.main_menu_background
    
    add slideshowfade
Comunidad Ren'Py en español (Discord)
Honest Critique

User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Re: A Main Menu with Multiple Images?

#14 Post by Katy133 »

Matalla wrote: Fri Apr 12, 2019 12:11 pm My bad, I never did something like this. What I said would work to put it in a label (with show instead of add). You have to define it as a transform in order to put in the main menu, Same method, though. Outside label or screen, no indentation.

Code: Select all

transform slideshowfade:
    "yellow.png" with dissolve
    2.0
    "grey.png" with dissolve
    2.0
    "black.png" with dissolve
    2.0
    repeat
    
label start:

Code: Select all

    add gui.main_menu_background
    
    add slideshowfade
Thank you so, so much! It works now. I was also able to add the animated looping pattern using the same method.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

Post Reply

Who is online

Users browsing this forum: DewyNebula