Anyway, I've just been fiddling around with Ren'Py lately, not really working actively on anything, mostly testing stuff out. And I've been trying to work the "layered sprite with different emotions" cookbook entry, but I seem to be having trouble. Knowing me, it's probably something very simple that I'm missing, but I think it has something to do with not turning off the sprite and then trying to go back to the main menu that's making it crash?
This is the code I'm using:
Code: Select all
init:
image rei = ConditionSwitch(
"rei_face == 'happy'", LiveComposite(
(200, 256),
(0, 0), "rei-body.png",
(96, 88), Animation("rei-eyes11.png", 2.5,
"rei-eyes12.png", 0.05,
"rei-eyes13.png", 0.05,
"rei-eyes12.png", 0.05),
(112, 136), "rei-mouth1.png"
),
"rei_face == 'sad'", LiveComposite(
(200, 256),
(0, 0), "rei-body.png",
(96, 88), Animation("rei-eyes21.png", 2.5,
"rei-eyes22.png", 0.05,
"rei-eyes23.png", 0.05,
"rei-eyes22.png", 0.05),
(112, 136), "rei-mouth2.png"
)
)
$ rei = Character('Rei', color="#5c628b")
label start:
show rei
$ rei_face = "happy"
with dissolve
rei "You've created a new Ren'Py game."
$ rei_face = "sad"
with dissolve
rei "Once you add a story, pictures, and music, you can release it to the world!"
Code: Select all
I'm sorry, but an exception occured while executing your Ren'Py
script.
NameError: name 'rei_face' is not defined
While running game code:
- script at line 704 of renpy-6.9.3/common/00library.rpy
- python at line 704 of renpy-6.9.3/common/00library.rpy.
- script at line 20 of renpy-6.9.3/common/_layout/classic_main_menu.rpym
-- Full Traceback ------------------------------------------------------------
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\bootstrap.py", line 260, in bootstrap
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\main.py", line 308, in main
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\main.py", line 92, in run
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\execution.py", line 230, in run
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\ast.py", line 558, in execute
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\python.py", line 921, in py_exec_bytecode
File "renpy-6.9.3/common/00library.rpy", line 704, in <module>
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\game.py", line 285, in call_in_new_context
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\execution.py", line 230, in run
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\ast.py", line 558, in execute
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\python.py", line 921, in py_exec_bytecode
File "renpy-6.9.3/common/_layout/classic_main_menu.rpym", line 53, in <module>
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\ui.py", line 69, in interact
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\core.py", line 1364, in interact
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\core.py", line 1663, in interact_core
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\core.py", line 983, in show
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 711, in render_screen
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 142, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\layout.py", line 485, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 142, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\transition.py", line 174, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 142, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\transition.py", line 348, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 142, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\layout.py", line 485, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 142, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\layout.py", line 485, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 142, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\image.py", line 143, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\image.py", line 35, in wrap_render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 142, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\layout.py", line 247, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\render.py", line 142, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\layout.py", line 825, in render
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\layout.py", line 862, in condition_switch_show
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\display\layout.py", line 856, in condition_switch_pick
File "C:\Documents and Settings\Owner\Desktop\renpy-6.9.3\renpy\python.py", line 950, in py_eval
File "<none>", line 1, in <expression>
NameError: name 'rei_face' is not defined
While running game code:
- script at line 704 of renpy-6.9.3/common/00library.rpy
- python at line 704 of renpy-6.9.3/common/00library.rpy.
- script at line 20 of renpy-6.9.3/common/_layout/classic_main_menu.rpym
Ren'Py Version: Ren'Py 6.9.3c
Um, so, there is clearly something my simple mind is missing here. Help?