[SOLVED] QuickLoad() function for last manual saved game

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.
Message
Author
User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Different QuickLoad() function ? (for last saved game)

#16 Post by xela »

Could be a lot of stuff... I usually use buttons for complex stuff and imagebuttons for basics as well so I never encountered this :(

Also, thought I've never tried, my first instinct would be to use classes instead of onscreen definitions and try to work through keymap activating selected state instead of transform approach.

Going to try and throw a dummy project to test this out, it's hard to guess what's going wrong otherwise because I have about 5 different theories atm.
Like what we're doing? Support us at:
Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Different QuickLoad() function ? (for last saved game)

#17 Post by xela »

I've told you how to fix the error before, you need to add the hover state image as well! OR use If action + Insensitive state. Are you still getting the menu error?

My idea with keymap didn't work btw :(
Like what we're doing? Support us at:
Image

User avatar
Marchare
Newbie
Posts: 19
Joined: Mon Apr 28, 2014 7:43 pm
Contact:

Re: Different QuickLoad() function ? (for last saved game)

#18 Post by Marchare »

xela wrote:I've told you how to fix the error before, you need to add the hover state image as well! OR use If action + Insensitive state. Are you still getting the menu error?

My idea with keymap didn't work btw :(
To clear any confusion, here's how our imagebuttons work:

Code: Select all

        imagebutton:
            idle "image/ui/mainmenu/commencer_idle.png" 
            hover ("image/ui/mainmenu/commencer_clicked.png" if mouse_clicked 
                else "image/ui/mainmenu/commencer_hover.png") 
            xpos 80 
            ypos y 
            focus_mask None 
            action Start()
As you can see, hover is split into 2 options.
If "mouse_clicked", is True, or if the player is pressing the left click actually activate the imagebutton (like when you're dragging something by holding down left mouseclick), then the button is "clicked". Which is why the .png file is called "commencer_clicked.png" instead of "commencer_action.png" or "commencer_hover.png". Let's say it's a custom variable that we added in our code.
If "mouse_clicked" isn't True, the buttons uses the regular hover variable.
Hence, we did add the hover state image, or maybe we're misinterpreting what you said?

This may seem pretty overkill to add something like this just for some fancy/extra effect that's not particularly useful, but since we're working on the port of a Japanese visual novel, we want it to be a close to the original as possible. :)

Is "clicked" in the way or...?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Different QuickLoad() function ? (for last saved game)

#19 Post by xela »

I understood that :) Just wanted to try different approach using a class instead of that transform/udd thing.

The error your colleague reported is there because after "else:" he defines image button with idle image but without hover image! I have no idea why the menu is not showing up if there is no save, my two guesses are something is wrong with that transform or you're defining a fixed inside of hbox and something goes wrong with positioning. I am too lazy to try and reconstruct that whole code in a dummy project :(
Like what we're doing? Support us at:
Image

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Different QuickLoad() function ? (for last saved game)

#20 Post by Pierrou »

My bad sorry !

I didn't understand that Ren'Py need the hover statement. I thought i could put idle only for a locked button.

This is the code if someone is looking at this :)


Thank you Xela and Qirien for your help ! <3

Code: Select all

screen raccourcis:
    key "mouseup_3" action If(renpy.get_screen("pop_up_raccourcis"), Hide("pop_up_raccourcis"), Show("pop_up_raccourcis"))

screen pop_up_raccourcis:
    tag menu
    zorder 90


    hbox:
        default mouse_clicked = False
        fixed at KeymapTransform([('mousedown_1', SetScreenVariable('mouse_clicked', True)), ('mouseup_1', SetScreenVariable('mouse_clicked', False))]):
            $ x=540
            $ recent_save = renpy.newest_slot(r"\d+")
            if (recent_save is not None):
                $ recent_save_page, recent_save_name = recent_save.split("-")
                imagebutton idle "image/ui/raccourcis/select_idle.png" hover ("image/ui/raccourcis/select_clicked.png" if mouse_clicked else "image/ui/raccourcis/select_hover.png") xpos x ypos 136 focus_mask None action [Hide("pop_up_raccourcis"), FileLoad(recent_save_name, confirm=True, page=recent_save_page)]
            else:
                add "image/ui/raccourcis/select_lock.png" xpos x ypos 136
            imagebutton idle "image/ui/raccourcis/cancel_idle.png" hover ("image/ui/raccourcis/cancel_clicked.png" if mouse_clicked else "image/ui/raccourcis/cancel_hover.png") xpos x ypos 58 focus_mask None action Hide("pop_up_raccourcis")
            imagebutton idle "image/ui/raccourcis/messagenon_idle.png" hover ("image/ui/raccourcis/messagenon_clicked.png" if mouse_clicked else "image/ui/raccourcis/messagenon_hover.png") xpos x ypos 84 focus_mask None action [Hide("pop_up_raccourcis"), HideInterface()]
            imagebutton idle "image/ui/raccourcis/skip_idle.png" hover ("image/ui/raccourcis/skip_clicked.png" if mouse_clicked else "image/ui/raccourcis/skip_hover.png") xpos x ypos 110 focus_mask None action [Hide("pop_up_raccourcis"), Skip(confirm=True)]
            imagebutton idle "image/ui/raccourcis/log_idle.png" hover ("image/ui/raccourcis/log_clicked.png" if mouse_clicked else "image/ui/raccourcis/log_hover.png") xpos x ypos 162 focus_mask None action [Hide("pop_up_raccourcis"), ShowMenu("text_history")]
            imagebutton idle "image/ui/raccourcis/save_idle.png" hover ("image/ui/raccourcis/save_clicked.png" if mouse_clicked else "image/ui/raccourcis/save_hover.png") xpos x ypos 188 focus_mask None action [Hide("pop_up_raccourcis"), ShowMenu('save')]
            imagebutton idle "image/ui/raccourcis/load_idle.png" hover ("image/ui/raccourcis/load_clicked.png" if mouse_clicked else "image/ui/raccourcis/load_hover.png") xpos x ypos 214 focus_mask None action [Hide("pop_up_raccourcis"), ShowMenu('load')]
            imagebutton idle "image/ui/raccourcis/fullscreen_idle.png" hover ("image/ui/raccourcis/fullscreen_clicked.png" if mouse_clicked else "image/ui/raccourcis/fullscreen_hover.png") xpos x ypos 240 focus_mask None action [Hide("pop_up_raccourcis"), renpy.toggle_fullscreen]
            imagebutton idle "image/ui/raccourcis/config_idle.png" hover ("image/ui/raccourcis/config_clicked.png" if mouse_clicked else "image/ui/raccourcis/config_hover.png") xpos x ypos 266 focus_mask None action [Hide("pop_up_raccourcis"), ShowMenu("preferences")]
            imagebutton idle "image/ui/raccourcis/title_idle.png" hover ("image/ui/raccourcis/title_clicked.png" if mouse_clicked else "image/ui/raccourcis/title_hover.png") xpos x ypos 292 focus_mask None action [Hide("pop_up_raccourcis"), ShowMenu("main_menu")]
            imagebutton idle "image/ui/raccourcis/fin_idle.png" hover ("image/ui/raccourcis/fin_clicked.png" if mouse_clicked else "image/ui/raccourcis/fin_hover.png") xpos x ypos 318 focus_mask None action [Hide("pop_up_raccourcis"), Quit(confirm=True)]
Just in case... Do you know how to put "CTRL + B" in keymap ?

Code: Select all

    key "K_RCTRL + B" action FileLoad(recent_save_name, confirm=True, page=recent_save_page)
:/

EDIT : Found ! => http://lemmasoft.renai.us/forums/viewto ... 549#p83549

Code: Select all

key "ctrl_K_b" action FileLoad(recent_save_name, confirm=True, page=recent_save_page)
Sorry for my english, it's not my native language. :s

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: [SOLVED] QuickLoad() function for last manual saved game

#21 Post by qirien »

Hey, glad you got it working! :-)
Finished games:
Image
Image
Image

Post Reply

Who is online

Users browsing this forum: Ocelot