[Solved] Setting layer for custom displayable with Render.place?

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
heathen
Newbie
Posts: 5
Joined: Sat May 12, 2018 3:32 pm
Contact:

[Solved] Setting layer for custom displayable with Render.place?

#1 Post by heathen »

I am using the MouseToolTip class (from viewtopic.php?t=47205) which creates a custom Displayable, and then shows using renpy.Render.place()

Is it possible to force it to another layer? (As in, add a custom layer above screens and show it there.) What ends up happening is the tooltip ends up displaying behind the other imagemap buttons on the screen.

Relevant part of the non-mtt code:

Code: Select all

screen council_map2():
    if groks_common:
        add "images/council_map/world-council-map-b.jpg"
    else:
        add "images/council_map/world-council-map-a.jpg"
    #add "map-tiling.png" # used for debugging imagemap locations
    add mtt # adds the MouseToolTip class from https://lemmasoft.renai.us/forums/viewtopic.php?t=47205

    ## Creates new imagemap for each button
    if open_locations["light_house"]:
        imagemap:
            ground "images/buttons/hirise.png"
            hover "images/buttons/hirise-hover.png"
            alpha True
            xpos 180 ypos 720
            hotspot (0, 0, 120, 120) action Jump("meh") hovered mtt.Action(Text("{=map_tooltip_style}Light Side\nhome{/=map_tooltip_style}", outlines=[(absolute(2), "#000000", 0, 0)]))

    if open_locations["worker_flats"]:
        imagemap:
            ground "images/buttons/projects.png"
            hover "images/buttons/projects-hover.png"
            alpha True
            xpos 120 ypos 60
            hotspot (0, 0, 120, 120) action Jump("meh") hovered mtt.Action(Text("{=map_tooltip_style}Workers Flats{/=map_tooltip_style}", outlines=[(absolute(2), "#000000", 0, 0)]))
There are, of course, lots more of these, but what ends up happening is the tool tip text floats behind any buttons it crosses. I'd like it to be in front of them.
Last edited by heathen on Wed Jan 01, 2020 11:46 am, edited 1 time in total.

strayerror
Regular
Posts: 159
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Setting layer for custom displayable with Render.place?

#2 Post by strayerror »

You could just move the add mtt line to the end of your screen definition as items are layered atop each other in the order they're defined within the screen; i.e. last thing added ends up on top. If you still want to display the CDD on another layer (google the renpy docs for how to add custom layers) then it would need to be a completely separate screen (you can't split a single screen between layers) with its own show call (the layer on which a screen is displayed is specified at call time, not in its definition).

heathen
Newbie
Posts: 5
Joined: Sat May 12, 2018 3:32 pm
Contact:

Re: Setting layer for custom displayable with Render.place?

#3 Post by heathen »

Thank you so very much. Moving that to the end of the screen definition is so much cleaner and simpler than doing a custom layer.

Post Reply

Who is online

Users browsing this forum: Alex, Ocelot