im.MatrixColor changing hue value on a DynamicImage?

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
Frynler
Newbie
Posts: 7
Joined: Mon Dec 19, 2016 8:45 am
Contact:

im.MatrixColor changing hue value on a DynamicImage?

#1 Post by Frynler » Tue Dec 20, 2016 6:17 pm

I feel kinda bad for asking so much on this forum lol

But i lose nothing for asking, so here it goes!

If you have read my previows posts, i doing some kind of customizable clothing system.

So far thanks to the help from the people on this forum I managed to make almost everything, the only thing that remains regarding clothing customization is the colors.

I managed to get the im.MatrixColor working on a single, regular image.

However, when i try to replicate that on my dynamic images, I don't know how to make it work.

Here is how i got the one that works (without variables so it really doesnt do the trick for me, that is why im asking!)

image scene1 = im.MatrixColor(
"images/s1/s1_base.png",
im.matrix.hue(20))


This changes the hue from the scene1, however since the player will be able tu set multiple different colors, its just not realistic to set every different color on a different variable.

So instead i was trying to do it on the fly like this:

$ legs = "images/s0/s0_" + underwear + ".png"
image girl = Fixed(DynamicImage("[legs]"))


This method allows me to change the clothing on every scene without much effort. The bad thing is that I dont know sh** about python (or programming in general for that matter) so I dont really know the way I should include what i want. I already tried a few optnios that came to my mind, since i found nothing about this on the documentation about both the IM.MatrixColor and the dynamic images.

This is more or less what I tried:

$ legs = im.MatrixColor("images/s0/s0_" + underwear + ".png", im.matrix.hue(20)) # <---------- this didnt work!

image girl = Fixed(im.MatrixColor(DynamicImage("[legs]"), im.matrix.hue(20))) <------------ this didnt work neither!


I've tried many more things, and the further i got was getting the compiler to not crash and not getting an error message ingame.

Whenever I got a compiling error it would say something like wrong syntax or expecting int or similar stuff, ingame errors were along the lines of "couldnt find image (im.MatrixColor...etc)"

So yeah, the documentation didnt help me much neither so my last resort as always is asking the considerably-more-experienced forum users.

Any insight on how can i achieve this?

Also, is there any page that explains the overall terminology/structure of renpy's programming to know what to do in case those kind of silly things related to "not knowing where to place what" happens?

Again thanks for your patience with me!

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: im.MatrixColor changing hue value on a DynamicImage?

#2 Post by nyaatrap » Wed Dec 21, 2016 9:50 am

im manipulators only takes image files or images manipulated by other im manipulators.
You have to use DynamicDisplayable to include im manipulators instead of DynamicImage.
It's a bit difficult to understand, so I'll paste portion of my game code as example. Doll is an object that stores variables.

Code: Select all

init python:
    def draw_doll(st, at, doll):
            # Function that is used for dynamic displayable.

            layers=[]
                
            for layer in doll.layers:
                    image = "{}/{}/{}.png".format(doll.folder, doll.layer, doll.item)
                    # image =  im.MatrixColor(image) #write your own code
                    if renpy.loadable(image):
                        layers.append(image)

            return Fixed(*layers, fit_first=True), None

image paperdoll = DynamicDisplayable(draw_doll, doll)
Full code: https://github.com/nyaatrap/renpy-utili ... ressup.rpy

Frynler
Newbie
Posts: 7
Joined: Mon Dec 19, 2016 8:45 am
Contact:

Re: im.MatrixColor changing hue value on a DynamicImage?

#3 Post by Frynler » Wed Dec 21, 2016 5:04 pm

nyaatrap wrote:im manipulators only takes image files or images manipulated by other im manipulators.
You have to use DynamicDisplayable to include im manipulators instead of DynamicImage.
It's a bit difficult to understand, so I'll paste portion of my game code as example. Doll is an object that stores variables.

Code: Select all

init python:
    def draw_doll(st, at, doll):
            # Function that is used for dynamic displayable.

            layers=[]
                
            for layer in doll.layers:
                    image = "{}/{}/{}.png".format(doll.folder, doll.layer, doll.item)
                    # image =  im.MatrixColor(image) #write your own code
                    if renpy.loadable(image):
                        layers.append(image)

            return Fixed(*layers, fit_first=True), None

image paperdoll = DynamicDisplayable(draw_doll, doll)
Full code: https://github.com/nyaatrap/renpy-utili ... ressup.rpy
Thanks for your help as always!

Still, I'm gonna be honest, I've been trying to figure out not only how your code works but also how it is structured, and I just can't get the hang of it.
Much less get it to work on my game, lol.

I hate to say this after all the great help I got from you and other people in this forum, but since im studying C# now, I'm going to try and do the visual novel in unity instead since it uses C# and will probably be less painful for me, because I hate getting stuck on every little detail.

Still, Renpy is a great software, and if I were to do a more simple novel like the regular dialogue focused multiple-ending novel, i would be able to do it without problems at all.

But I want to be do more than that if possible. If my luck with unity is as bad, I will come back to renpy and just skip all the hard game mechanics like clothing system and stick to the dialogue and menu options.

Otherwise i feel like im going to hate the process of developing my game, and that is something terrible for me!

It's something I make for joy, so I should never hate the process!

So again, sorry for this! if I ever get to release the game I will surely credit this forum in the credits no matter what engine it gets released on!

Thank you all for being so nice!

chaos-dark-lord
Newbie
Posts: 8
Joined: Sun May 07, 2017 3:59 pm
Deviantart: chaos-dark-lord
Contact:

Re: im.MatrixColor changing hue value on a DynamicImage?

#4 Post by chaos-dark-lord » Sun Jun 04, 2017 9:48 pm

This is merely related, but how do you use various imags manipulators for the same image, like showing a desaturated image that is also flipped?

Im trying this:

Code: Select all

image h huf inner flip= im.MatrixColor("images_jackie/jackie_huffy_proud.png",im.matrix.saturation(0.4)*im.matrix.brightness(-0.1), im.Flip(horizontal=True) )
But I run into an exception that says : TypeError: __init__() takes at least 2 arguments (2 given)

Post Reply

Who is online

Users browsing this forum: Adrian_DVL, Google [Bot]