ConditionSwitch Problem

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
Waveripple
Newbie
Posts: 3
Joined: Wed Jun 18, 2014 5:42 pm
Contact:

ConditionSwitch Problem

#1 Post by Waveripple »

Hey I'm trying to get different side images of the same character to display no matter who is speaking. I've been trying to do so with ConditionSwitch, but I keep getting errors. Maybe someone can help me?
I have this as my code.

Code: Select all

init:

    $ k = Character('Kara', 
        color="#E2A918",
        window_left_padding=205,
        show_side_image=ConditionSwitch (
            "express == 'None', "sprites/Kara_N.png", 
            "express == 'frown' ", "sprites/Kara_frown.png",
            "express == 'smile' ", "sprites/Kara_smile.png",
            "express == 'shock' ", "sprites/Kara_shock.png",
            "express == 'mad' ", "sprites/Kara_mad.png",
            "express == 'blushf' ", "sprites/Kara_blushf.png",
            "express == 'blushs' ", "sprites/Kara_blushs.png",
            xalign=1.0, yalign=1.0,"
        )
    )

label start:

  am "Ah, take a deep breath, Kara. Breathe in that dank, heavy, wet air. Can't you just feel the depression rain in the air?"
  
  $ express = 'frown'

  k "Rain's not that depressing."
It tells me
invalid syntax (perhaps you left a " at the end of the first line.):
"express == 'None', "sprites-->/Kara_N.png",

I literally opened the script file from another person's finished game and copied the code then just put in the file names and changed the names. :/
I am at a lost here. What am I doing wrong? I'm sure it's probably a small error.

User avatar
Arowana
Miko-Class Veteran
Posts: 531
Joined: Thu May 31, 2012 11:17 pm
Completed: a2 ~a due~
Projects: AXIOM.01, The Pirate Mermaid
Organization: Variable X, Navigame
Tumblr: navigame-media
itch: navigame
Contact:

Re: ConditionSwitch Problem

#2 Post by Arowana »

It looks like you've displaced the quotation mark that should be after 'None' and moved it after yalign instead. Maybe while you were copying and pasting, the quotation mark got accidentally moved somehow?

Does this work better?

Code: Select all

    $ k = Character('Kara',
        color="#E2A918",
        window_left_padding=205,
        show_side_image=ConditionSwitch( 
            "express == 'None' ", "sprites/Kara_N.png",
            "express == 'frown' ", "sprites/Kara_frown.png",
            "express == 'smile' ", "sprites/Kara_smile.png",
            "express == 'shock' ", "sprites/Kara_shock.png",
            "express == 'mad' ", "sprites/Kara_mad.png",
            "express == 'blushf' ", "sprites/Kara_blushf.png",
            "express == 'blushs' ", "sprites/Kara_blushs.png",
            xalign=1.0, yalign=1.0,
        )
    )
Complete: a2 ~a due~ (music, language, love)
In progress: The Pirate Mermaid (fairytale otome)
On hold: AXIOM.01 (girl detective game)

Image

Post Reply

Who is online

Users browsing this forum: No registered users