Place Ren'py image in a Python list?

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
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Place Ren'py image in a Python list?

#1 Post by SuperbowserX »

To make a long story short; I need to place Ren'py images in a list so that the say screen can evaluate whether or not that image is in that list.

Code: Select all

image sean happy = ....
My goal is to place this inside a list. However...............

Code: Select all

$ lefty = [sean happy]
$ lefty = ["sean happy"]
Neither of these work. Is there a way to do this with Python?

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

Re: Place Ren'py image in a Python list?

#2 Post by philat »

I think the issue is more how are you evaluating whether the image is in that list?

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: Place Ren'py image in a Python list?

#3 Post by SuperbowserX »

Lemme elaborate more. So, in a redesign I have been... considering... I want to make it so that the only character portrait that shows on screen is that of the currently speaking character.

Now there are 2 positions the character can be on. The left side (usually the one the player character is in), or the right side.

Now in each scene, which character will appear at which side is going to change. So my idea is, at the start of each scene, I could update a list variable called "lefty" to include all the possible character images for who will want to be shown on the left side in that screen.

As for the say screen: it would then check if the character image being used is in the lefty list. If it is, show it on the left-hand side of the screen. If it isn't, show it on the right-hand side and horizontally flip the image.

User avatar
Scribbles
Miko-Class Veteran
Posts: 636
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

Re: Place Ren'py image in a Python list?

#4 Post by Scribbles »

SuperbowserX wrote:Lemme elaborate more. So, in a redesign I have been... considering... I want to make it so that the only character portrait that shows on screen is that of the currently speaking character.

Now there are 2 positions the character can be on. The left side (usually the one the player character is in), or the right side.

Now in each scene, which character will appear at which side is going to change. So my idea is, at the start of each scene, I could update a list variable called "lefty" to include all the possible character images for who will want to be shown on the left side in that screen.

As for the say screen: it would then check if the character image being used is in the lefty list. If it is, show it on the left-hand side of the screen. If it isn't, show it on the right-hand side and horizontally flip the image.
I think you could accomplish only having the speaking character on screen with side image, you can adjust it's position. Not sure if that exactly what you wanted though.
Image - Image -Image

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

Re: Place Ren'py image in a Python list?

#5 Post by philat »

So is the question ACTUALLY "how do I check if an image is showing based on a list"? To be clear, I have never thought of this and don't know the answer without giving it some more thought, but before doing so, it makes sense to know if that is actually what you are trying to do.

That said, given your explanation, I think it makes more sense to do this by character (rather than image). The say screen gets fed the character name by default, so if who in list_lefty seems like a much easier way of accomplishing what you're trying to do.

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: Place Ren'py image in a Python list?

#6 Post by SuperbowserX »

good idea. Is there a way to add character objects to a Python list?

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

Re: Place Ren'py image in a Python list?

#7 Post by philat »

The who in the say screen is just the character name (i.e., "Eileen", not "e" or the character object e).

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]