What's the 'new' version of ui.add()?

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
Devon Andersson
Newbie
Posts: 7
Joined: Sun Nov 12, 2017 9:10 am
Contact:

What's the 'new' version of ui.add()?

#1 Post by Devon Andersson »

I have a custom tooltip build with renpy.displayable that follows the mousecuror.
In this thread ...
viewtopic.php?t=19572#p253634
... I've seen this similar code:

Code: Select all

init python:
    class MouseTooltip(renpy.Displayable):
	# long and irrelevant class code ...

    def MouseEvent():
        ui.add(mousetooltip)
    config.overlay_functions.append(MouseEvent)

define mousetooltip = MouseTooltip()
I'd like to add the tooltip on every screen automatically. Since ui is considered outdated, what's the replacement for the ui.add()-line?

User avatar
PyTom
Ren'Py Creator
Posts: 16093
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: What's the 'new' version of ui.add()?

#2 Post by PyTom »

It's screens. Screens replace ui functions and overlays.
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
Devon Andersson
Newbie
Posts: 7
Joined: Sun Nov 12, 2017 9:10 am
Contact:

Re: What's the 'new' version of ui.add()?

#3 Post by Devon Andersson »

I see. So I ditched the MouseEvent-function for ...

Code: Select all

screen s_mousetooltip():
    zorder 110
    add mousetooltip
... and added "show screen s_mousetooltip" in my after_load-label
That works.

Post Reply

Who is online

Users browsing this forum: Ocelot, simple_human