Comments

Log in with itch.io to leave a comment.

(1 edit)

Not sure why but can't get it to work. I get an error when I try to launch it in Ren'py.


While running game code:

  File "game/example_code.rpy", line 556, in script

    init python hide:

  File "game/example_code.rpy", line 556, in script

    init python hide:

  File "game/example_code.rpy", line 556, in <module>

    init python hide:

  File "game/example_code.rpy", line 570, in _execute_python_hide

    f = file(fn, "r")

NameError: name 'file' is not defined

(+1)(-1)

Thank you for reporting this error, we'll do our best to investigate the cause as soon as we can. Would you be able to tell us which version of Ren'Py you're using and what OS you're running on?

In the meantime, you can still open the source files in your code editor and use the code in there to assist you with your projects.

(3 edits)

Sorry for catching your reply so late!

Ren'Py version: 8.0.3

OS: Windows 10 Home, 22HZ, build 19045.2251

Please don't worry about it unless it's going to give trouble for others!

(I personally ended up not needing to learn the layered image approach. I'm stronger in graphic processing than Ren'Py coding and my project size will likely end up pretty small)

And I have been looking at your codes! love how organized your files are, they have been great help taking preventative measures from code folder chaos.

Hey, I found a fix. It has something to do with python backslash.

So, all you need to do is this: 

fn = fn.replace("\\","/")

Hi. Please help. I'm having  same error issue as Dotdidot -  Which file should I paste the fix into?  Which line, which file?  Dumb question probably but we are just learning.  I hope help a student in my class to complete a project and really want to use this tutorial. 

Thank you

This particular section in example_code.renpy

init python hide:

    import os.path

    import re

    # A list of files we will be scanning.

    files = [ ]

    for i in os.listdir(config.gamedir):

        if i.endswith(".rpy"):

            files.append(os.path.join(config.gamedir, i))

    for fn in files:

        fn = fn.replace("\\","/")

       
        f = renpy.open_file(fn)

        open_examples = set()

        for l in f:

            l = l.decode("utf-8")

            l = l.rstrip()

            m = re.match("\s*#begin (\w+)", l)

            if m:

                example = m.group(1)

                if example in examples:

                    raise Exception("Example %r is defined in two places.", example)

                open_examples.add(example)

                examples[example] = [ ]

                continue

            m = re.match("\s*#end (\w+)", l)

            if m:

                example = m.group(1)

                if example not in open_examples:

                    raise Exception("Example %r is not open.", example)

                open_examples.remove(example)

                continue

            for i in open_examples:

                examples[i].append(l)

        if open_examples:

            raise Exception("Examples %r remain open at the end of %r" % (open_examples, fn))

        f.close()

(+1)

Thank you so much ! It's working now and it has really helped me understand the Documentation content on layered images. I didn't want to turn up to class on Monday without knowing how to explain layered images. 

I just changed a few lines from 570. 

for fn in files:

        fn = fn.replace("\\","/")

        f = renpy.open_file(fn)

        open_examples = set()

        for l in f:

#no more changes needed, just the above 

 

You're welcome, glad to hear that. 

This worked for me as well. Thank you so much!

This code snippet is what I needed to get it working on my Windows 10 machine, thanks!

(1 edit)

Hey there, I tried your fix and Kaydee's fix but for some reason it still won't work for me. I'm on OS Big sur 11.5.2, I work in old af OS but would this cause an issue? Is the python struggling cuz my OS is old? 

Heres my error mssg, I'm also a newbie to Renpy so be gentle lol
.....

I'm sorry, but an uncaught exception occurred.

While running game code:

  File "game/example_code.rpy", line 556, in script

    init python hide:

  File "game/example_code.rpy", line 556, in script

    init python hide:

  File "game/example_code.rpy", line 556, in <module>

    init python hide:

  File "game/example_code.rpy", line 577, in _execute_python_hide

    f = renpy.open_file(fn)

OSError: Couldn't find file 'Users/imac/Desktop/GAMEDEV/RENPY/LayeredImage Tutorial/game/options.rpy'.

-- Full Traceback ------------------------------------------------------------

Full traceback:

  File "/Applications/renpy-8.0.3-sdk/renpy/bootstrap.py", line 277, in bootstrap

    renpy.main.main()

  File "/Applications/renpy-8.0.3-sdk/renpy/main.py", line 558, in main

    renpy.game.context().run(node)

  File "game/example_code.rpy", line 556, in script

    init python hide:

  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python3.9/site-packages/future/utils/__init__.py", line 441, in raise_

  File "game/example_code.rpy", line 556, in script

    init python hide:

  File "/Applications/renpy-8.0.3-sdk/renpy/ast.py", line 1131, in execute

    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)

  File "/Applications/renpy-8.0.3-sdk/renpy/python.py", line 1061, in py_exec_bytecode

    exec(bytecode, globals, locals)

  File "game/example_code.rpy", line 556, in <module>

    init python hide:

  File "game/example_code.rpy", line 577, in _execute_python_hide

    f = renpy.open_file(fn)

  File "/Applications/renpy-8.0.3-sdk/renpy/exports.py", line 2462, in open_file

    rv = renpy.loader.load(fn)

  File "/Applications/renpy-8.0.3-sdk/renpy/loader.py", line 820, in load

    raise IOError("Couldn't find file '%s'." % name)

OSError: Couldn't find file 'Users/imac/Desktop/GAMEDEV/RENPY/LayeredImage Tutorial/game/options.rpy'.

macOS-10.16-x86_64-i386-64bit x86_64

Ren'Py 8.0.3.22090809

LayeredImage Tutorial 1.0

Wed Apr 26 16:57:21 2023

I think they can't find your options file, aka it's not located in somewhere that's accessible by ren'py

Thanks for the reply , yeah I'm aware! 

It's in the game folder though, so I'm unsure as to why it cant be found.  I'm thinking maybe somewhere along the chain the pc-mac filepath conversion something's messed up. And yea, I opened this in MScode. For some reason I cannot open this in the debug console though. 

FILEPATH ON MY COMPUTER (My RENPY folder is where all my games are living basically):
/Users/imac/Desktop/GAMEDEV/RENPY/LayeredImage Tutorial/game/options.rpy


This was such a big help in figuring out complex layered images for my games, thank you so much. It only recently occured to me that I can also use the IF condition feature to handle various different outfits combined with arm poses (different sleeves for each outfit), in theory. Gonna have to give this a try next! <3

Hey, can you do a custom hover map similar to something like this:

 

(+5)

This tutorial is a life-saver-- as I am only recently doing more outfits/poses with my games I'm VERY LUCKY that Ren'py came out with this code and EVEN MORE LUCKY!!! That you made such an awesome and straight forward tutorial. It's super hard for me to learn without a teacher and I JUST APPRECIATE THIS SO MUCH!!! THANK YOU!!!