- Solved - Issues with an Image Map Save/Load Screen

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.
Message
Author
User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

- Solved - Issues with an Image Map Save/Load Screen

#1 Post by FatUnicornGames »

Ok, so I borrowed the code from Camille's Tutorial (http://lemmasoft.renai.us/forums/viewto ... nu+buttons) and plugged in my own stuff there.

This is my ground picture.

Image

Now when I launch the game it isn't responding...at all. It shows up, but none of the imagemap buttons work and nothing shows up in the little screencap save areas.

Admittedly, I was confused on how to fit the little screencaps in their designated places, so I am SURE that part of the code is wrong, but I thought the image mapped buttons, like the numbers, save, quit etc should work...I think.

Here is the code:

Code: Select all

# Save, Load
#
# Screens that allow the user to save and load the game.
# http://www.renpy.org/doc/html/screen_special.html#save
# http://www.renpy.org/doc/html/screen_special.html#load

# Since saving and loading are so similar, we combine them into
# a single screen, file_picker. We then use the file_picker screen
# from simple load and save screens.
    
screen load_save_slot:
    $ file_text = "%2s. %s\n  %s" % (
                        FileSlotName(number, 4),
                        FileTime(number, empty=_("Empty Slot.")),
                        FileSaveName(number))

    add FileScreenshot(number) xpos 120 ypos 90 
    text file_text xpos 215 ypos 92 size 18 color "#000000"
    
screen file_picker:
    key "w" action FileLoad(1, page="quick", confirm=True, newest=False)
    key "m" action MainMenu(confirm=True)
    key "p" action ShowMenu("preferences")
    key "mouseup_3" action ShowMenu("keys_map")
    key "K_ESCAPE" action Return()
    
    imagemap:
            ground "saveground.png"
            idle "saveidle.png"
            hover "savehover.png"
            selected_idle "saveidle.png"

            hotspot (466, 63, 14, 41) clicked FilePage(1)
            hotspot (482, 68, 23, 39) clicked FilePage(2)
            hotspot (505, 71, 25, 38) clicked FilePage(3)
            hotspot (535, 75, 25, 38) clicked FilePage(4)
            hotspot (557, 72, 28, 44) clicked FilePage(5)
            hotspot (586, 73, 25, 36) clicked FilePage(6)
            hotspot (608, 71, 27, 36) clicked FilePage(7)
            hotspot (635, 61, 25, 50) clicked FilePage(8)
            hotspot (661, 68, 26, 38) clicked FilePage(9)

            hotspot (22, 180, 363, 184) clicked FileAction(1):
                use load_save_slot(number=1)
            hotspot (401, 178, 384, 191) clicked FileAction(2):
                use load_save_slot(number=2)
            hotspot (16, 376, 377, 195) clicked FileAction(3):
                use load_save_slot(number=3)
            hotspot (401, 375, 381, 202) clicked FileAction(4):
                use load_save_slot(number=4)
                
            hotspot (394, 126, 67, 46) action ShowMenu("load")
            hotspot (459, 127, 66, 43) action ShowMenu("save")
            hotspot (527, 127, 58, 50) action Help()
            hotspot (642, 130, 64, 43) action Quit()
            hotspot (583, 127, 63, 48) action MainMenu()
            hotspot (702, 126, 75, 48) action Return()
    
screen save:
    key "s" action Return()
    # This ensures that any other menu screen is replaced.
    tag menu

    use file_picker
    add "saveground.png"

screen load:
    key "l" action Return()
    # This ensures that any other menu screen is replaced.
    tag menu

    use file_picker
    add "saveground.png"

init -2 python:
    style.file_picker_frame = Style(style.menu_frame)

    style.file_picker_nav_button = Style(style.small_button)
    style.file_picker_nav_button_text = Style(style.small_button_text)

    style.file_picker_button = Style(style.large_button)
    style.file_picker_text = Style(style.large_button_text)
    config.thumbnail_width = 120
    config.thumbnail_height = 90
Thanks for any help! Sorry again for asking so many questions.

ALSO - If you know...what code would I use to make those + - buttons next to the numbers functional?
Last edited by FatUnicornGames on Wed Jun 20, 2012 9:11 pm, edited 2 times in total.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

User avatar
Cinnamoon
Regular
Posts: 100
Joined: Wed May 30, 2012 5:24 am
Projects: Crystal Aria ~Starlight (20%), かわいいなリズム (38%)
Organization: CoffeeCat
Location: France~ ^^
Contact:

Re: Issues with an Image Map Save/Load Screen

#2 Post by Cinnamoon »

It's ok to ask a lot of questions, that's how you learn :)

I have quite the same code as yours, I'm trying to figure out what differs.
screen save:

    key "s" action Return()

    # This ensures that any other menu screen is replaced.
    tag menu
    use file_picker
    add "saveground.png"

screen load:

    key "l" action Return()

    # This ensures that any other menu screen is replaced.
    tag menu
    use file_picker
    add "saveground.png"
I think that I don't have "add "saveground.png"" at all in my code. Maybe you should try to
erase it, see if it works. Maybe this is just layered on top of your file_picker ? I don't know.

Anyway, I think your code is good, and I can't figure out what doesn't work out. Tell me if erasing "add ..." make it better ^^

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Issues with an Image Map Save/Load Screen

#3 Post by FatUnicornGames »

It totally did!

Image

Now I just need to fix the placing of the image and text for the save boxes. Also: I don't know why but the image maps on the numbers aren't working at all...I'll have to check that out. If you have any ideas on that let me know.

Thanks so much!
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

User avatar
Cinnamoon
Regular
Posts: 100
Joined: Wed May 30, 2012 5:24 am
Projects: Crystal Aria ~Starlight (20%), かわいいなリズム (38%)
Organization: CoffeeCat
Location: France~ ^^
Contact:

Re: Issues with an Image Map Save/Load Screen

#4 Post by Cinnamoon »

If it works, that's ok :)
Since you are using Camille's tutorial and just got it right, I don't know why your pages number don't work :/ It looks like you put it on your imagemap. It really doesn't work at all ?

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Issues with an Image Map Save/Load Screen

#5 Post by FatUnicornGames »

Ha, I was fixing the image map numbers for the save spaces to get the screenshots in there evenly and this happened.

Image

What the heck code?

I will keep poking at it.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Issues with an Image Map Save/Load Screen

#6 Post by FatUnicornGames »

Code: Select all

screen load_save_slot:
    $ file_text = "%2s. %s\n  %s" % (
                        FileSlotName(number, 4),
                        FileTime(number, empty=_("Empty Slot.")),
                        FileSaveName(number))

    add FileScreenshot(number) xpos 70 ypos 50
    text file_text xpos 50 ypos 50 size 18 color "#000000"
    
screen file_picker:
    key "w" action FileLoad(1, page="quick", confirm=True, newest=False)
    key "m" action MainMenu(confirm=True)
    key "p" action ShowMenu("preferences")
    key "mouseup_3" action ShowMenu("keys_map")
    key "K_ESCAPE" action Return()
    
    imagemap:
            ground "saveground.png"
            idle "saveidle.png"
            hover "savehover.png"

            hotspot (466, 63, 14, 41) clicked FilePage(1)
            hotspot (482, 68, 23, 39) clicked FilePage(2)
            hotspot (505, 71, 25, 38) clicked FilePage(3)
            hotspot (535, 75, 25, 38) clicked FilePage(4)
            hotspot (557, 72, 28, 44) clicked FilePage(5)
            hotspot (586, 73, 25, 36) clicked FilePage(6)
            hotspot (608, 71, 27, 36) clicked FilePage(7)
            hotspot (635, 61, 25, 50) clicked FilePage(8)
            hotspot (661, 68, 26, 38) clicked FilePage(9)

            hotspot (24, 189, 358, 166) clicked FileAction(1):
                use load_save_slot(number=1)
            hotspot (410, 189, 356, 166) clicked FileAction(2):
                use load_save_slot(number=2)
            hotspot (24, 395, 358, 166) clicked FileAction(3):
                use load_save_slot(number=3)
            hotspot (410, 395, 356, 166) clicked FileAction(4):
                use load_save_slot(number=4)
                
            hotspot (394, 126, 67, 46) action ShowMenu("load")
            hotspot (459, 127, 66, 43) action ShowMenu("save")
            hotspot (527, 127, 58, 50) action Help()
            hotspot (642, 130, 64, 43) action Quit()
            hotspot (583, 127, 63, 48) action MainMenu()
            hotspot (702, 126, 75, 48) action Return()
    
screen save:
    key "s" action Return()
    # This ensures that any other menu screen is replaced.
    tag menu

    use file_picker
    
screen load:
    key "l" action Return()
    # This ensures that any other menu screen is replaced.
    tag menu

    use file_picker

init -2 python:
    style.file_picker_frame = Style(style.menu_frame)

    style.file_picker_nav_button = Style(style.small_button)
    style.file_picker_nav_button_text = Style(style.small_button_text)

    style.file_picker_button = Style(style.large_button)
    style.file_picker_text = Style(style.large_button_text)
    config.thumbnail_width = 120
    config.thumbnail_height = 90
Here is the code. I'm sure if I keep poking at it it will suddenly work. But if you see something wonky let me know.

:D
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Issues with an Image Map Save/Load Screen

#7 Post by PyTom »

The weirdness like that might be a problem with the image cache. Try deleting the contents of the game/cache directory.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Issues with an Image Map Save/Load Screen

#8 Post by FatUnicornGames »

PyTom wrote:The weirdness like that might be a problem with the image cache. Try deleting the contents of the game/cache directory.
Awesome, that was it! Thanks guys.

Edit: I solved the number problem. I moved something and forgot to move the image map buttons to match.
Last edited by FatUnicornGames on Wed Jun 20, 2012 7:18 pm, edited 1 time in total.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

User avatar
Cinnamoon
Regular
Posts: 100
Joined: Wed May 30, 2012 5:24 am
Projects: Crystal Aria ~Starlight (20%), かわいいなリズム (38%)
Organization: CoffeeCat
Location: France~ ^^
Contact:

Re: Issues with an Image Map Save/Load Screen

#9 Post by Cinnamoon »

Haha I understand what you're going through, I had the same problem. Just delete the cache in your game folder for the save/load/screen, whatever you're using for this screen. Then try to make the hotspots fit like they were before :)

Actually, you have to change the size of the screenshot here :

Code: Select all

 config.thumbnail_width = 120
    config.thumbnail_height = 90
and where you want it to be here :

Code: Select all

add FileScreenshot(number) xpos 120 ypos 90
I tried this like five times before I could get a nice screenshot fitting my little box (u___u) but it was worth it !

Edit : OMG PyTom you were faster than me :)

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Issues with an Image Map Save/Load Screen

#10 Post by FatUnicornGames »

Cinnamoon wrote:Haha I understand what you're going through, I had the same problem. Just delete the cache in your game folder for the save/load/screen, whatever you're using for this screen. Then try to make the hotspots fit like they were before :)

Actually, you have to change the size of the screenshot here :

Code: Select all

 config.thumbnail_width = 120
    config.thumbnail_height = 90
and where you want it to be here :

Code: Select all

add FileScreenshot(number) xpos 120 ypos 90
I tried this like five times before I could get a nice screenshot fitting my little box (u___u) but it was worth it !

Edit : OMG PyTom you were faster than me :)
Rad, I'll get that fixed too and then it should be perfection.

Now just to tackle the preferences, figure out what when wrong with the choice menus, and then the CG Gallery (scary!) and then I should have a fully functional gui!
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Issues with an Image Map Save/Load Screen

#11 Post by FatUnicornGames »

Oop, I spoke too soon. I got an error.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/screens.rpy", line 308: invalid syntax
    add FileScreenshot(number) xpos 120 ypos 90
                      ^
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

User avatar
Cinnamoon
Regular
Posts: 100
Joined: Wed May 30, 2012 5:24 am
Projects: Crystal Aria ~Starlight (20%), かわいいなリズム (38%)
Organization: CoffeeCat
Location: France~ ^^
Contact:

Re: - Almost Solved - Issues with an Image Map Save/Load Scr

#12 Post by Cinnamoon »

FatUnicornGames wrote:Oop, I spoke too soon. I got an error.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/screens.rpy", line 308: invalid syntax
 add FileScreenshot(number) xpos 120 ypos 90
 ^
HUM. Well... I wonder what doesn't work. You'll get your perfect GUI, I promise~ (è_é)
Did you placed it right at the end of the screen load_save_slot ?

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: - Almost Solved - Issues with an Image Map Save/Load Scr

#13 Post by FatUnicornGames »

Code: Select all

screen save:
    key "s" action Return()
    # This ensures that any other menu screen is replaced.
    tag menu

    use file_picker
    
screen load:
    key "l" action Return()
    # This ensures that any other menu screen is replaced.
    tag menu

    use file_picker

init -2 python:
    style.file_picker_frame = Style(style.menu_frame)

    style.file_picker_nav_button = Style(style.small_button)
    style.file_picker_nav_button_text = Style(style.small_button_text)

    style.file_picker_button = Style(style.large_button)
    style.file_picker_text = Style(style.large_button_text)
    
    add FileScreenshot(number) xpos 120 ypos 90
Here is the end of the code.

I took it out and put it back in and got the same error.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

User avatar
Cinnamoon
Regular
Posts: 100
Joined: Wed May 30, 2012 5:24 am
Projects: Crystal Aria ~Starlight (20%), かわいいなリズム (38%)
Organization: CoffeeCat
Location: France~ ^^
Contact:

Re: - Almost Solved - Issues with an Image Map Save/Load Scr

#14 Post by Cinnamoon »

I just copied my own code because I don't want to go to the top of this page again haha Lazy~

This should be it :

Code: Select all

screen load_save_slot:
    $ file_text = "%2s. %s\n  %s" % (
                        FileSlotName(number, 6),
                        FileTime(number, empty=_("Empty Slot.")),
                        FileSaveName(number))

    add FileScreenshot(number) xpos 4 ypos 4 
    text file_text xpos 105 ypos 10 size 16 color "#4b5970"
You should put the FileScreenshot right here and it should works perfectly~ (maybe ^^)

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: - Almost Solved - Issues with an Image Map Save/Load Scr

#15 Post by FatUnicornGames »

It is just the size of the picture that isn't working. I think that spot is for adjusting the placement of the screenshot, not the size.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

Post Reply

Who is online

Users browsing this forum: Google [Bot]