Ren'Py Using LayeredImages for ImageMaps?

EYEOFLIE

New Member
Apr 13, 2021
4
0
Hello, trying to find solution so - How can i use layeredimage in imagemap functions, because looks like it requires only path to file, tried to find some answers in google and there but nothing found...

So i thinking about some ways:
1. Can i create image in directory using current layered image?
2. If try to use layered image as string 'imagename' when u init hover, idle, ground for imagemap itself, it'll work with some buggies? (Looks like)
3. It's possible? (Will be sad if not, like good engine and noone thought about that yet? xD)
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,976
16,231
Hello, trying to find solution so - How can i use layeredimage in imagemap functions, because looks like it requires only path to file, tried to find some answers in google and there but nothing found...
The question is: why do you want to do this ?

Firstly, imagemaps are depreciated, using imagebuttons instead offer more flexibility.

Secondly layeredimages are designed for sprites, and imagemaps aren't at all near to sprites.

Thirdly, basically speaking layeredimages are nothing more than a bunch of if, and therefore you can reproduce its behavior on a screen, by using a bunch of if coupled to add screen statements.
 

EYEOFLIE

New Member
Apr 13, 2021
4
0
The question is: why do you want to do this ?

Firstly, imagemaps are depreciated, using imagebuttons instead offer more flexibility.

Secondly layeredimages are designed for sprites, and imagemaps aren't at all near to sprites.

Thirdly, basically speaking layeredimages are nothing more than a bunch of if, and therefore you can reproduce its behavior on a screen, by using a bunch of if coupled to add screen statements.
0. Made bunch of images which wanna use as imagebuttons(aka hotspot), but with simple setting this like layered image in show statement, and use ofc once inited l.i for it, without dublications in code and etc.

1.Thought imagemap if place for placement imagebuttons like imagemap: main ground, hover ground with alpha, 1 imagebutton, 2 imagebutton, ofc if using ground + hover objects on hover layer with alpha (example gamemap)

2. Sad... that's why wanna find alternate, thank

3. ~understand what do u mean, but for me looks a bit hard xD, like layeredimage autofind files which me need because setuped right names, it's very cool, but looks like me need make copy in code special for screens as u said using 'add'.

So: How to reproduce or make new version of layered image which i can use and for show statement and screens with properties? if not: How to use this add correctly for same effect without tons of code like in layeredimage inition.

Bonus: What if i require transform animated imagebutton, like from lay-image 1 to lay-image 2, which will be repeat showed.

Thank u for previous answers ;3
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,976
16,231
0. Made bunch of images which wanna use as imagebuttons(aka hotspot), but with simple setting this like layered image in show statement, and use ofc once inited l.i for it, without dublications in code and etc.
It's not what I meant when asking you why you want to do this.

What I want to know is why you want to make the outdated imagemap use layered images, when both add and imagemap can use them without problem. Or, said otherwise, why trying to make this works:
Code:
screen whatever():
    imagemap:
        idle "layeredBackground"
        hotspot (x,y,w,h) action [...]
when that works fine:
Code:
screen whatever():
    add "layeredBackground"
    imagebutton:
        idle "layeredButton1"
        xpos x ypos y
        action [...]
 

EYEOFLIE

New Member
Apr 13, 2021
4
0
What I want to know is why you want to make the outdated imagemap use layered images, when both add and imagemap
Main question was about hot to make imagebutton which can support if and add as u said, for custom layeredimage, maybe created by class... i looked some of games and they have hardcoded, so i wanted to use simple things of renpy or ~simple code for that.
About why i wanna use, i have 2 .png for example, one with ground, second with all elements without background => ground + hover + hotspot (with broken a bit alpha so set to False and it's works fine when mouse in bound), that's work as i wanted.
But because this can't be used for imagebutton, for example if i want to place char sprite as button i should use imagebutton and find ~coord for looks fine, but also wanted supporting dynamic sprite as layered image. (Maybe is of duplicate of first msg of this post, but for clear)

Some bonus questions because learning renpy so hard and wanna know everything but sometimes info or doesn't exist ot work or not work as i want... (i know it's my mistake because low knowlage so wanna increase :3):

1. default Inventory = Class() saves info when reload about class objects in this object? example:
Code:
myobject = Inventory(properties)
myobject.list_of_items[0] = Item(properties) #Example and simplified without definition functions and etc, just showing what i mean.
+ should i use 'renpy.python.revatableobject' instead of 'object' or it's autohandle Class('revertableobject') if i'll set Class('object')

2. Can i somehow use use or call another screen with properties from using action's from current screen, like when hover or click?

3.seen this function in some of games and they are used this after calling a screen, what it does, prevent from Return to next possible label? (lower than current), tested, if i action return, it's continue current scene and doesn't call next block.
Code:
    def label_loop():
        _window_hide()
        while True:
            if not _in_replay:
                #Achv.check() #This were uncomented and looks each frame checked info
                pass
            result = ui.interact()
            if result:
                if type(result) == unicode:
                    return result
4. Somehow once i did this steps for check savability and setinfo into class like check what will be:
4.1 defaulted class object, increased value in that class some times in label, removed them from code, in label afterload checked existed attritube, value was stored, when i press back it's decreased count and when forward it's not increased. Looks like should be BUT, somehow i did back <> forward worked, after removing persistant data looks it's broken. This i did for check what to do in future if i'll need use save compability... but for simple saving\reload(and reload by reload R) loooks not requires.

5. Without action block in hotspot or imagebutton hovering doesn't work, so thats why requires NullAction() right?

6. + Forget some questions because 3days without sleep learning everythins xD... hope i can ask when remember, ofc first i'm spend tons of my time for search and test from google and etc.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,976
16,231
Ok, one last attempt before I quit...

About why i wanna use, i have 2 .png for example, one with ground, second with all elements without background => ground + hover + hotspot (with broken a bit alpha so set to False and it's works fine when mouse in bound), that's work as i wanted.
And like I said, it's exactly what this is doing:
Code:
screen whatever():
    add "someLayeredImage"
    imagebutton:
        idle "someOtherLayeredImage"
        action whatever

Some bonus questions because learning renpy so hard and wanna know everything but sometimes info or doesn't exist ot work or not work as i want... (i know it's my mistake because low knowlage so wanna increase :3):
Before doing this, you should start by understanding that imagemap and imagebutton are two different things. One that can't be used with layered images, and one that can.
 

EYEOFLIE

New Member
Apr 13, 2021
4
0
Sorry, i tested and understood it, but idk why -> when before i tried use imagebutton in screen... i got error like image can't be displayed in that case and etc..., my bad..., hope i could in future recieve answers for other question someday, but will try find solutions self or mb i'm again missed some parts and need new tests, stress affect to my mind so i can be wrong sometimes as everyone, sorry again.

P.S I'm not tried use hotspot as layeredimage because i'm understand isn't image... is a hotspot... just wanted to use hotspots + imagebuttons which are layered,why i didn't try what u said exactly by self before idk, my dumbness when tired by irl so strong...

What i thought before realized it's worked as should be:
#It's example of my cringe thoughts before, what i expected from your possible answer... and all started from error.. and my mistake xD

Code:
screen somescreen():
    imagebutton:
        add 'image1'
        if somecondence:
            add 'image2'
P.S Very helpfull and informativity answer, thank u again, hope i'll be better next time, it's my first time when i'm recieve good clear answers on forums, i'm think because i'm bad at expression of thoughts xD, so very glad.

Thread can be closed i think, if i'll not find answers for other questions, i'll create new, thank for help.