RenPy games crash if system path to a screenshot contains brackets []

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
PineFellow
Newbie
Posts: 4
Joined: Fri Dec 09, 2016 5:34 am
Contact:

RenPy games crash if system path to a screenshot contains brackets []

#1 Post by PineFellow »

Under Windows, placing renpy games in a folder that contains square brackets in its name breaks taking screenshots.

Code: Select all

NameError: Name 'RenPy_games' is not defined.
Renpy tries to display a notification, that contains the path to the screenshot file, i.e. "Saved screenshot as C:\[RenPy_games]\mygame\screenshot0001.png" Then text parser raises an error, since a variable RenPy_games does not exist.

Patching

Code: Select all

    def _screenshot_callback(fn):
        renpy.notify(__("Saved screenshot as %s.") % fn.replace("[","[["))
in 00keymap.rpy fixes the issue for now, if somewhat dirty.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: RenPy games crash if system path to a screenshot contains brackets []

#2 Post by PyTom »

I've fixed this. The right way to do it is to change the notify screen in screens.rpy to:

Code: Select all

screen notify(message):

    zorder 100
    style_prefix "notify"

    frame at notify_appear:
        text "[message!tq]"

    timer 3.25 action Hide('notify')
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

PineFellow
Newbie
Posts: 4
Joined: Fri Dec 09, 2016 5:34 am
Contact:

Re: RenPy games crash if system path to a screenshot contains brackets []

#3 Post by PineFellow »

Oh, right, forgot about renpy's conversion flags. Neat! Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users