(solved) im.Sepia to FileScreenshot()

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
SONTSE
Regular
Posts: 95
Joined: Sun Nov 24, 2013 10:49 pm
Completed: 8 VN's so far
Contact:

(solved) im.Sepia to FileScreenshot()

#1 Post by SONTSE » Thu Dec 18, 2014 3:32 pm

Hi! I need to apply some image manipulators to my save screenshot.
like this:

Code: Select all

        imagebutton idle im.Sepia(FileScreenshot(i)) hover FileScreenshot(i) pos (515,140) action SetVariable("save_c",i) alternate SetVariable("load_c",i)


Unfortunately this does work only on already written save slot with existing image. if slot is empty, the function Returns "Null" displayable instead of Image, which is inoperable by Im.Sepia

So can I do something about this? My plan is to detect if the slot is empty and if that's the case, push a dummy image instead of FileScreenshot() function return. Something like this

Code: Select all

    def fs(x):
        st = FileScreenshot(x)
        if THE_SLOT_IS_EMPTY(x)  ####<<<<<< that function is what I need
            return "interface/270144.png"
        else:
            return FileScreenshot(x)   
what i need is a function, or any method to determine if queried slot is empty of if function return is not an image.

or maybe I need generally different approach. Please help me. Thanks
Last edited by SONTSE on Thu Dec 18, 2014 7:20 pm, edited 1 time in total.
Look! It's moving. It's alive. It's alive... IT'S ALIVE! Oh, in the name of God! Now I know what it feels like to be God!(@Henry_Frankenstein. Sums up my coding style)

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

Re: im.Sepia to FileScreenshot()

#2 Post by philat » Thu Dec 18, 2014 4:44 pm

I haven't tried running this, but the code from FileScreenshot itself (located in 00action_file.rpy) seems pretty straightforward.

Code: Select all

    def FS(name, empty=None, page=None):
        screenshot = renpy.slot_screenshot(__slotname(name, page))

        if screenshot is not None:
            return screenshot
        return "dummy image"
Wouldn't this work?

User avatar
SONTSE
Regular
Posts: 95
Joined: Sun Nov 24, 2013 10:49 pm
Completed: 8 VN's so far
Contact:

Re: im.Sepia to FileScreenshot()

#3 Post by SONTSE » Thu Dec 18, 2014 7:20 pm

Thanks, philat!

Although not working right away, this code gave me a hint which led me to solution.
Works perfectly if i change this double-underlined function __slotname(name,page), which appears as "not defined", to a string str(page)+'-'+str(name), which is actual return of that function (according to 00action_file.rpy)

Code: Select all

    def fs(name, page=1):
        screenshot = renpy.slot_screenshot(str(page)+'-'+str(name))
        if screenshot is not None:
            return screenshot
        return "dummy_image.png"
Look! It's moving. It's alive. It's alive... IT'S ALIVE! Oh, in the name of God! Now I know what it feels like to be God!(@Henry_Frankenstein. Sums up my coding style)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]