"Permanent" Side Images - How to? [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.
Message
Author
User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

"Permanent" Side Images - How to? [Solved]

#1 Post by Llunet1 » Wed Feb 26, 2014 3:59 am

Hello! For my VN, I'm trying to get my side image to stay, no matter who is talking. (I'll have to remove the side image once in a while, but for the most part I don't want it to move)
There's a game who did this - Get Dumped
Yet, I haven't found out how to do this anywhere.

I know how to get a side image and how to use conditional switches... but when someone else talks the side image disappears. I do not want it to. Please help!

Thank you :)
Last edited by Llunet1 on Thu Sep 04, 2014 7:14 pm, edited 1 time in total.

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

Re: "Permanent" Side Images - How to?

#2 Post by xela » Wed Feb 26, 2014 6:52 am

I am only planning to start using sideimages so my experience with them is 0 but wouldn't simply:

Code: Select all

add SideImage() xalign 0.0 yalign 1.0
conditioning it though a couple of if/elif/else forks or using some form of conditioned displayable do the trick? I glanced at the documentation but it doesn't look like Ren'Py offers what you're looking for at face value, instead it simply makes it fairly easy to add the functionality yourself.
Like what we're doing? Support us at:
Image

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: "Permanent" Side Images - How to?

#3 Post by Llunet1 » Wed Feb 26, 2014 8:44 pm

Hmm... how would that code be used? (I haven't seen it formatted like that before... //although I haven't been using Ren'Py for long)

I was thinking that if I had an image permanently at the side, I could just overlap images in order to change the expression. Would that code do that? (Without having it attached to a character)
I guess I'll try it out to see~ Thank you for responding!

User avatar
Stapper
Regular
Posts: 96
Joined: Wed Feb 27, 2013 9:54 pm
Contact:

Re: "Permanent" Side Images - How to?

#4 Post by Stapper » Wed Feb 26, 2014 9:29 pm

I believe what you want to do is have a side image there with every textbox?

If so you can open screens.rpy and find the say block:

Code: Select all

##############################################################################
# Say
#
# Screen that's used to display adv-mode dialogue.
# http://www.renpy.org/doc/html/screen_special.html#say
screen say:
Here you can specify the image you want there directly, so it will always be there when the textbox is on screen

I hope this is what you need :)

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: "Permanent" Side Images - How to?

#5 Post by Llunet1 » Thu Feb 27, 2014 3:47 am

Ohh... I didn't know about that. Huh. Thank you. :)
However, I don't know how to program that... ^^; And the Wikipedia isn't clear enough for me. Could you please give me an example as to how I would write the code, if you don't mind? That should be enough for me. (Also, I need to be able to remove the side image sometimes. For example the beginning, which is all narration, and also when the main character doesn't have a name. How would I do that?)

jamescmc
Newbie
Posts: 2
Joined: Thu Feb 27, 2014 4:12 am
Contact:

Re: "Permanent" Side Images - How to?

#6 Post by jamescmc » Thu Feb 27, 2014 4:25 am

The following imaging API can be used to add sideimage:

Code: Select all

void Page.AddImage(REImage img, float positionX, float positionY, ImageCompression compression);
For more information, please go to this image tutorial

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

Re: "Permanent" Side Images - How to?

#7 Post by xela » Thu Feb 27, 2014 5:58 am

Llunet1 wrote:Ohh... I didn't know about that. Huh. Thank you. :)
However, I don't know how to program that... ^^; And the Wikipedia isn't clear enough for me. Could you please give me an example as to how I would write the code, if you don't mind? That should be enough for me. (Also, I need to be able to remove the side image sometimes. For example the beginning, which is all narration, and also when the main character doesn't have a name. How would I do that?)
You wouldn't know how from Wiki, it's pretty old...

Code: Select all

    # If there's a side image, display it above the text.
    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0
Add you picture instead of this code. (add Image("path")). You'll have to restyle the window as well but you've prolly done that for normal sideimages already.
Like what we're doing? Support us at:
Image

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: "Permanent" Side Images - How to?

#8 Post by Llunet1 » Thu Feb 27, 2014 5:20 pm

Thank you :) As to how to remove it though? I tried a variable but it gave me an error. However I did not write the code like that either... I will have to try it. Thank you!

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: "Permanent" Side Images - How to?

#9 Post by Llunet1 » Fri Feb 28, 2014 3:21 am

So I tried it out. It works! Thank you! I can probably get the variables to work. Thank you very much for your help! (I would never have figured this out)
I can't seem to be able to change the expression at the moment, however. I will continue trying this out and if I have any issues I'll write something again. Once again, thank you :)

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

Re: "Permanent" Side Images - How to?

#10 Post by xela » Fri Feb 28, 2014 4:18 am

Llunet1 wrote:I tried a variable but it gave me an error.
I do not believe that it should throw errors, if some_var:
add "image"
should work as long as that variable is declared. If it doesn't, try accessing it directly in store but that seems redundant.
Like what we're doing? Support us at:
Image

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: "Permanent" Side Images - How to?

#11 Post by Llunet1 » Fri Feb 28, 2014 7:34 pm

I got the variable to work, luckily. But, since I'm also trying to remove the side image sometimes or change expression, I need to know how to remove it. Do you know how? Or when adding the image, instead of putting the file name, how can I define the image with a name that will work in the screens.rpy?
I've looked around and tried multiple ways... But nothing has worked.

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

Re: "Permanent" Side Images - How to?

#12 Post by xela » Fri Feb 28, 2014 8:57 pm

I couldn't understand your post, please be as specific as possible on what needs to be done.
Like what we're doing? Support us at:
Image

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: "Permanent" Side Images - How to?

#13 Post by Llunet1 » Fri Feb 28, 2014 10:06 pm

Ah, sorry. Let me rephrase. I was asking for a way to make the image disappear (because the hide statement will not work for an image like that). However, I found a way to get it to disappear.
But, I have a new problem. ^^;
I want the expressions to change as well. Here's my code in the screens.rpy:

Code: Select all

if side_chara: #This variable indicates whether I want a side image or not
    if side_image:
        add side_image
    else
        add Image("pose1-normal-normal_a.png", xalign = 0.0, yalign = 1.0)
else:
    if side_image:
        add side_Image
    else:
        null
The problem is, while I can get my image to disappear, I cannot get my side image to appear. Is there something wrong with my code, perhaps? I have no errors popping up, just the side image will not appear. Also, I tested my variable "side_chara" both true and false before the side image would appear to make sure it wasn't the cause of the problem, but but nothing changed. And when I put back the original code (below) my side image will appear.

Code: Select all

if side_image:
    add side_image
else:
    add SideImage() xalign 0.0 yalign 1.0
And, also, I'm assuming that if I am able to get my side image to appear, it will appear above the image I set up, right? I can test that and figure it out later.
Thank you~

philat
Eileen-Class Veteran
Posts: 1763
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: "Permanent" Side Images - How to?

#14 Post by philat » Sat Mar 01, 2014 1:05 am

You're missing a colon after else in the code you posted, and the original code uses side_image rather than side_Image (capitalization). Without knowing more about how you defined your images, set up your variables, etc, that's about all I can say.

If you only need one character's side image, I imagine it would just be simpler to use ConditionSwitch and add that particular image.

Code: Select all

image character_side = ConditionSwitch(
    "exp == 'happy'", "side_happy.png",
    "exp == 'sad'", "side_sad.png")

# replace the add side_image part of the say screen with the following
if side_chara:
   add character_side

label start:
   $ exp = 'happy'
   "test happy expression"
   $ exp = 'sad'
   "test sad expression"

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: "Permanent" Side Images - How to?

#15 Post by Llunet1 » Sat Mar 01, 2014 3:32 am

Oh wow. That's interesting. o__o How was my code even working?

Um... I have different outfits (they don't get used too often, but they are needed) and many expressions. (This character has 10, and 5 outfits)
I tried the ConditionSwitch method, ignoring that though. I can probably put in variables and I think it would work, but I get an error:
NameError: name 'character_side' is not defined

I defined it in my "Sprite.rpy" file, which is separate from my script.rpy file and is written as:

Code: Select all

image character_side = ConditionSwitch(
    "e == 'n1_normal'", "pose1-normal-normal_a.png",
    "e== 'n1_speak'", "pose1-normal-speaking_a.png",
    xalign = 0.0, yalign = 1.0)
And for the screens.rpy, I used the exact same code as you wrote:

Code: Select all

if side_chara:
    add character_side
Once again, thank you for helping me. I really do appreciate this.

Post Reply

Who is online

Users browsing this forum: akakyouryuu, breadparty, doorknob22, Google [Bot]