Problem with screenshot in Save/Load [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
Lyedka
Newbie
Posts: 12
Joined: Thu Jan 08, 2015 1:01 am
Completed: Blackjack Deluxe
Projects: Ai Aisuru, Puri-Puri, BlGame(still unnamed), D.A.
Organization: Puzzle Deluxe
Deviantart: Liedka
Skype: Lyedka Panni
Location: this way!
Contact:

Problem with screenshot in Save/Load [Solved]

#1 Post by Lyedka » Wed May 20, 2015 4:49 am

Hi! I've a problem with screenshot. I want the image is in a position while the file slot in other position.

This is my code, the first image recorded appears but not of the other slots. How I can solve the problem? And....
● you can add a box with the latest text on the game? Or..
● you can add custom text? (the players can add whatever they want in the box)
● where I have to add "key "save_delete""? and with what action?

Code: Select all

screen cu:
    add FileScreenshot(number) xpos 50 ypos 92

screen file_picker():
    imagebutton auto "dat001/back_%s.png" xpos 15 ypos 10 focus_mask True action Return()
    $ config.thumbnail_height  = 118
    $ config.thumbnail_width =  203
    
    imagemap:
#        ypos 596 xpos 383
        alpha True
        ground "dat001/unozul.png"
        idle "dat001/unozul.png"
        hover "dat001/unocele.png"
        selected_idle "dat001/unocele.png"
        selected_hover "dat001/unozul.png"
       
        hotspot (244, 421, 34, 34) action FilePage(1)
        hotspot (276, 421, 34, 34) action FilePage(2)
        hotspot (309, 421, 34, 34) action FilePage(3)
        hotspot (342, 421, 34, 34) action FilePage(4)
        hotspot (274, 421, 34, 34) action FilePage(5)
        hotspot (408, 421, 34, 34) action FilePage(6)
        hotspot (440, 421, 34, 34) action FilePage(7)
        hotspot (473, 421, 34, 34) action FilePage(8)
        hotspot (504, 421, 34, 34) action FilePage(9)
        hotspot (583, 421, 34, 34) action FilePage(10)

        
    $ x = 47
    $ y = 255
    
    for number in range(1,7):
        $ filetime = FileTime(number, empty=_(""))
        $ fileslot = "nro %02s" % (FileSlotName(number, 4))
        imagebutton auto "dat001/cdro_%s.png" xpos x ypos y action [FileAction(number)] 
        use cu

        if filetime:
            add "dat001/vcio.png" xpos x ypos y
        $ xt = x + 7
        $ yt = y + 50
        $ xs = x + 70
        $ ys = y + 4
        text filetime xpos xt ypos yt size 12 outlines [(1, "#000", 0, 0)]
        text fileslot xpos xs ypos ys size 16 outlines [(1, "#000", 0, 0)]
        $ x += 147
        if number == 5:
            $ y += 80
            $ x = 47

screen save():
    tag menu
    use file_picker

screen load():
    add "dat001/load.png"
    tag menu
    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
example? (I want it to look like that, well, not so exactly hahaha :D):
Image

Sorry for my bad english.
Last edited by Lyedka on Thu May 21, 2015 12:41 am, edited 1 time in total.

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Problem with screenshot in Save/Load

#2 Post by SinnyROM » Wed May 20, 2015 2:08 pm

EDIT: So I took a closer look at your screenshot code and it's not very clear what you want to do with the screenshot and save description. Did you want the user to select a save first so that its screenshot and description show?

A way to do that would be having a variable curr_save that keeps track of the selected save, and setting that when the user clicks on the smaller save boxes. Then you'll display the corresponding screenshot at the top. Maybe you'll want to put the save and delete buttons there too. The save button is set up with the action to save the current dialogue as the description.

Code: Select all

init -2 python:
    # action: saves the dialogue as save description
    # http://lemmasoft.renai.us/forums/viewtopic.php?f=8&t=23749
    last_say = ""
    class FileLastSaySave(FileSave):
        def __init__(self, name, confirm=False, newest=True, page=None, cycle=False):
            global last_say
            super(FileLastSaySave,self).__init__(name=name,confirm=confirm,newest=newest,page=page,cycle=cycle)
            self.last_say=last_say
        def __call__(self):
            global save_name
            save_name=self.last_say
            return super(FileLastSaySave,self).__call__()

    # current save variable
    curr_save = 1

Code: Select all

screen say(who, what):
    on "show" action SetVariable("last_say",what)
    on "replace" action SetVariable("last_say",what)
    # ...

Code: Select all

screen cu:
    # Current save data
    add FileScreenshot(curr_save) xpos 50 ypos 92
    text FileSaveName(curr_save)
    textbutton "Save" action FileAction(curr_save), If(renpy.current_screen().screen_name[0] == "load",FileLoad(curr_save),FileLastSaySave(curr_save)) 
    textbutton "Delete" action [FileDelete(curr_save)] 

screen file_picker:
    # current save data portion
    use cu

    for number in range(1,7):
        $ filetime = FileTime(number, empty=_(""))
        $ fileslot = "nro %02s" % (FileSlotName(number, 4))
        # action is to set the current save to this one rather than saving
        imagebutton auto "dat001/cdro_%s.png" xpos x ypos y action [SetVariable("curr_save",number)]
        add FileScreenshot(number) 

        # ...

Let me know if I completely misunderstood (it happens!) and I'll do my best to help you.

-

I won't be able to figure out the single screenshot preview features right now, but I can answer your other questions!

You need to edit your file_picker and say screens for the auto save description. The relevant parts are below, which came from a topic on this forum and I don't have the link on me unfortunately.

The key "save_delete" action FileDelete(i) line is for when you hover over the save slot and press the Delete key to delete it. I prefer a button though, which I added into the code if you're interested.
Last edited by SinnyROM on Thu May 21, 2015 5:50 am, edited 1 time in total.

User avatar
Lyedka
Newbie
Posts: 12
Joined: Thu Jan 08, 2015 1:01 am
Completed: Blackjack Deluxe
Projects: Ai Aisuru, Puri-Puri, BlGame(still unnamed), D.A.
Organization: Puzzle Deluxe
Deviantart: Liedka
Skype: Lyedka Panni
Location: this way!
Contact:

Re: Problem with screenshot in Save/Load

#3 Post by Lyedka » Thu May 21, 2015 12:39 am

Thank you! It is just what I needed!! :D

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot