ConditionSwitch, Error Switch Not Defined [SOLVED]

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
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

ConditionSwitch, Error Switch Not Defined [SOLVED]

#1 Post by wyverngem »

I am following the wiki http://www.renpy.org/wiki/renpy/doc/coo ... t_emotions for Showing Layered Sprites, and I've come up with more then a few errors. The first I've fixed by adding the appropriate quotes around 'happy' and 'sick'. Though no matter what I do I get the same error:

Code: Select all

While running game code:
  File "game/script.rpy", line 38, in script
NameError: name 'NadineFace' is not defined
What am I doing wrong? Here is my script exactly as I have it in game. >< What did I do?

Code: Select all

#Nadine Emotes
init:
    image nadine = ConditionSwitch(
        "NadineFace == 'happy'", LiveComposite(
        (363,709),
        (0,0), "images/character/nadine/nadine.png",
        (94,66), "images/character/nadine/nadine-happy.png",
        ),
        "NadineFace == 'sick'", LiveComposite(
        (363,709),
        (0,0), "images/character/nadine/nadine.png",
        (94,66), "images/character/nadine/nadine-sick.png",
        ),
        "NadineFace == None", "images/character/nadine/nadine.png")
    

label start:
    "This is a test of the emergancy broadcast system."
    show nadine
    "Can you see her?"
    return
Last edited by wyverngem on Mon Aug 06, 2012 4:02 am, edited 1 time in total.

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: ConditionSwitch, Error Switch Not Defined

#2 Post by DragoonHP »

You need to define NadineFace in the label.
Something like this

Code: Select all

label start:
    "This is a test of the emergancy broadcast system."
    $ NadimFace = 'Happy'
    show nadine
    "Can you see her?"
    return
Whenever you want to change the expressions, you'll have to change the value of NadimFace

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: ConditionSwitch, Error Switch Not Defined

#3 Post by wyverngem »

Thank you, :) Solved.

Note: Here's the final code.
In Init

Code: Select all

# LiveComposite Character Sprites
#Nadine Emotes
init:
    image nadine = ConditionSwitch(
        "NadineFace == 'normal'", LiveComposite(
        (363,709), #Size of Base Image
        (0,0), "images/character/nadine/nadine-blank.png", #Blank Spot, when replaced no animation issues
        (0,0), "images/character/nadine/nadine.png", #Emote replacing Blank image
        ),
        "NadineFace == 'happy'", LiveComposite(
        (363,709),
        (0,0), "images/character/nadine/nadine-blank.png",
        (0,0), "images/character/nadine/nadine-happy.png",
        ),
        "NadineFace == 'sick'", LiveComposite(
        (363,709),
        (0,0), "images/character/nadine/nadine-blank.png",
        (0,0), "images/character/nadine/nadine-sick.png",
        ),
        "NadineFace == None", "images/character/nadine/nadine.png")
For Start Label

Code: Select all

label start:
    "This is a test of the emergency broadcast system."
    $ NadineFace = "normal" #Define before showing Character Emotes
    show nadine at left #Can use positions normally
    "Can you see her?"
    $NadineFace = "sick"
    "Now, she's ill."
    return

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], bonnie_641, Google [Bot]