I want to have a function when you hover some text with the mouse in the dialogue, a screen gets activated, in my case, to put some explanation.
I got a function that works perfectly that PastryIRL gave me. Basically creates a new tag that make the function possible, but it replace the {a} tag hyperlink function, making the url visible like another "explanation".
I would like to know If it's possible to not get rid of the {a} tag, or if there could be other solution, like other way to call the url from clicking the text.
The code:
Code: Select all
init 1 python:
def call_lore(argument):
if argument is None:
renpy.hide_screen("lore_screen")
renpy.restart_interaction()
else:
renpy.show_screen("lore_screen", txt=argument)
renpy.restart_interaction()
def return_hyperlink_style(argument):
return style.hyperlink_text
def lore_tag(tag, argument, contents):
return [(renpy.TEXT_TAG, u"a={}".format(argument)),
] + contents + [
(renpy.TEXT_TAG, u"/a"),
]
config.custom_text_tags["lore"] = lore_tag
style default hyperlink_functions (return_hyperlink_style, None, call_lore)
screen lore_screen(txt):
zorder 25
frame:
xpos 320
ypos 846
xpadding 15
ypadding 15
yanchor 1.0
xmaximum 400
text txt xalign 0.5 text_align 0.5 size 18
label start:
"{lore=Peter}Hello{/lore}"
return