Error using transitions on layered image with variable

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
bob-artist
Newbie
Posts: 5
Joined: Thu Apr 15, 2021 8:23 pm
Tumblr: bob-artist
Contact:

Error using transitions on layered image with variable

#1 Post by bob-artist » Wed Dec 15, 2021 8:40 pm

I have a sprite with a hat that's only used if the player chooses it. Because he has multiple heads, I set up the variable for the hat like this in the layered image setup in definitions.rpy:

Code: Select all

    if chefhat and "fnormal" in renpy.get_attributes("belmontstandard"):
        "belmontstandard_hat_hatnormal"

    elif chefhat and "ftilt" in renpy.get_attributes("belmontstandard"):
        "belmontstandard_hat_hattilt"
The variable is set to false at init, then set to true after the player makes a choice. If false, no issues.

If true, he wears the hat as expected, but I get an error if I try to use transitions like fade/dissolve on the full scene (when he's in it) or on the sprite itself. I don't get an error if I hide him with easeoutright. Here's the error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 2844, in script
    with dissolve
  File "game/definitions.rpy", line 371, in <module>
    if chefhat and "fnormal" in renpy.get_attributes("belmontcooking"):
TypeError: argument of type 'NoneType' is not iterable

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

Full traceback:
  File "game/script.rpy", line 2844, in script
    with dissolve
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/ast.py", line 1443, in execute
    renpy.exports.with_statement(trans, paired)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/exports.py", line 1684, in with_statement
    return renpy.game.interface.do_with(trans, paired, clear=clear)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 2762, in do_with
    clear=clear)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 3325, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 3737, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/core.py", line 558, in visit_all
    for d in self.visit():
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/layout.py", line 1415, in visit
    self.update(self.last_st, self.last_at)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/layout.py", line 1426, in update
    raw_child, redraw = self.function(st, at, *self.args, **self.kwargs)
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/layout.py", line 1517, in condition_switch_show
    return condition_switch_pick(switch), None
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/display/layout.py", line 1508, in condition_switch_pick
    if renpy.python.py_eval_bytecode(code):
  File "/Users/Bob/Shobo/visual novels/renpy-7.4.4-sdk/renpy/python.py", line 2269, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/definitions.rpy", line 371, in <module>
    if chefhat and "fnormal" in renpy.get_attributes("belmontcooking"):
TypeError: argument of type 'NoneType' is not iterable

Darwin-18.7.0-x86_64-i386-64bit
Ren'Py 7.4.11.2266
CWB Test 1.0
Wed Dec 15 18:23:03 2021
Is this a bug, or something I coded wrong?

It's not the end of the world, since the hat only lasts for a short part of the game and I can avoid transitions if I need to. But obviously, I'd like to fix whatever I did wrong. Thanks in advance!

Post Reply

Who is online

Users browsing this forum: GetOutOfMyLab