Taking in-game screenshots. Calling them back.

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
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Taking in-game screenshots. Calling them back.

#1 Post by Kinmoku »

Hi all,

I want to take screenshots of drawings the player will do in-game (see thread: viewtopic.php?f=8&t=51370) and call them back soon after.

Here's my code so far:

In script.rpy:

Code: Select all

    call screen freehand_draw
In screens.rpy:

Code: Select all

screen freehand_draw():
    
    vbox:
        hbox:
            frame:
                background "#FFF"
                padding (0, 0)
                xsize 800
                ysize 360

                add freehand_canvas
         
        hbox:
            style "draw_ui"
            for colour in colours:
                button:
                    xsize 32
                    ysize 32
                    background colour
                    action SetField(freehand_canvas, 'colour', colour)

            textbutton "New sheet" action Function(freehand_canvas.clear)
            textbutton "Thicker pen" action SetField(freehand_canvas, 'line_width', 8)
            textbutton "Done" action [Function(Screenshot()), Return] ## this is the screenshot function
And then I want to show the drawing/ screenshot:

Code: Select all

## show recent screenshot?

k "Hahaha!"
m "Don't laugh! I drew that."
#etc
My issue is that when a screenshot is taken, dialogue shows up in the top left saying one is saved to the game folder which breaks immersion. And I also don't know how to "show" a screenshot that maybe called "screenshot01" or "screenshot99" depending on how many play-throughs you've done. How do I call the last screenshot? And how can I show it again later (in the gallery or in the credits)?

Thanks.

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Taking in-game screenshots. Calling them back.

#2 Post by philat »

Do you need to be able to access all of 1-99 or just the last one taken?

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Taking in-game screenshots. Calling them back.

#3 Post by Kinmoku »

philat wrote: Wed Oct 10, 2018 7:44 am Do you need to be able to access all of 1-99 or just the last one taken?
Hi Philat. Both, really. I want to show what the player has drawn soon after they've drawn it in the script... and then, later in the credits/ gallery (but this is less important)

There will be a few drawings, though, which is where it may get complicated, unless there's a way to name a specific screenshot, and replace it (if the player plays the game again)

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Taking in-game screenshots. Calling them back.

#4 Post by philat »

If you don't need it to be saved, you can just use FileTakeScreenshot and FileCurrentScreenshot. Makes things much simpler for the former, if you don't absolutely need the latter.

https://www.renpy.org/doc/html/screen_a ... Screenshot
https://www.renpy.org/doc/html/screen_a ... Screenshot

If you need it to be saved, I guess you can use some sort of data structure (like a list) to keep track of screenshots.

Post Reply

Who is online

Users browsing this forum: No registered users