[Tutorial]Custom Backgrounds:Save/Load/Pref/Yes-No/MainMenu

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: [Tutorial]Custom Backgrounds:Save/Load/Pref/Yes-No/MainM

#46 Post by OokamiKasumi »

Loxxi wrote:Whoa, dude. ;_; Took me two freakin' years to actually find this. Either I'm blind and I never knew it, or I'm just lazier than I thought I was. xD Thanks.
My pleasure!
-- Glad I could help.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
MarieRose1301
Newbie
Posts: 21
Joined: Sat Jun 13, 2015 3:25 am
Projects: Hatsune Miku no Yuuutsu
Deviantart: ConflictLuka
Contact:

Re: [Tutorial]Custom Backgrounds:Save/Load/Pref/Yes-No/MainM

#47 Post by MarieRose1301 »

For some reason, the backgrounds for save/load/preferences screens don't work for me, the CG, BG and music room backgrounds do work though...
Here's my code

Code: Select all

##############################################################################
# Save, Load
#
# Screens that allow the user to save and load the game.
# http://www.renpy.org/doc/html/screen_special.html#save
# http://www.renpy.org/doc/html/screen_special.html#load

# Since saving and loading are so similar, we combine them into
# a single screen, file_picker. We then use the file_picker screen
# from simple load and save screens.

screen file_picker():

    frame:
        style "file_picker_frame"

        has vbox

        # The buttons at the top allow the user to pick a
        # page of files.
        hbox:
            style_group "file_picker_nav"

            textbutton _("Previous"):
                action FilePagePrevious() text_size 30

            textbutton _("Auto"):
                action FilePage("auto") text_size 30

            textbutton _("Quick"):
                action FilePage("quick") text_size 30

            for i in range(1, 9):
                textbutton str(i):
                    action FilePage(i) text_size 30

            textbutton _("Next"):
                action FilePageNext() text_size 30

        $ columns = 2
        $ rows = 6

        # Display a grid of file slots.
        grid columns rows:
            transpose True
            xfill True
            style_group "file_picker"

            # Display ten file slots, numbered 1 - 10.
            for i in range(1, columns * rows + 1):

                # Each file slot is a button.
                button:
                    action FileAction(i)
                    xfill True

                    has hbox

                    # Add the screenshot.
                    add FileScreenshot(i)

                    $ file_name = FileSlotName(i, columns * rows)
                    $ file_time = FileTime(i, empty=_("Empty Slot."))
                    $ save_name = FileSaveName(i)

                    text "[file_name]. [file_time!t]\n[save_name!t]"

                    key "save_delete" action FileDelete(i)


screen save():

    # This ensures that any other menu screen is replaced.
    tag menu
    add "images/cgbg.png" # background image
    
    use navigation
    use file_picker

screen load():

    # This ensures that any other menu screen is replaced.
    tag menu
    add "images/cgbg.png" # background image
    
    use navigation
    use file_picker

init -2:
    style file_picker_frame is menu_frame
    style file_picker_nav_button is small_button
    style file_picker_nav_button_text is small_button_text
    style file_picker_button is large_button
    style file_picker_text is large_button_text


##############################################################################
# Preferences
#
# Screen that allows the user to change the preferences.
# http://www.renpy.org/doc/html/screen_special.html#prefereces

screen preferences():

    tag menu
    add "images/cgbg.png" # background image

    # Include the navigation.
    use navigation

    # Put the navigation columns in a three-wide grid.
    grid 3 1:
        style_group "prefs"
        xfill True

        # The left column.
        vbox:
            frame:
                style_group "pref"
                has vbox

                label _("Display")
                textbutton _("Window") action Preference("display", "window")
                textbutton _("Fullscreen") action Preference("display", "fullscreen")

            frame:
                style_group "pref"
                has vbox

                label _("Transitions")
                textbutton _("All") action Preference("transitions", "all")
                textbutton _("None") action Preference("transitions", "none")

            frame:
                style_group "pref"
                has vbox

                label _("Text Speed")
                bar value Preference("text speed")

            frame:
                style_group "pref"
                has vbox

                textbutton _("Joystick...") action Preference("joystick")


        vbox:
            frame:
                style_group "pref"
                has vbox

                label _("Skip")
                textbutton _("Seen Messages") action Preference("skip", "seen")
                textbutton _("All Messages") action Preference("skip", "all")

            frame:
                style_group "pref"
                has vbox

                textbutton _("Begin Skipping") action Skip()

            frame:
                style_group "pref"
                has vbox

                label _("After Choices")
                textbutton _("Stop Skipping") action Preference("after choices", "stop")
                textbutton _("Keep Skipping") action Preference("after choices", "skip")

            frame:
                style_group "pref"
                has vbox

                label _("Auto-Forward Time")
                bar value Preference("auto-forward time")

                if config.has_voice:
                    textbutton _("Wait for Voice") action Preference("wait for voice", "toggle")

        vbox:
            frame:
                style_group "pref"
                has vbox

                label _("Music Volume")
                bar value Preference("music volume")

            frame:
                style_group "pref"
                has vbox

                label _("Sound Volume")
                bar value Preference("sound volume")

                if config.sample_sound:
                    textbutton _("Test"):
                        action Play("sound", config.sample_sound)
                        style "soundtest_button"

            if config.has_voice:
                frame:
                    style_group "pref"
                    has vbox

                    label _("Voice Volume")
                    bar value Preference("voice volume")

                    textbutton _("Voice Sustain") action Preference("voice sustain", "toggle")
                    if config.sample_voice:
                        textbutton _("Test"):
                            action Play("voice", config.sample_voice)
                            style "soundtest_button"

init -2:
    style pref_frame:
        xfill True
        xmargin 5
        top_margin 5

    style pref_vbox:
        xfill True

    style pref_button:
        size_group "pref"
        xalign 1.0

    style pref_slider:
        xmaximum 192
        xalign 1.0

    style soundtest_button:
        xalign 1.0
If U Seek Amy

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: [Tutorial]Custom Backgrounds:Save/Load/Pref/Yes-No/MainM

#48 Post by OokamiKasumi »

MarieRose1301 wrote:For some reason, the backgrounds for save/load/preferences screens don't work for me, the CG, BG and music room backgrounds do work though...
Here's my code

Code: Select all

screen save():
    add "images/cgbg.png" # background image
    
    use navigation
    use file_picker

screen load():
    add "images/cgbg.png" # background image
    
    use navigation
    use file_picker


screen preferences():

    tag menu
    add "images/cgbg.png" # background image
Well, since this code is looking for cgbg.png in a folder called images, my first question is: Do you have a folder called images, and my next is: Is cgbg.png in that folder?
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
SilverSnow
Regular
Posts: 182
Joined: Tue Aug 27, 2013 6:28 am
Completed: Bus Stop, Before the Tale, White Book Complete Volume, See You, The Raven
Projects: Secrets...
Tumblr: stchematelier
itch: st-chem-atelier
Location: Edge of Black Hole
Discord: SHatsuyuki#1452
Contact:

Re: [Tutorial]Custom Backgrounds:Save/Load/Pref/Yes-No/MainM

#49 Post by SilverSnow »

Hi! This tutorial has helped me a great deal! :D
So now I'm wondering if there is a way for the screen backgrounds to change while hovering on the UIs? Thank you!
Image

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: [Tutorial]Custom Backgrounds:Save/Load/Pref/Yes-No/MainM

#50 Post by OokamiKasumi »

SilverSnow wrote:Hi! This tutorial has helped me a great deal! :D
So now I'm wondering if there is a way for the screen backgrounds to change while hovering on the UIs? Thank you!
I'm glad you like it!
-- As far as making whole backgrounds change on hover...? It is possible. I just don't have the skill to do it.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
SilverSnow
Regular
Posts: 182
Joined: Tue Aug 27, 2013 6:28 am
Completed: Bus Stop, Before the Tale, White Book Complete Volume, See You, The Raven
Projects: Secrets...
Tumblr: stchematelier
itch: st-chem-atelier
Location: Edge of Black Hole
Discord: SHatsuyuki#1452
Contact:

Re: [Tutorial]Custom Backgrounds:Save/Load/Pref/Yes-No/MainM

#51 Post by SilverSnow »

OokamiKasumi wrote: I'm glad you like it!
-- As far as making whole backgrounds change on hover...? It is possible. I just don't have the skill to do it.
Thanks anyway ^^
Image

Post Reply

Who is online

Users browsing this forum: No registered users