city map...renpy crazy

Cohibozz

Member
Aug 14, 2018
126
27
i've done a city map for my game with code:
Code:
screen city_map: #Preparing the imagemap
    imagemap:
        ground "city_map.png"

        hotspot (1230, 222, 100, 100) clicked Jump("myhome")
        hotspot (421, 353, 100, 100) clicked Jump("themansion")
        if coffee_unlock:
            hotspot (620, 522, 100, 100) clicked Jump("coffee")
        else:
            hotspot (620, 522, 100, 100) hovered ShowTransient("the_img", img="locked_map.png") unhovered Hide("the_img")
        if university_unlock:
            hotspot (998, 524, 100, 100) clicked Jump("university")
        else:
            hotspot (998, 524, 100, 100) hovered ShowTransient("the_img2", img="locked_map.png") unhovered Hide("the_img2")


screen the_img(img):
    add img pos (610, 510)

screen the_img2(img):
    add img pos (988, 514)

label city_map:
    $ coffee_unlock = False
    $ university_unlock = False
    show screen city_map
to show all the location and show also on imagehover for the location locked without jump.

it works good UNTIL i've sets the right coords for all....
now when i try to call the city map the game call it and go ahead with the dialogue.
i can click on location and the jump work, but no hovered image and if locked the location simply go ahead with dialogue.


i can't understand why.....it work properly until i set the coords!!


it is called in navigation menu with this:
Code:
screen navigation_room:
    vbox:
       xalign 1.0 yalign 0.0
       imagebutton:
           auto "location1_%s.png"
           action Call( "myroom" )

       imagebutton:
           auto "location2_%s.png"
           action Call( "city_map" )
 
  • Like
Reactions: Palanto

Cohibozz

Member
Aug 14, 2018
126
27
UPDATE:

if i use "call" instead of "show" for the city_map screen it work at 50% :)

the location locked have no action but no hovered image load when i do a mouse over...
 

TearStar

Developer of Lesbian/Futa Games
Game Developer
Mar 12, 2018
514
1,089
I'm not sure if I get your issue:

When you open the map it displays the next text?

If it's locked than when you click on it it goes to the next text?


Wild guessing:
- If you call city_map (LABEL) it will set a return path to the previous location in text
- If you jump to label it will go the screen

I think you should JUMP LABEL and SHOW SCREEN... Wild guessing never worked with imagemap.
 

Cohibozz

Member
Aug 14, 2018
126
27
another info...the last time i've run the script i put in the loop that cause game crash...if possible that something with crash is broken? and if it yes where? in rpyc file or in renply ? i've to try to reinstall it?

EDIT: rpyc not the problem..
 

TearStar

Developer of Lesbian/Futa Games
Game Developer
Mar 12, 2018
514
1,089
I'm not sure I get this line either. If you caused a crash you should fix the bug otherwise it won't work again. Also you can force recompile it. Not sure what you want to do with rpyc files they are binaries.
 

TearStar

Developer of Lesbian/Futa Games
Game Developer
Mar 12, 2018
514
1,089
Try this: unhovered => idle
hovered => hover

I think hotspots are imagebuttons
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
i've done a city map for my game with code:
Code:
screen city_map: #Preparing the imagemap
    imagemap:
        ground "city_map.png"

        hotspot (1230, 222, 100, 100) clicked Jump("myhome")
        hotspot (421, 353, 100, 100) clicked Jump("themansion")
        if coffee_unlock:
            hotspot (620, 522, 100, 100) clicked Jump("coffee")
        else:
            hotspot (620, 522, 100, 100) hovered ShowTransient("the_img", img="locked_map.png") unhovered Hide("the_img")
        if university_unlock:
            hotspot (998, 524, 100, 100) clicked Jump("university")
        else:
            hotspot (998, 524, 100, 100) hovered ShowTransient("the_img2", img="locked_map.png") unhovered Hide("the_img2")


screen the_img(img):
    add img pos (610, 510)

screen the_img2(img):
    add img pos (988, 514)

label city_map:
    $ coffee_unlock = False
    $ university_unlock = False
    show screen city_map
to show all the location and show also on imagehover for the location locked without jump.

it works good UNTIL i've sets the right coords for all....
now when i try to call the city map the game call it and go ahead with the dialogue.
i can click on location and the jump work, but no hovered image and if locked the location simply go ahead with dialogue.


i can't understand why.....it work properly until i set the coords!!


it is called in navigation menu with this:
Code:
screen navigation_room:
    vbox:
       xalign 1.0 yalign 0.0
       imagebutton:
           auto "location1_%s.png"
           action Call( "myroom" )

       imagebutton:
           auto "location2_%s.png"
           action Call( "city_map" )
Ok, so first of all Imagemaps are outdated and shouldn't really be used anymore, use imagebuttons. But now that you did it like that, keep it.

try:
Code:
screen city_map: #Preparing the imagemap
    modal True # <--------------------------------------- This means that if the screen is opened nothing else "under it" (look up zorder if you want more control of what's under / above a screen) is clickable or happens until you close the screen through a jump i.e. or a "hide" or "return"....
    imagemap:
        ground "city_map.png"
        hover "city_map_hover.png" # <----- MISSING

        hotspot (1230, 222, 100, 100) clicked Jump("myhome")
        hotspot (421, 353, 100, 100) clicked Jump("themansion")
        if coffee_unlock:
            hotspot (620, 522, 100, 100) clicked Jump("coffee")
        else:
            hotspot (620, 522, 100, 100) hovered ShowTransient("the_img", img="locked_map.png") unhovered Hide("the_img")
        if university_unlock:
            hotspot (998, 524, 100, 100) clicked Jump("university")
        else:
            hotspot (998, 524, 100, 100) hovered ShowTransient("the_img2", img="locked_map.png") unhovered Hide("the_img2")
And without the images in question I can't help you with the coordinates, since it might be a problem with the coords you entered, and usually an imagemap takes two images, one showing ALL locations and one showing ALL of them as "hovered" images. So a map would need 1x map_idle.png and 1x map_hover.png with all locations on it and all locations shown as hovering. Like I said, I'd need more information to help you further.


But you can find an old imagemap tutorial explaining how it works on a solar system (the images are missing as it seems, but aren't really necessary if you read carefully you might understand it without the images) ;)

Everything else can be found in the official documentation

p.S.: Yes the hovered and unhovered are necessary there since he's showing a Transient image and hiding it through the hovered and unhovered "action"
 

Cohibozz

Member
Aug 14, 2018
126
27
there the map and the lock_map. in my first release when i hovered the location in False state the locked image showing properly....

now the if work but the hovered image no.
city.png locked_map.png
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,191
Code:
    show screen city_map
will just display the screen and proceed with the rest of the code, this while will display the screen and wait before proceeding the rest of the code.
Obviously you'll probably have to rewrite a little your code since I'm pretty sure that jumping out of a called screen will make the stack grow and grow and grow...
So, replace your Jump by and delegate the jump to the calling label :

Code:
screen city_map:
   [....]
       hotspot (1230, 222, 100, 100) action Return("myhome")
       hotspot (421, 353, 100, 100) action Return("themansion")
   [....]

label city_map:
   $ coffee_unlock = False
   $ university_unlock = False
   call screen city_map
   # /!\ WARNING /!\ need a recent version of Ren'py.
   # 6.99.14 at least if my memory is right.
   jump expression _return
Side note: I also changed the, way too much outdated, "clicked" by "action".
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
there the map and the lock_map. in my first release when i hovered the location in False state the locked image showing properly....

now the if work but the hovered image no.
View attachment 153730 View attachment 153731
Uhm, where is the hover map? You should have two maps, one is the idle state of the map and the other is the hover state... I'm pretty much confused right now X_x

So if I understood you right, the whole map works perfectly, but the lock doesn't? What does it do, what do you want it to do? Does it not show or what do you mean? :)
 

Cohibozz

Member
Aug 14, 2018
126
27
when i "mouse over" the COFFE SHOP, the image with locker come on location to show that it's locked.
i've changed all old function u say but hovered on location still not working.

i don0t need a hovered image for the entire map (i've putted also to try) i need only function in location.


meantime i'm using SHOW SCREEN to show also a text who say that if location is not clickable it is anaviable yet, but i hate this! pls help me for the hovered on location showing!!
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
Hmh, well one more reason why you wouldn't need an imagemap then but alright, checked your code and the problem is that you have no action added to the "locked" buttons, which is the same as writing "action None" which then in return makes the buttons unhoverable and so on... this can be disabled by adding the action:
Code:
action NullAction()
to the buttons in question

looking i.e. in your case like this:
Code:
hotspot (620, 522, 100, 100) hovered ShowTransient("the_img", img="locked_map.png") unhovered Hide("the_img") action NullAction()
So, well in any case here's your script, slightly changed (also the coffee position is changed, because I tried some things and saw that neither the position was really right nor the size of the hotspot itself.. probably with all of them but didn't bother checking ;) )

city map screen:
Code:
screen city_map: #Preparing the imagemap
    zorder 0
    modal True
    imagemap:
        ground "city_map.png"

        hotspot (1230, 222, 100, 100) action Return("myhome")
        hotspot (421, 353, 100, 100) action Return("themansion")
        if coffee_unlock:
            hotspot (610, 510, 140, 80) action Return("coffee")
        else:
            hotspot (610, 510, 140, 80) hovered ShowTransient("the_img", img="locked_map.png") unhovered Hide("the_img") action NullAction()
        if university_unlock:
            hotspot (998, 524, 100, 100) action Return("university")
        else:
            hotspot (998, 524, 100, 100) hovered ShowTransient("the_img2", img="locked_map.png") unhovered Hide("the_img2") action NullAction()
Left your lockbuttons as is but added a small "test" screen to make the hotspots visible for you (if you need it ;) )
Code:
screen the_img(img):
    zorder 1
    add img pos (610, 510)

screen the_img2(img):
    zorder 1
    add img pos (988, 514)

screen test():
    zorder 1
    frame:
        xysize (140,80)
        pos (610, 510)
And here's all of my small little fake script I used to test your map:
Code:
screen city_map: #Preparing the imagemap
    zorder 0
    modal True
    imagemap:
        ground "city_map.png"

        hotspot (1230, 222, 100, 100) action Return("myhome")
        hotspot (421, 353, 100, 100) action Return("themansion")
        if coffee_unlock:
            hotspot (610, 510, 140, 80) action Return("coffee")
        else:
            hotspot (610, 510, 140, 80) hovered ShowTransient("the_img", img="locked_map.png") unhovered Hide("the_img") action NullAction()
        if university_unlock:
            hotspot (998, 524, 100, 100) action Return("university")
        else:
            hotspot (998, 524, 100, 100) hovered ShowTransient("the_img2", img="locked_map.png") unhovered Hide("the_img2") action NullAction()


screen the_img(img):
    zorder 1
    add img pos (610, 510)

screen the_img2(img):
    zorder 1
    add img pos (988, 514)

screen test():
    zorder 1
    frame:
        xysize (140,80)
        pos (610, 510)

default coffee_unlock = False
default university_unlock = False
image city = "city_map.png"

label start:
    label city_map:
        scene black
        with dissolve
        call screen city_map
        jump expression _return


    label myhome:
        scene city
        with Dissolve(1.0)
        $ coffee_unlock = True
        "I'm at home"
        jump city_map

    label themansion:
        scene city
        with Dissolve(1.0)
        $ coffee_unlock = True
        show screen test
        "I'm at the mansion!"
        jump city_map

    label coffee:
        scene city
        with Dissolve(1.0)
        hide screen test
        $ university_unlock = True
        $ coffee_unlock = False
        "I'm at the cafe!"
        jump city_map

    label university:
        scene city
        with Dissolve(1.0)
        "I'm at the university"
        jump city_map



    return
 
  • Like
Reactions: anne O'nymous

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
You're welcome, but seriously consider using imagebuttons instead of imagemaps ;) You can still use a background full screen image even if you do it with imagebuttons ;)

p.S.: If you use the "test" frame, try adding:
Code:
background Color("#0000FF50")
to it. It makes the frame blue and a little transparent (the 50 at the end). This way you can position the button boxes a little better ;)
 

Cohibozz

Member
Aug 14, 2018
126
27
i can have problem with imagemaps? now it work perfectly.
i'm new in renpy and python and i've to study as imagebutton works..

i've to do a focus hover also in my room sets for bed,pc,etc etc.
it's better i study for imagebutton or i can use this script?
 
  • Like
Reactions: Palanto