Problem Editing Imagemap Quick Menu

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
User avatar
parttimestorier
Veteran
Posts: 429
Joined: Thu Feb 09, 2017 10:29 pm
Completed: No Other Medicine, Well Met By Moonlight, RE:BURN, The Light at the End of the Ocean, Take A Hike!, Wizard School Woes
Projects: Seeds of Dreams
itch: janetitor
Location: Canada
Contact:

Problem Editing Imagemap Quick Menu

#1 Post by parttimestorier »

I'm using a premade creative commons GUI (CC GUI 1 by Namastaii) in my project, but I wanted to make some changes to it. Specifically, my issue came when I tried to add buttons for skip, log, and quit to the quick menu. I made new ground and hover images that resembled the old ones but with the new buttons, and replaced the old stuff in the code. Here's what the code that came with the GUI in screens.rpy originally looked like, without any of my modications:

Code: Select all

screen quick_menu:

    imagemap:
        xpos 25
        ypos 398
        alpha False
        cache False
        ground "ui/menus/quickmenu/qm_ground.png"
        idle "ui/blank.png"
        hover "ui/menus/quickmenu/qm_hover.png"
        selected_idle "ui/menus/quickmenu/qm_hover.png"
        selected_hover "ui/menus/quickmenu/qm_hover.png"   

        
        hotspot (745,250,100,80) action ShowMenu('save') at buttonfade
        hotspot (850,250,50,80) action ShowMenu('load') at buttonfade
        hotspot (910,250,50,80) action Preference("auto-forward", "toggle") at buttonfade
        hotspot (970,250,50,80) action ShowMenu('preferences') at buttonfade
(And then it goes on to define the buttonfade transition.) Now, here's what my modified version of that code looks like:

Code: Select all

screen quick_menu:

    imagemap:
        xpos 743
        ypos 633
        alpha False
        cache False
        ground "ui/menus/quickmenu/newqm_ground.png"
        idle "ui/blank.png"
        hover "ui/menus/quickmenu/newqm_hover.png"
        selected_idle "ui/menus/quickmenu/newqm_hover.png"
        selected_hover "ui/menus/quickmenu/newqm_hover.png"   

        
        #hotspot (745,250,100,80) action ShowMenu('save') at buttonfade - old
        hotspot (744,645,99,63) action ShowMenu('save') at buttonfade
        #hotspot (850,250,50,80) action ShowMenu('load') at buttonfade - old
        hotspot (843,663,59,36) action ShowMenu('load') at buttonfade
        #hotspot (910,250,50,80) action Preference("auto-forward", "toggle") at buttonfade - old
        hotspot (906,663,59,36) action Preference("auto-forward", "toggle") at buttonfade
        #hotspot (969,663,54,36) - this is for the skip button which I haven't programmed yet
        #hotspot (1028,663,45,36) - this is for the log button which I haven't programmed yet
        #hotspot (970,250,50,80) action ShowMenu('preferences') at buttonfade - old
        hotspot (1077,663,63,36) action ShowMenu('preferences') at buttonfade
        hotspot (1149,663,50,36) action Quit(confirm=True) at buttonfade
As you can see, I commented out the old hotspots when I added new ones, and I also have new hotspots that are also commented out because I wasn't finished coding their functions yet, but I'm not sure why anything I did would cause the problem it did. Now, when I open up my game, I can see my new quick menu image displayed nicely, but clicking or hovering does nothing. Apparently the imagemap isn't working at all. I'm not sure why that would happen when I never had any problems with the premade quick menu, and all I did was change the images and numbers in the code. Does anyone have any idea what I'm missing?
ImageImageImage

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Problem Editing Imagemap Quick Menu

#2 Post by Per K Grok »

parttimestorier wrote: Sat Aug 11, 2018 12:56 pm Now, when I open up my game, I can see my new quick menu image displayed nicely, but clicking or hovering does nothing. Apparently the imagemap isn't working at all. I'm not sure why that would happen when I never had any problems with the premade quick menu, and all I did was change the images and numbers in the code. Does anyone have any idea what I'm missing?
My guess is that the hotspots are not where you think they are.

If I don't remember this completely wrong, the hotspots x and y positions are counted from the imagemap's (0,0)-point (top-left corner).
I would suspect that when you changed the ground image for the imagemap, and changed the map's position, you got the positions of the hotspots wrong.

That's my best guess.

User avatar
parttimestorier
Veteran
Posts: 429
Joined: Thu Feb 09, 2017 10:29 pm
Completed: No Other Medicine, Well Met By Moonlight, RE:BURN, The Light at the End of the Ocean, Take A Hike!, Wizard School Woes
Projects: Seeds of Dreams
itch: janetitor
Location: Canada
Contact:

Re: Problem Editing Imagemap Quick Menu

#3 Post by parttimestorier »

Per K Grok wrote: Sat Aug 11, 2018 2:19 pm If I don't remember this completely wrong, the hotspots x and y positions are counted from the imagemap's (0,0)-point (top-left corner).
I would suspect that when you changed the ground image for the imagemap, and changed the map's position, you got the positions of the hotspots wrong.
Wow, I can't believe I didn't think of that. You're totally right - I assumed the hotspots were counted from the corner of the whole window, since I've only worked with imagemaps that took up the whole screen before. But once I changed them to correspond to the corner of the actual smaller image instead, it worked perfectly. Thanks for your help!
ImageImageImage

Post Reply

Who is online

Users browsing this forum: No registered users