Ren'Py 7 Layered Image Attributes Problem (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
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#16 Post by trooper6 »

The Patreon article that PyTom posted showed that PyTom changed all the cases from CamelCase to LowerCase...so I think it isn't a bug. But it isn't obvious that it has to be that way. So...maybe better documentation?
I was able to get noeinan's sprite to work just by making everything lower case...then I was able to take out a bunch of needless code. I'm currently working on messing around with variants...and I think I just had a breakthrough!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#17 Post by kivik »

Ah! In that case it definitely needs to be documented properly - I did a search for "lower" on the layeredimage page and got zero hits. I was thinking about writing up an issue on github, but if there may be intension behind making it lowercased then perhaps I'd leave it!

I've learnt a lot that I otherwise wouldn't have about layered images with this thread so thank you for the discussion here!

I can almost see myself changing my layered images at some point but I'm not sure if it's worth it. I currently have my own function that takes various character attributes and output a file path directly, so I've kinda already solved a lot of problems in my game. But I still see potential of playing with the more "adhoc" images without resorting to writing functions for them, so that's pretty cool.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#18 Post by trooper6 »

The one of the big bonuses of the layered images as far as I can see is say_with_attributes. But I really need to get my mind around nesting. Because with LiveComposites you could do nesting Conditionals, and now you can't. So I'm still trying to work out something here.
Once I get some of this code finished I'll post it for the OP--but I have to go to dinner right now!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#19 Post by noeinan »

trooper6 wrote: Tue Jun 26, 2018 5:52 pm I've got it working so far, but I'm doing some more thorough testing and seeing if I can optimize some.
But I ran into that same bug from before about negating attributes with say-with-attributes
Thank you! I super appreciate it :D
kivik wrote: Tue Jun 26, 2018 6:17 pm Well this was fun... I stripped everything down to just your body and botarms up to try and get it working with no luck, so I said "Sod it, I'm using renpy.list_images() to see what Ren'py's actually pulled from the images" and this is what happens:

Renpy automatically drops the case for all your image names when it checks your image folder - so it generated aethl_botarms_up and not aethL_botarms_up. This seems to be fine if you declare your attributes manually, but it doesn't match if you use auto - which makes me think the auto keyword looks for case sensitive image names, but all image names are lowercase by default so it can't find the image!

I think this should be reported as a bug, but meanwhile you can overcome the issue by just making your image name all lowercase.
Oh! I didn't even think about the case, I had it as capital L just to make it more visible. (I've got my sprites L for left facing and R for right facing because I'm anal retentive and can't just flip the image when characters are asymmetrical, haha.) I just tried to remove the capital L from my code, but I am still getting the exact same results... Maybe there's more than one thing going on?
Image

Image
Image

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#20 Post by trooper6 »

So I have attached a working version of the layered image for you. I have renamed some of the image files to make this work. I'm working on a more complicated expression thing which is not included because I'm still working on it. Also, I added an image tag to the character so you can use say_with_attributes to add tags with your say statement rather than always having to use show.

I also have gotten rid of a bunch of code you didn't need that revolved around defining images.

So first off, list of images:

Code: Select all

mages/bg/bg forest001.png
images/spr/aeth/aethl_arms_nude_crossed.png
images/spr/aeth/aethl_arms_nude_slack.png
images/spr/aeth/aethl_arms_nude_up.png
images/spr/aeth/aethl_arms_vest_crossed.png
images/spr/aeth/aethl_arms_vest_slack.png
images/spr/aeth/aethl_arms_vest_up.png
images/spr/aeth/aethl_bangs_bangs.png
images/spr/aeth/aethl_bangs_none.png
images/spr/aeth/aethl_base_nude.png
images/spr/aeth/aethl_base_vest.png
images/spr/aeth/aethl_brows_angry.png
images/spr/aeth/aethl_brows_neu.png
images/spr/aeth/aethl_brows_sad.png
images/spr/aeth/aethl_brows_up.png
images/spr/aeth/aethl_cloak_closed_hood.png
images/spr/aeth/aethl_cloak_closed_plain.png
images/spr/aeth/aethl_cloak_open_hood.png
images/spr/aeth/aethl_cloak_open_plain.png
images/spr/aeth/aethl_ears_down.png
images/spr/aeth/aethl_ears_half.png
images/spr/aeth/aethl_ears_up.png
images/spr/aeth/aethl_eyes_away.png
images/spr/aeth/aethl_eyes_closed.png
images/spr/aeth/aethl_eyes_half.png
images/spr/aeth/aethl_eyes_neu.png
images/spr/aeth/aethl_eyes_shut.png
images/spr/aeth/aethl_eyes_wide.png
images/spr/aeth/aethl_mouth_bigsmile.png
images/spr/aeth/aethl_mouth_frown.png
images/spr/aeth/aethl_mouth_gasp.png
images/spr/aeth/aethl_mouth_laugh.png
images/spr/aeth/aethl_mouth_neu.png
images/spr/aeth/aethl_mouth_smile.png
Next the definition of the layeredimage:

Code: Select all

##############################################################################
# Layered Images
#
# Controls all Dynamic Characters
layeredimage aethl:
#Eyebrows > Eyes > Mouth > Cloak > Bangs > Ears > Arms > Base
    group base auto:
        attribute vest default

    group arms if_any "nude" auto variant "nude":
        attribute slack default
    group arms if_not "nude" auto variant "vest":
        attribute slack default

    group ears auto prefix "ears":
        attribute down default

    group bangs auto:
        attribute bangs default

    attribute cloak null
    group cloak if_all ["cloak", "up"] auto variant "open":
        attribute plain default
    group cloak if_any "cloak" if_not "up" auto variant "closed":
        attribute plain default

    group mouth auto prefix "mouth":
        attribute neu default

    group eyes auto prefix "eyes":
        attribute neu default

    group brows auto prefix "brows":
        attribute neu default
And the script code that tests out different combinations:

Code: Select all

efine narrator = Character(None, what_color = "#000000", what_outlines=[( 0, "#A3A3A3", 2, 2 )])
define black_screen = Character(None, what_color = "#FFFFFF", what_outlines=[( 0, "#808080", 2, 2 )])[attachment=0]AethLayeredImage.zip[/attachment][attachment=0]AethLayeredImage.zip[/attachment])

define aeth = Character("Aeth", what_color = "#000000", what_outlines=[( 0, "#A3A3A3", 2, 2 )], image = "aethl")

#Defining Transformations
define slow_dissolve = Dissolve(1.0)
define fast_dissolve = Dissolve(0.25)

transform ease(start, end, time):
    subpixel True
    start
    easein time end

# The game starts here.

label start:
    black_screen "The air is cold, carrying the strong smell of pine, which I've always associated with home."

    scene bg forest001 with slow_dissolve
    show screen image_attributes

    show aethl at ease(offscreenleft, left, 2.0)

    "I step out into the crisp snow, pulling my hood down to get a better view."

    #Base Test
    aeth nude "You can use say-with-attributes to add attributes while saying. I am now nude."
    aeth -nude "This should get rid of the nudity, but it doesn't. I'm pretty sure this is a bug."
    show aethl -nude
    aeth "But you can get rid of an attribute using the show command. I shouldn't be nude anymore."

    #Arm Test
    aeth "Now let's test the arms. Currenlty my arms are slack."
    aeth up "Now they are up!"
    aeth crossed "Now they are crossed."
    aeth slack "Now they are slacked again."

    aeth "You can also do this the longer way with show statements."
    show aethl up
    aeth "Now my arms are up."
    show aethl crossed
    aeth "Now my arms are crossed."
    show aethl slack
    aeth "Now my arms are slack."

    #Cloak Test
    aeth "Now I want to test out the cloak."
    aeth cloak "How does this work?"
    aeth up "What happens when I add up?"
    show aethl -up "Now I'm removing up."
    aeth hood "Does this add the hood?"
    aeth up "What does this do when I add up?"
    show aethl -up
    aeth "No more up."
    show aethl -hood
    aeth "No more hood."
    show aethl -cloak
    aeth "No more cloak."

    #Ear Test
    aeth "Now I'm going to show you the ears. Note there is a more complicated way to do this, but I'm still working on it."
    aeth "My ears are down."
    aeth ears_up "Now my ears are up."
    aeth ears_half "Now my ears are half mast."

    # This ends the game.

    return
Attachments
AethLayeredImage.zip
(2.07 MiB) Downloaded 65 times
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#21 Post by noeinan »

trooper6 wrote: Wed Jun 27, 2018 12:47 am So I have attached a working version of the layered image for you. I have renamed some of the image files to make this work. I'm working on a more complicated expression thing which is not included because I'm still working on it. Also, I added an image tag to the character so you can use say_with_attributes to add tags with your say statement rather than always having to use show.

I also have gotten rid of a bunch of code you didn't need that revolved around defining images.
Wow, thank you so much! You both have helped me so much I really, really appreciate it. <3 This code works great and you formatted it in a way that shows me directly how to use the new code. (I have a disability that has impacted my mental acuity in recent years, so the extra time you took to format it in an easy to absorb manner means so much to me.)

It also really helps to know that I don't need that image definition code anymore. I've just been keeping it in because it used to be necessary and I was too worried to remove it, haha. Thank you very much again! I'll keep an eye out for the progress on the nested groups you mentioned too.
Image

Image
Image

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#22 Post by trooper6 »

I was able to get around the nested groups you had going on with the cloak by using a null attribute, and I’m pretty proud of that. I’m hoping that insight willl help with my own project.

I’m currently working on facial expressions and that is the more complicated thing I’m looking at. Once I get things done, I’ll share!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#23 Post by kivik »

I wish there's a like button in this forum :P Great work trooper6!! I'd forgotten / missed that neoinan had trouble with the cloak and didn't explore that, I'll have to see if that applies to one of my situations.

Also, I should probably explore how to use renpy.say() with attributes since I pass my character around a lot with labels and functions, then I can perhaps utilise these features more!

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem

#24 Post by noeinan »

trooper6 wrote: Wed Jun 27, 2018 1:49 am I was able to get around the nested groups you had going on with the cloak by using a null attribute, and I’m pretty proud of that. I’m hoping that insight willl help with my own project.

I’m currently working on facial expressions and that is the more complicated thing I’m looking at. Once I get things done, I’ll share!
Thank you, I will definitely study this code and learn from it too! I look forward to seeing the expression code, since expressions are definitely something I'm using with a lot of variance in my project too. This new way of doing layers will also help a lot since it is more simple, and I can get my writer to just type into renpy directly. He is afraid of coding so the new simplified way of changing images on the go is great!

kivik wrote: Wed Jun 27, 2018 3:10 am I wish there's a like button in this forum :P Great work trooper6!! I'd forgotten / missed that neoinan had trouble with the cloak and didn't explore that, I'll have to see if that applies to one of my situations.

Also, I should probably explore how to use renpy.say() with attributes since I pass my character around a lot with labels and functions, then I can perhaps utilise these features more!
I have also often thought it would be great to have a like button, haha. Also the ability to unfollow threads that are no longer relevant. I agree that the say with attributes is a really interesting feature! I honestly wouldn't have realized I could do that without this code. Thanks again for your help!
Image

Image
Image

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem (solved)

#25 Post by Remix »

Just for info:

It looks like a recent nightly commit is targeted at solving the --- eileen -woolyhat "ooh the sun has come out" --- say attribute passing.

https://github.com/renpy/renpy/commit/5 ... b99a30ae73
Frameworks & Scriptlets:

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Ren'Py 7 Layered Image Attributes Problem (solved)

#26 Post by trooper6 »

That is awesome! I’ll see if I can download the nightly build from the launcher.

I just came upon a slightly larger irritation in my life, I got everything working in my test project, but when I transferred it over to my old project the layered images weren’t working properly.

I think because my original project was made before 7.0
So I think I need to recreate my game as a fresh project...it is just that my project uses a legacy theme...so I have some work to do creating buttons and working out how to replace things.

But we are getting there!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: No registered users