Show text on hotspot action??

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
Adrian_DVL
Regular
Posts: 141
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Show text on hotspot action??

#1 Post by Adrian_DVL »

Hi guys!
I'm pretty new at Renpy and I've been doing well and figuring out everything for myself until now, but now I'm stuck.

My problem is that I have an imagemap, with its idle, hover, and ground images and its hotspots working pretty well.
But I want a hotspot (the last one in the code below), under provided conditions, to show a text window and, after clicking anywhere, hide it.

This is the code for the imagemap:

Code: Select all

screen map1:
    imagemap:
        ground "map1"
        idle "map1_idle"
        hover "map1_hover"

        if player.hunger <= 30:
            hotspot (1237, 19, 105, 105) action Jump("quest_inv")

        hotspot (1344, 118, 82, 82) action Jump("quest_inv")
        hotspot (1424, 118, 82, 82) action Jump("girlsmenu")

        hotspot (765, 89, 163, 53):
            if unlock_home or (time_of_day == "night" and unlock_home):
                action Jump("map_home")
            else:
                action Jump("cant_go")

        hotspot (940, 140, 162, 54):
            if unlock_store and time_of_day != "night":
                action Jump("map_store")
            else:
                action Jump("too_late")


    text "{size=-4}Day [day], [time_of_day]{/size}" xpos 1356 ypos 36
    text "{size=-4}Money: [player.money]${/size}" xpos 1356 ypos 76
As you can see, I set an action to jump to a label called "too_late", which is this one:

Code: Select all

label too_late:
    show screen map1
    "Too late to go there."
    window hide
    call showmap
    return
The problem with this way to approach the situation (appart from considering it inneficient) is that when I click on THE SAME hotspot that triggered the label, the text window that says "Too late to go there" won't hide. Besides, if I click on ANOTHER hotspot, the text window hides, but I'm not able to click that hotspot anymore; it does nothing. On the other hand, if I click on another point of the screen, the window text hides and I can keep interacting with the imagemap normally.

I'd like to know how I can set up the code so that the text window appears by clicking on the hotspot and then hides, no matter where I click in order to do it.

I tried other solutions, like, instead of calling the label "too_late", calling another screen (with Show) that shows a window with the text, with no success, as the window behavour was weird.

Apart from this, before starting working on this, I tried to set up the imagemap so that a hotspot has "three stages": one with it hovered, another with it idle, and another one with it insensitive, not changed when I hover it. For that, I tried to set an "insensitive" property to the imagemap, with the image with all the hotspots shown, but not hovered, in order to show the hotspot insensitive to the cursor, and so I wouldn't need to pop up a "Too late" message.

But I don't seem to understand well the insensitive property or maybe I'm missing something, but I can't get this to work.

Any ideas on what I can do wether to show the "Too late" text correctly or to get the insensitive stage of hotspots to work? Thanks!!

Adrian_DVL
Regular
Posts: 141
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Re: Show text on hotspot action??

#2 Post by Adrian_DVL »

Nobody has any idea?? I've been trying to call the screen using a renpy.call_screen statement in the label, but the outcome is the same... I'm searching for a way to display a message once a hotspot is clicked and then let me keep interacting with the imagemap. Or at least a way for the player to know when a hotspot is unavailable to click on...

Post Reply

Who is online

Users browsing this forum: voluorem