Side image,condition switch problems

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
JitterySlob
Newbie
Posts: 8
Joined: Wed Apr 13, 2016 4:37 pm
Contact:

Side image,condition switch problems

#1 Post by JitterySlob »

Hi
I wanted to have my main character change expressions(even when not talking),while being a side image and came across Donmai's condition switch idea on another topic.
viewtopic.php?p=294991#p294991

but when I try applying it to my own script I can't seem to get the image to appear.

Code: Select all

## The script of the game goes in this file.
image side Malie ouch = "Malie ouch.png"
image side Malie smile = "Malie smile.png"

define m = Character('Malie',color = "#c8ffc8")

$ m = Character('Malie', color='#aa4933', show_side_image=ConditionSwitch('mood==0', 'Malie ouch', 'mood==1', 'Malie smile', xalign=0, yalign=1.0), window_left_padding=160)


## The game starts here.

label start:
    init:
        $ mood = 0
        
m "ouch"
$ mood = 1
m "smile"
I know side image problems get asked a lot,and I apologize in advance for missing something i'm sure is very obvious.
Could someone please tell me what I've missed or need to adjust?

User avatar
firecat
Miko-Class Veteran
Posts: 540
Joined: Sat Oct 25, 2014 6:20 pm
Completed: The Unknowns Saga series
Projects: The Unknown Saga series
Tumblr: bigattck
Deviantart: bigattck
Skype: bigattck firecat
Soundcloud: bigattck-firecat
Contact:

Re: Side image,condition switch problems

#2 Post by firecat »

this must be another gui bug, if you using renpy 6.99.11 go back a version and maybe it should be fix. you dont need to restart, just go download an older version and your game file will work unless are you using the new GUI which case its a bug.
Image


Image


special thanks to nantoka.main.jp and iichan_lolbot

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: Side image,condition switch problems

#3 Post by indoneko »

I tried your code and it didn't work, but after I remove the one in bold :

image side Malie ouch = "Malie ouch.png"
image side Malie smile = "Malie smile.png"

It works
My avatar is courtesy of Mellanthe

User avatar
JitterySlob
Newbie
Posts: 8
Joined: Wed Apr 13, 2016 4:37 pm
Contact:

Re: Side image,condition switch problems

#4 Post by JitterySlob »

uh sorry to bother again but I tried what you said indoneko and it didn't seem to make a difference.
(Oh should probably mention,that it does gives the space for an image by the name with the code)

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: Side image,condition switch problems

#5 Post by indoneko »

Ah... sorry, I forgot to mention that I also added init: on the top of your code, so it will look like this (I also changed the image filename to make it simpler) :

Code: Select all

init :
    image Malie ouch = "ouch.png"
    image Malie smile = "smile.png"
    define m = Character('Malie',color = "#c8ffc8")
    $ m = Character('Malie', color='#aa4933', show_side_image=ConditionSwitch('mood==0', 'Malie ouch', 'mood==1', 'Malie smile', xalign=0, yalign=1.0), window_left_padding=160)
 
label start:
    init :
        $ mood = 0
m "ouch"
$ mood = 1
m "smile"

return
goodluck~ :3
My avatar is courtesy of Mellanthe

User avatar
JitterySlob
Newbie
Posts: 8
Joined: Wed Apr 13, 2016 4:37 pm
Contact:

Re: Side image,condition switch problems

#6 Post by JitterySlob »

I swear I copied ur code exactly, and changed my file names to what you changed it to but I get this now:

Exception:Unknown keyword arguments:side_image

Code: Select all

[code]
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 13, in script
    m "ouch"
Exception: Unknown keyword arguments: side_image

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

Full traceback:
  File "game/script.rpy", line 13, in script
    m "ouch"
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\ast.py", line 603, in execute
    renpy.exports.say(who, what, interact=self.interact)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\exports.py", line 1135, in say
    who(what, interact=interact)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\character.py", line 873, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\character.py", line 719, in do_display
    **display_args)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\character.py", line 484, in display_say
    what_text = show_function(who, what_string)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\character.py", line 702, in do_show
    **self.show_args)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\character.py", line 282, in show_display_say
    return renpy.display.screen.get_widget(screen, "what", layer)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\display\screen.py", line 1176, in get_widget
    screen.update()
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\display\screen.py", line 573, in update
    self.screen.function(**self.scope)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\ast.py", line 148, in apply_arguments
    return parameters.apply(args, kwargs, ignore_errors)
  File "C:\Users\Sheyenne\Downloads\renpy-6.99.11-sdk\renpy\ast.py", line 136, in apply
    raise Exception("Unknown keyword arguments: %s" % ( ", ".join(values.keys())))
Exception: Unknown keyword arguments: side_image

Windows-8-6.2.9200
Ren'Py 6.99.11.1749
test 1.0
[/code]

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Side image,condition switch problems

#7 Post by xela »

Ok... so what's happening here is that the docs did not have time to catch up to the new Ren'Py version:

Code: Select all

Some useful show_ variables implemented by the default screens are:

show_side_image
    When given a Displayable, shows that displayable when the dialogue is shown. The position of that displayable is controlled by its position properties. This is often used to show an image of the speaking character to the side of the dialogue.
show_two_window
    If true, restructures the layout so that the name of the character is placed in one window, and the dialogue text in a second window.
This is no longer a thing as it mostly mimics Ren'Py's real functionally of managing SideImage internally and caused a lot of confusion in the past as people kept mixing them up. You can still "link" images to a character using "image" positional argument but there are no longer a special "show_" defined in the code for you. So you can:

- Extend modern say screen with side_image positional argument.
- Copy/paste screen from older Ren'Py version but will loose some of the modern functionality.
- Use "image" linking instead as described here:
Linked Image An image tag may be associated with a Character. This allows a say statement involving this character to display an image with the tag, and also allows Ren'Py to automatically select a side image to show when this character speaks.

image
A string giving the image tag that is linked with this character.
Like what we're doing? Support us at:
Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Side image,condition switch problems

#8 Post by xela »

For example:

Code: Select all

image side e green = Solid("#008000", xysize=(100, 100))
image side e red = Solid("#FF0000", xysize=(100, 100))

define e = Character("Eileen", image="e")

label start:
    e green "Green Now!"
    e "Still green!"
    
    e red "Switching to red!"
    return
This is how side images were meant to be used, you can still add a ConditionSwitch or whatever you please in there, like:

Code: Select all

image side e automood = ConditionSwitch('mood==0', 'Malie ouch', 'mood==1', 'Malie smile', xalign=0, yalign=1.0)
and:

Code: Select all

    e automood "..."
Like what we're doing? Support us at:
Image

User avatar
JitterySlob
Newbie
Posts: 8
Joined: Wed Apr 13, 2016 4:37 pm
Contact:

Re: Side image,condition switch problems

#9 Post by JitterySlob »

ah thank you!

Post Reply

Who is online

Users browsing this forum: DewyNebula