How to make icons (imagebutton?) not dissappear, especialy on imagemaps?

M-77

Newbie
Sep 18, 2017
82
23
Hello, I put my Affection Points (and money) this way (see code at bottom), and want make more icons this way but with inter action.
And now, can anyone tell me (show your code) with what simple command (overscreen?) I can made to get the icons stay on screen during idle maps room. Not dissapearing?
Only hide if mousewheel clicked.
I also need some of them on or off (this is easy with the show screen... True/False command, already get this) in some events.
But how to made them react if clicked with the mouse? To open a inventory (not done yet) when clicked on the backpack icon, for example?
Open some quest list when the communicator is clicked. Jump back from one room to stage corridor.Or back from a niche/bath to a room if the "back" icon is clicked.
What is the simple right command with which parameters for that? (Some "action"+ "clicked" + "jump" I think).
I also want to set position in pixles not the strange Renpy Xpos, Ypos, anchor, etc. metrics because I have to place my icons accurate by pixel and knowing where.
Or have I to do every room as idle map now? But then no chance to made icons hide as they are pasted in on the bg graphics.

In script.rpy:
Code:
# Elie LP meter icon and display
init -2 python:
showlove= False
Elie_love = 100
max_love= 150
# def display_love():
# if showlove:
#This next line is optional. It adds a heart image under the text.
#Not use because shows up on left ui.image("HUD_LP_idle.png")
#Not use ui.text(" %d" %Elie_love, color="#ff0000")
#Not use config.overlay_functions.append(display_love)
# Money Meter (Gulden) icon and display
init python:
showgulden= False
Gulden = 100
max_gulden= 9999
# def display_gulden():
#Not use because shows up on left if showgulden:
#Not use ui.frame() #This is optional. It adds a frame around the text.
#Not use ui.text("Gulden: %d" %Gulden)
#Not use config.overlay_functions.append(display_gulden)
#Communicator
init python:
showcom= False
Communicator = 0
max_com= 1
#Inventory icon
init python:
showcom= False
Inventory = 0
max_inv= 1
#Map icon
init python:
showmap= False
Map = 0
max_map= 1
#Back icon
init python:
showback= False
Back = 0
max_back= 1
The [Day] variables here are leftovers, are not used. Not needed.
In screns.rpy:
Code:
#Money+Love Points screen display a coin and heart icon on top right screen with the amount in possession for each one on them
#Money Points screen
screen money():
frame:
xpos 0.91
ypos 0.06
textbutton "{b}Day [Day]{/b}" action If(renpy.get_screen("money_box1"), Hide("money_box1"), Show
("money_box1"))

screen money_box1():
vbox xpos 0.951 ypos 0.056:
image "Gulden.png"
text "{b} [Gulden]{/b}" color "#000000" yoffset -61 xalign 0.40

#Love Points screen
screen elie_love():
frame:
xpos 0.91
ypos 0.06
textbutton "{b}Day [Day]{/b}" action If(renpy.get_screen("elie_love_box1"), Hide("elie_love_box1"), Show
("elie_love_box1"))
screen elie_love_box1():
vbox xpos 0.951 ypos 0.140:
image "HUD_LP_idle.png"
text "{b}[Elie_love]{/b}" color "#cd2626" yoffset -65.5 xalign 0.49
#Communicator Icon screen display a sort of mobilephone icon on upper right screen
screen communicator():
frame:
xpos 0.91
ypos 0.06
textbutton "{b}Day [Day]{/b}" action If(renpy.get_screen("com_box1"), Hide("com_box1"), Show
("com_box1"))
screen com_box1():
vbox xpos 0.933 ypos 0.306:
image "HUDCOM_idle001.png"
#Inventory Icon screen display a backpack icon on upper right screen, has still to be linked to an inventory script
screen inventory():
frame:
xpos 0.91
ypos 0.06
textbutton "{b}Day [Day]{/b}" action If(renpy.get_screen("inv_box1"), Hide("inv_box1"), Show
("inv_box1"))
screen inv_box1():
vbox xpos 0.933 ypos 0.417:
image "HUDINV_idle001.png"
#Map Icon screen, optional as Map icon appears on idle maps too, used to go back to stage overmap
screen map():
frame:
xpos 0.91
ypos 0.06
textbutton "{b}Day [Day]{/b}" action If(renpy.get_screen("map_box1"), Hide("map_box1"), Show
("map_box1"))
screen map_box1():
vbox xpos 0.933 ypos 0.529:
image "HUDMAP_idle001.png"
#Back screen, icon appears on idle maps too, to go one room back to stage map, not overmap. Or to exit from idle maps in rooms
screen back_box1():
frame:
xpos 0.933
ypos 0.06
textbutton "{b}Day [Day]{/b}" action If(renpy.get_screen("back_box1"), Hide("back_box1"), Show
("map_box1"))
screen back_box1():
vbox xpos 0.940 ypos 0.652:
image "HUD_back001_idle.png"
I also try again and changed the screen for the map (for example) this way, but with no change:
Code:
#Map Icon screen, optional as Map icon appears on idle maps too, used to go back to stage overmap
screen map_box1():
    imagebutton:
        idle "HUDMAP_idle001.png"
        hover "HUDMAP_hover001.png"
        xpos 0.933 ypos 0.529
        focus_mask True
        action Jump("HUD000aidle")
Who can help?
 

f95zoneuser463

Member
Game Developer
Aug 14, 2017
219
1,024
And now, can anyone tell me (show your code) with what simple command (overscreen?) I can made to get the icons stay on screen during idle maps room. Not dissapearing?
Don't have the time right now to dig through this, from a quick look at it I believe you need to have a ZORDER and/or LAYER defined in your screens. If I remember correctly with the layers Ren'Py knows what is considered part of the UI and can then show/hide it with H/mousewheel.


Just a wild guess from the back of my head ... could be completely wrong.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,225
Who can help?
It's really confusing.
I looked at the code twice and can't find something preventing it to works correctly ; well, once I mentally added the correct indentations, obviously. Talking about this, please, use the [code] [/code] tag for your code.

So, like the code is correct, I assume that you just never told Ren'py to show the screens...
 

M-77

Newbie
Sep 18, 2017
82
23
Thank for the quick responses, "f95zoneuser463", i know this documentations, but the trick is find out what command is the right one and where to put it with others to get the desired result. Best way to find out is doing it yourself. But I am not yet 100% happy with my results.

Hello "anne O´nymous", I used the "show screen ... +True/False" command, and yes the icons show up and work, but only on ground images, normal jpg/png, but not on the double -idle/hover imagemaps. So I think i have to glue on the imagemaps like the other buttons there how I need them. And let them working on the other normal pics like the textbox. Or there is some "overlayer" command that made them also show up on the imagemaps too. But where tell renpy to do this, inside the imagemap labels? "show screen ..." has not worked inside them. And is it possible to made the imagemaps not pop up with dissolve after the groundimage? Is not very eyefriendly.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,225
but not on the double -idle/hover imagemaps.
What do you call "imagemap" ? Because you didn't used a single imagemap in the code you gave.

Honestly I understand nothing about your problem. Not because of your english, but because it totally confuse me. The code you gave have no reason to not works and you talk about imagemap without using them.
So, what's the problem ? Are you trying to use the imagemap statement without even writing it a single time in your code ? Are you trying to do something else that you call "imagemap" ? I don't know.
The only thing I know is that you answered that you know about the page that @f95zoneuser463 linked. Therefore, you can't be talking about Ren'py " ". I mean, despite the fact that it's not this clear, the example clearly show that it doesn't works the way you did it.
 

M-77

Newbie
Sep 18, 2017
82
23
Ah Yes, I just code since 3 months. So all is new to me. For example, on the first part of this label the icons show up, then when hiding the normal images (jpg/png) the room changes to a same looking imagemap. To be able to interact with it. And here the icons do not apear, clicking on the positions works neverthless.
Code:
label go_home:
show AShipStage2A0041_idle with dissolve
show Elie_stand_ssuit001 at left with dissolve
e "I chose to go to my room to take a look at the map."
e "Anyway..."
hide Elie_stand_ssuit001
hide AShipStage2A0041_idle
#Back button -imagebutton or vbox planned here.
show screen money_box1
show screen elie_love_box1
show screen com_box1
show screen inv_box1
show screen map_box1
show screen back_box1
screen your_room1():
    imagemap:
        xpos 0
        ypos 0
        idle "images/AShipStage2A0041_idle.png"
        hover "images/AShipStage2A0041_hover.png"
        hotspot (1797, 575, 127, 124) action Jump("HUD000aidle")
        hotspot (1804, 702, 106, 40) action Jump("Stage_2")
        hotspot (505, 435, 125, 70) action Jump("Vitrine001_Elie") alt "vitrine001_elie"
        screen map_box1
I would be fine if you can show me what variable I have to add after the "layer" command in my screens.rpy.
Renpy tells my i miss some.
Code:
#Map Icon screen, optional as Map icon appears on idle maps too, used to go back to stage overmap
screen map_box1 layer ...???.... (): #<- What I miss here? Definition, variables?
    imagebutton:
        idle "HUDMAP_idle001.png"
        hover "HUDMAP_hover001.png"
        xpos 0.933 ypos 0.529
        focus_mask True
        action Jump("HUD000aidle")
Interessting.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,225
Code:
screen your_room1():       
        [...]
        screen map_box1
Er... what's the supposed meaning of this line ? For Ren'py, here you're trying to define a new screen named "map_box1".


Renpy tells my i miss some.
Code:
screen map_box1 layer ...???.... (): #<- What I miss here? Definition, variables?
Like explicitly said in the documentation, what's missing is the name of the layer. And I'm not sure that it can be wrote like this (all the property in the declaration line).
Code:
screen map_box1:
    layer NAME_OF_THE_LAYER
   [...]
 

M-77

Newbie
Sep 18, 2017
82
23
Hello AON, the first one is a room with objects to interact. And the line at the end I add in to be able to leave the room with this map icon, but it is not showed. It was planned to show the icon on this room imagemap. Exiting is working.

The second one is meant to show the icon on a layer which name I not know because I not found out yet on what layer the textbox is displayed. This way I wanted to bind the map icon and others for my gui with the text box. This is funny. On wich layer is the textbox/dialog displayed?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,225
And the line at the end I add in to be able to leave the room with this map icon, but it is not showed.
Sorry if I'll look harsh but are you sure that you want to code ?
I understand that you never ever did it three months ago, which mean you have absolutely no experience. But here it's not a question of experience, nor a question of knowledge, but a question of understanding.
There's nothing, absolutely nothing, whatever it's in the Ren'py documentation or any other source of knowledge you can find concerning Ren'py, that can lead to "hey, if I put screen NameOfaScreen here, perhaps that it will show the screen when the player will do this". Anyone who've understood the basis of Ren'py know that it will not works, even if, perhaps, they don't know why it will not. It's just that "screen NameOfaScreen", is the line to introduce a screen declaration, while you're trying to... I'm not even sure to have understood what you expected to happen ; some kind of "jump then show" or something like that.
Like you don't use a bottle to write a letter, you don't use "screen NameOfaScreen" to do what you expected. It's neither creativity or improvisation, it's just random. And coding is the opposite of random. It don't works this way and will never works this way.

Perhaps that coding is just not a thing for you. And that's alright. As individual we all are facing way more things that aren't for us, than things that we can do. It's what make us both human and different.
Take me by example. Coding is my job, which mean that I have some scientist background. Still don't expect me to be electrician. I know the physics behind it, I know (well, there's more than twenty years that I left school, so it's probably more "knew") the equations, but I just can't make all this work together in a way that can make me work as electrician. And that's just alright. Nobody, perhaps except my children, ever expected from me to know everything and be able to do everything.

So, I don't know... read the documentation, this time with in mind the absolute fact that you need to understand the meaning behind it. It's not scholar knowledge, you can't just blindly rehash it with a fifty/fifty chance to have the point, it's practical knowledge. If you don't understand it, you'll never be able to use it correctly.
Or, if it happen that it's really not a thing for you, just find someone to works with you, someone that will do the code. Because actually you clearly aren't ready to code your own game, it's the opposite. This whatever how many help you can have from others.
 

Aeilion

Member
Jun 14, 2017
125
144
Sorry if I'll look harsh but are you sure that you want to code ?
I understand that you never ever did it three months ago, which mean you have absolutely no experience. But here it's not a question of experience, nor a question of knowledge, but a question of understanding.
There's nothing, absolutely nothing, whatever it's in the Ren'py documentation or any other source of knowledge you can find concerning Ren'py, that can lead to "hey, if I put screen NameOfaScreen here, perhaps that it will show the screen when the player will do this". Anyone who've understood the basis of Ren'py know that it will not works, even if, perhaps, they don't know why it will not. It's just that "screen NameOfaScreen", is the line to introduce a screen declaration, while you're trying to... I'm not even sure to have understood what you expected to happen ; some kind of "jump then show" or something like that.
Like you don't use a bottle to write a letter, you don't use "screen NameOfaScreen" to do what you expected. It's neither creativity or improvisation, it's just random. And coding is the opposite of random. It don't works this way and will never works this way.

Perhaps that coding is just not a thing for you. And that's alright. As individual we all are facing way more things that aren't for us, than things that we can do. It's what make us both human and different.
Take me by example. Coding is my job, which mean that I have some scientist background. Still don't expect me to be electrician. I know the physics behind it, I know (well, there's more than twenty years that I left school, so it's probably more "knew") the equations, but I just can't make all this work together in a way that can make me work as electrician. And that's just alright. Nobody, perhaps except my children, ever expected from me to know everything and be able to do everything.

So, I don't know... read the documentation, this time with in mind the absolute fact that you need to understand the meaning behind it. It's not scholar knowledge, you can't just blindly rehash it with a fifty/fifty chance to have the point, it's practical knowledge. If you don't understand it, you'll never be able to use it correctly.
Or, if it happen that it's really not a thing for you, just find someone to works with you, someone that will do the code. Because actually you clearly aren't ready to code your own game, it's the opposite. This whatever how many help you can have from others.
This is certainly problematic.

That said if we go over this lack of understanding or whatever it is.
In the end I think the answer was given from the first message.
If I understood the trick, when you display your imagemap (it's not the case in the code that you show), other screens (including your map_box1) disappear.
But in reality they are just hidden behind your imagemap (or rather your screen your_room1) so a little zorder will fix the problem.

What is a pity is that you seem to want to use complicated things that you do not understand while I'm certain that with a little work you could (possibly) create the game you want, without having to go through this.

The impression I have is that you saw a game that you liked, you took the code, copied it by telling you that you only have to change the name of the images etc ...

Maybe you should start from scratch, ask yourself the question of what you really want and try to understand how to do it.
Example ... Do you want to show an image and also buttons?
Learn to show an image and learn to show buttons. Then learn to do both at the same time. But learn ...

Or, as Anne says, ask someone.
 

M-77

Newbie
Sep 18, 2017
82
23
Hello you two, thank´s for your help and quick responses.
All I wanted are some examples how to code such a definition, zorder seems to be the right one:
Code:
define_screen(your_room1, zorder="0")
(Not working of course) I put this at the beginning of my script. But I want to define this room individual, if later in game it will be reused. So did i place it right? Or has the string to be right when I let renpy "show screen your_room1" Please give me an example how it has to look (A string). I need something to compare.

I best learn by doing it. I code our game myself, has some 30+ min. playtime now, some special effects, camera pan, zoom in, animation, animated layers... But I also do the story+research for it, draw the pre-sketches for my artist, he draws back, I have to superwise if they fit in, then he finishes them. I also downsize, this all takes time. We have time. So I was not 3 months coding, but mostly doing this other stuff, and of course private live work. I started from scratch coding, Renpy is easier then I thought first. I coded back in 1988 with CP/N at my Mothers school a little during her breaks. 1991 I coded LOGO+some basic, later BATCH files in MS-Dos 6.2, GRASPRT around 1995, NEOSHOW 1998. Tried HTML in 2002, etc. so Renpy is similar in function. I only get the screen button code parts from a game for tryout, I have another method erlier from lema forums, like you can see and I wrote above about leftovers there, but wanted some other button.
I can also do a plump jpg with only screens on it, for the mobiliar the player has to interact with as well as the screenbuttons, not using a imagemap. Could work because Renpy is flexible. Also I can hack through other games to look for that, but I do not want now, maybe later for compareing purposes.
 

Aeilion

Member
Jun 14, 2017
125
144
Code:
screen your_room1():

    zorder -1
    imagemap:
          blablablabla..
Keeping what you already coded.

But I should not ... Because by typing "renpy screen zorder" in google (or other), you would have found immediately ... So I'll stop there for my part.



If that does not solve your problem, I'm sorry. I'm sure you'll find.
 
  • Like
Reactions: M-77

M-77

Newbie
Sep 18, 2017
82
23
Thank you Aeilion, this worked. Yes I read this renpy doc. But not in recent time, so not remembered. Have this and other saved in my tutorials files. But not understand if this has to be defined somewhere like in screens.rpy or script.rpy like done with the images or characters before "label start". Now it is easy a single command, just like defining how the images have to be shown.
Such long string has confused me: "renpy.define_screen(name, function, modal="False", zorder="0", tag=None, variant=None)"
So its just the one command what is need to pick out, from that string. Others only if need in addition.
Another similar is the "behind" command then, I already learned to use.