Little help with image map please,

Redhunter357

Newbie
Mar 29, 2019
40
88
So guys here's what I want to do,

I already created a simple image button menu and add a call screen command for returning to the image button menu once you completed an event, now what I wanna achieve is to edit my image button menu in a way you cannot repeat the same event again. I'm okay with adding a small dialog after you played an event like:- You already visited there or something similar, but once again I don't know how to do that as well.

Here's the code that i tailored so far.


Code:
 screen imagemap_example():
    imagemap:
        idle "imagemap ground"
        hover "imagemap hover"

        hotspot (400, 249, 401, 252) action Jump("bathroom") alt "bathroom"
        hotspot (0, 1250, 401, 250) action Jump("livingroom") alt "livingroom"
        hotspot (0, 1750, 400, 252) action Jump("myroom") alt "myroom"
        hotspot (0, 0, 400, 250) action Jump("backyard") alt "backyard"

label imagemap_example:

    # Call the imagemap_example screen.
    call screen imagemap_example

label bathroom:

    scene goodmo1f
    with fade

    p "....."

    scene jul1b
    with fade

    "You meet Julia with a lazy face on her way to the bathroom."

    "....."

    scene jul1c
    with fade

    p "Hey there Julia, good morning."

    scene jul1d
    with fade

    s "<Multiple big yawns...>Haaeyy Go..Good morning Ned."

    scene bg id black
    with fade

    "Without saying anything more to you Julia hastily walk to the bathroom with her slow pace."

    scene jul1eee
    with fade

    p "Such a rush! Well I guess she didn't get the chance to empty her bladder yet."

    menu:
         "Give a quick peek on Julia in the bathroom.":
               jump julpeek1a

         "Walk away.":
            jump walkaw1a

    label walkaw1a:

    p "(I don't assume that's a good idea. Let's just go someplace else.)"

    call screen imagemap_example

*After the call screen command I return to the image button menu and then if i click the bathroom button again, same event repeats itself. How can i avoid this?
*I understand this entire code of mine is not written properly and may need lots of adjustment, but I prefer if you try to help me while keeping the original if that's possible<with minimum changes>.




Any help will be greatly appreciated.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
Firstly, when you include code, please put in between [code] and [/code] tags, for it to be readable.


*After the call screen command I return to the image button menu and then if i click the bathroom button again, same event repeats itself. How can i avoid this?
Well, condition the display to a flag telling if the scene have been seen or not:

Python:
# By default the scene haven't been seen.
default bathroomScene = False


screen imagemap_example():
   imagemap:
       idle "imagemap ground"
       hover "imagemap hover"

       # Display the button only if the scene haven't been seen.
       showif not bathroomScene:
           hotspot (400, 249, 401, 252) action Jump("bathroom") alt "bathroom"
       hotspot (0, 1250, 401, 250) action Jump("livingroom") alt "livingroom"
       hotspot (0, 1750, 400, 252) action Jump("myroom") alt "myroom"
       hotspot (0, 0, 400, 250) action Jump("backyard") alt "backyard"


label bathroom:
    # Mark the scene as being seen.
    $ bathroomScene = True
Edit: typo
 
Last edited:
  • Like
Reactions: osanaiko

Redhunter357

Newbie
Mar 29, 2019
40
88
Firstly, when you include code, please put in between [[b][/b]code] and [[b][/b]/code] tags, for it to be readable.




Well, condition the display to a flag telling if the scene have been seen or not:

Python:
# By default the scene haven't been seen.
default bathroomScene = False


screen imagemap_example():
   imagemap:
       idle "imagemap ground"
       hover "imagemap hover"

       # Display the button only if the scene haven't been seen.
       showif not bathroomScene:
           hotspot (400, 249, 401, 252) action Jump("bathroom") alt "bathroom"
       hotspot (0, 1250, 401, 250) action Jump("livingroom") alt "livingroom"
       hotspot (0, 1750, 400, 252) action Jump("myroom") alt "myroom"
       hotspot (0, 0, 400, 250) action Jump("backyard") alt "backyard"


label bathroom:
    # Mark the scene as being seen.
    $ bathroomScene = True
Much appreciated
anne O'nymous. I'll start working on your suggestion.
 
  • Like
Reactions: osanaiko

Redhunter357

Newbie
Mar 29, 2019
40
88
Sorry to bother you again anne O'nymous, but I encountered a slight complication when using your code.

You see In this simple test game of mine, the player wakes up in his room as the first thing in the game(Scene happens automatically.) after that the 'Image button menu' pops up, allowing player the freedom to go somewhere. But after inputting your code the game automatically goes on with the bathroom scene before player being able to choose anything from the image button menu.

1. Bathroom scene automatically plays on without showing the menu first.
2. After the scene; however the image button menu shows up and the rest of the code works as intended.(You can't click the bathroom again.)
3.Any idea why's the original code show the menu first and yours skip to the scene directly.


It'd be a great deal of help if you can point me to something.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
3.Any idea why's the original code show the menu first and yours skip to the scene directly.
Not the slightest starts of an idea since "my code" is just one line more in your screen, and one line more in a label, both intended as illustration of what "condition the display to a flag" mean. At no time it have an impact on the game flow, and at no time it change the way Ren'Py act.
I only shown you what have to be done in order to have a button shown, or not, depending if an event have happened or not.
If you use call screen imagemap_example as your original code show, whatever if it's your original screen or a screen updated the way I shown, Ren'Py will wait for the player to click on one of the hotspots. This even if all hotspots are "disabled" by the showif.
 

Redhunter357

Newbie
Mar 29, 2019
40
88
My bad! I just have to put the code after the choice 'Walk away' and call screen command. Thank you very much for your assistance.
 
Last edited: