Problem with imagemaps.

Mephistofeles

Active Member
Jul 9, 2017
647
721
While is fixed my last problem with imagemaps, i still have 2 big problems that i could really use some help with.
1- My map have a huge black line in the left: For some reason , the thing from the first image keep happening, even when the map is the correct size for the renpy this time. As you can see, the left part of the screen keeps a huge gap between the actual map and the screen, and i have no idea why. When i use the same image as a normal image and not a imagemap this doenst happen.
2- My jumps to label dont work as they should: When i create a new label in the script after the map, and create a hotspot in the imagemap for it, the game instead jump automatically to the next label, witout any input from the player. It shows the imagemap, but continue with the label over it, like is a background, and not when clicking where the hotspot is.

Any help is apreciated, im very excited about this proyect but im still very new with programing and renpy using.

1615496617914.png
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,584
2,227
Best guess, your mapa.jpg file is a different resolution than your game.


Also... You can copy/paste your code by highlighting and copying the code within Atom, then paste here into the forums.

To keep the formatting (mainly the indenting), highlight the code in Atom, press <CTRL+C>, then come to the forums and click the three dots and a down-arrow button on the editor window toolbar (looks like ...v). Pick "code" from the dropdown, then change the language to python. Then paste your copied code into the box and click the [Continue] button.

Alternatively, ignore the toolbar and type in the following tags yourself:

[code=python] ... [/code]

To look something like...

[code=python]
# paste your code here
[/code]


Some other stuff I'm only guessing at here, based on the code you've posted so far...

I think you probably want call screen WORLDMAP rather than show screen ...
Then add a modal True to your world map screen.

show screen just puts the screen: onto the screen... and then carries on.
call screen does the same thing, but waits for the player to do something which triggers an action().

The also tells RenPy to focus on THIS screen until an action is picked, even if other screens are being displayed too. Effectively it makes all other interaction points not part of this screen inactive until this screen is closed.

Based on what looks like a navigation map, I think you want the game to wait for the player to click a hotspot... so call screen.

Secondly, you have a lot of hide statements in there.
I usually see that when a new developer displays images using show.
As a result you end up needing to actively hide any image previously shown before moving on.

I think you have perhaps overlooked .
... or you've copied code by someone who didn't understand either.

What scene does is clear all previously shown images and then show the new image.

Something like:
Python:
label start:

    scene black with fade
    "*** THE START ***"

    scene intro1 with dissolve
    "Some dialogue"

    "*** THE END ***"
    return

black is a pre-defined RenPy color/image that is just black.
My point though, is that you wouldn't need a hide intro1 as long as the next line was something like scene intro2.
 

Mephistofeles

Active Member
Jul 9, 2017
647
721
Best guess, your mapa.jpg file is a different resolution than your game.


Also... You can copy/paste your code by highlighting and copying the code within Atom, then paste here into the forums.

To keep the formatting (mainly the indenting), highlight the code in Atom, press <CTRL+C>, then come to the forums and click the three dots and a down-arrow button on the editor window toolbar (looks like ...v). Pick "code" from the dropdown, then change the language to python. Then paste your copied code into the box and click the [Continue] button.

Alternatively, ignore the toolbar and type in the following tags yourself:

[code=python] ... [/code]

To look something like...

[code=python]
# paste your code here
[/code]


Some other stuff I'm only guessing at here, based on the code you've posted so far...

I think you probably want call screen WORLDMAP rather than show screen ...
Then add a modal True to your world map screen.

show screen just puts the screen: onto the screen... and then carries on.
call screen does the same thing, but waits for the player to do something which triggers an action().

The also tells RenPy to focus on THIS screen until an action is picked, even if other screens are being displayed too. Effectively it makes all other interaction points not part of this screen inactive until this screen is closed.

Based on what looks like a navigation map, I think you want the game to wait for the player to click a hotspot... so call screen.

Secondly, you have a lot of hide statements in there.
I usually see that when a new developer displays images using show.
As a result you end up needing to actively hide any image previously shown before moving on.

I think you have perhaps overlooked .
... or you've copied code by someone who didn't understand either.

What scene does is clear all previously shown images and then show the new image.

Something like:
Python:
label start:

    scene black with fade
    "*** THE START ***"

    scene intro1 with dissolve
    "Some dialogue"

    "*** THE END ***"
    return

black is a pre-defined RenPy color/image that is just black.
My point though, is that you wouldn't need a hide intro1 as long as the next line was something like scene intro2.
Thanks you SOO much. That seems to fix all my problem except with the size of the image. Again, the image is the right size aparently, and when i dont use it for the imagemap, but for a normal image, it works just fine.
But nevermind that, thank you very very very much for the help!
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,384
15,294
Best guess, your mapa.jpg file is a different resolution than your game.
Yeah, it was the initial problem I pointed in his previous thread. I guess that, while the height is now accurate regarding the game resolution, the width is still lower, what cause the black part on the right side.


I think you probably want call screen WORLDMAP rather than show screen ...
Then add a modal True to your world map screen.
Your "then" could have been an "or".
When the screen is called, Ren'py will not care if the click happen outside of a button, therefore the modal isn't needed. It's when the screen is just shown that you need to ensure that the player will not be able to click outside of a button ; mostly because this would make the game advance in the back, what can break everything.


What scene does is clear all previously shown images and then show the new image.
Or, what is more interesting in the present case, just clear all the previously shown image when used without parameters.
Therefore, all his hide can be replaced by a simple :
Python:
label whatever:
    [some content]
    # Clear all the screen
    scene
    call screen whatever
 
  • Like
Reactions: Mephistofeles

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,584
2,227
... the image is the right size aparently

Yeah. I'm still not sure it is.

, and when i dont use it for the imagemap, but for a normal image, it works just fine.

I think that depends on how it is shown. For example, scene or show will center the image horizontally and align it's bottom edge with the bottom of the screen (except where you override those default choices). It could also be that RenPy is resizing the image to fit in your "it works just fine" usage. (Probably not, I'm just covering all the angles).

Could you attach the current version of the mapa.jpg here?

Then tell us what screen resolution your game runs at by default? (it's the gui.init line in the gui.rpy file... it's probably gui.init(1280,720) or gui.init(1920,1080)). Because your image needs to be the same size as that.

If you attach the image here, we can at least check what size it really is... and put that same image in the test scripts we play around with to figure this sort of stuff out.
 
Last edited:
  • Like
Reactions: Mephistofeles

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,584
2,227
Your "then" could have been an "or".
When the screen is called, Ren'py will not care if the click happen outside of a button, therefore the modal isn't needed.

Yeah. That's habit on my part.
It doesn't really matter when the called screen is the full size of the screen, since any other clickable elements will be hidden anyway.

I just figure that at some point, someone is going to write a screen (like a mobile phone) that is smaller than the overall screen and it'll end up overlaying another screen with clickable areas. Unlikely I know, but if I explicitly code it... I'm at least thinking about it.
 
  • Like
Reactions: Mephistofeles

Mephistofeles

Active Member
Jul 9, 2017
647
721
Like you two said, the image still isnt the right size. Checked out with my artist , who told me that change it, but when i check the resolution is 1050 x 750, while my game is being made 1280x720. Thank you for the feedback, i was sure it was the right size this time because it worked witout errors (thats what i meant with the 'just fine') but clearly it is not. Going to check with him again to see what we can do.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,384
15,294
Yeah. That's habit on my part.
Don't worry ; well at least in regard of what I said, because in regard of your reason you're totally right and it already happened. I was explaining, not correcting.
People will see what you said, find tons of called screens that works perfectly without modal property, then wonder where is the truth. Now they know that the truth is in both, and also why.
 
  • Like
Reactions: Mephistofeles