Side sprite won't change with ShowingSwitch [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
xCephalopod
Newbie
Posts: 15
Joined: Fri Oct 24, 2014 3:11 pm
Projects: Bellmare Romance
Tumblr: brittleskies
Skype: xCephalopod
Location: Millersburg, Michigan
Contact:

Side sprite won't change with ShowingSwitch [Solved]

#1 Post by xCephalopod »

I keep getting an error code when trying to change my side sprite to a different mood. Picture of the error below.

Code: Select all

#Characters
image Evita 1 = "evita 1.png"
image Evita 2 = "evita surprised.png"
image Evita 3 = "evita mad.png"
image Evita 4 = "evita sad.png"
image Evita 5 = "evita content.png"
image side Evita 1 = "evita 1.png"
image side Evita 2 = "evita surprised.png"
image side Evita 3 = "evita mad.png"
image side Evita 4 = "evita sad.png"
image side Evita 5 = "evita content.png"

# Declare characters used by this game.
define e = Character('Evita', color="#570F74", window_left_padding=160, show_side_image=ShowingSwitch("evita 1" "evita 1.png", "evita 2", "evita surprised.png", "evita 3", "evita mad.png", "evita 4", "evita sad.png", "evita 5", "evita content.png", None, Null(), xalign=0.0, yalign=1.0))
define d = Character('Dmitry', color="#990505")
define l = Character('Lir', color="#08650A")
define r = Character('Ravi', color="#076495")
define m = Character('Marija', color="#D04594")
define p = Character('Pearl', color="#E42C42")
define a = Character('Alorra', color="#C96A0B")


# The game starts here.

label start:   
    $ metdmitry = False
    $ metlir = False
    $ metravi = False
    $ metmarija = False
    $ metpearl = False
    $ metalorra = False
    $ dmitrypoints = 0
    $ lirpoints = 0
    $ ravipoints = 0
    $ marijapoints = 0
    $ pearlpoints = 0
    $ alorrapoints = 0
    
    init:
        $ offScreen = Position(xpos=1, xanchor='left', ypos=0)
        
    init:     
        image evita 1 hidden = Null ()
        image evita 2 hidden = Null()
        image evita 3 hidden = Null ()
        image evita 4 hidden = Null ()
        image evita 5 hidden = Null ()
    
    show bakery bg
    
    show e 1 at offScreen
    
    e "{i}Mother always said that I'd take over the family business one day.{/i}" 
    e "{i}I never thought that that day would come so soon.{/i}"
    e "{i}Even so, here I am, sweeping the flour up from the tile at the end of a busy work day.{/i}"
    e "{i}Just as I was about to sweep the almost unusually large amount of excess off the floor, the door opened with the usual \"ding\".{/i}"
    
    menu:
        e "{i}I was a bit startled, but a quickly turned to see...{/i}"
        
        "A man.":
            scene bakery bg
        
        "A woman.":
            scene bakery bg
       

    return
Attachments
Untitled.png
Last edited by xCephalopod on Sat Nov 08, 2014 7:54 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Side sprite won't change with ShowingSwitch

#2 Post by Alex »

You've missed the comma

Code: Select all

show_side_image=ShowingSwitch("evita 1" "evita 1.png"

User avatar
xCephalopod
Newbie
Posts: 15
Joined: Fri Oct 24, 2014 3:11 pm
Projects: Bellmare Romance
Tumblr: brittleskies
Skype: xCephalopod
Location: Millersburg, Michigan
Contact:

Re: Side sprite won't change with ShowingSwitch

#3 Post by xCephalopod »

I added the comma, but now no picture shows up before I put in the code to have "evita 2" show up.

When I do "show evita 2 hidden" and then "show evita 2", I get an error.
Attachments
Untitled1.png
Untitled.png

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Side sprite won't change with ShowingSwitch

#4 Post by Alex »

I added the comma, but now no picture shows up before I put in the code to have "evita 2" show up.
Yes, that's how it work - you need to show one of images you've specified in ShowingSwitch (they are "evita 1", "evita 2" etc.). And "e 1" is not in that list.

Code: Select all

show e 1 at offScreen
So this line won't change the side image.
Should be

Code: Select all

show Evita 1 at offScreen
When I do "show evita 2 hidden" and then "show evita 2", I get an error.
According to screenshot of an error, you trying to show the image inside a menu block (line 69), also there is some dialogue in the next line - they shouldn't be inside menu block.

User avatar
xCephalopod
Newbie
Posts: 15
Joined: Fri Oct 24, 2014 3:11 pm
Projects: Bellmare Romance
Tumblr: brittleskies
Skype: xCephalopod
Location: Millersburg, Michigan
Contact:

Re: Side sprite won't change with ShowingSwitch

#5 Post by xCephalopod »

Thank you! You helped me figure it out! c:

Post Reply

Who is online

Users browsing this forum: 3N16M4, Ahrefs [Bot], Bing [Bot], munni