Page 1 of 1

Weird behavior on hover

Posted: Thu Feb 17, 2022 8:41 am
by OrsonDeWitt
Hello!
I am using a system where whenever a character ends speaking, his avatar is placed in a stack above the textbox. Unfortunately, I have encountered some weird behavior. If I, as the player, make choice, then everything is fine and other avatars are being shown above the textbox even if I hover over buttons with tooltips, regardless of the amount of speakers in the textbox. However, once I stop speaking and someone else speaks, thus adding my avatar into the stack above the textbox, AND I hover over anything that has a tooltip, the whole stack disappears immediately.
Could anyone help me pinpoint the issue, please? Here's the code

Code: Select all

init python:
    speaking = None

    def highlight(name, event, **kwargs):
        global speaking
        global all_character_tags
        speaking = name
        if event == "show":
            current_tag = renpy.get_say_image_tag() # to show face expressions
            if current_tag not in all_character_tags: # to show face expressions
                all_character_tags.append(current_tag) # to show face expressions
            sprite_tags = [ k for k in renpy.get_showing_tags() # to show face expressions
                            if k in all_character_tags ] # to show face expressions
            for z,k in enumerate(sprite_tags): # to show face expressions
                zorder = z if k != current_tag else len(sprite_tags) # to show face expressions
                renpy.show(k, zorder=zorder ) # to show face expressions

            if speaking == "wife" and wife_ == "urmy" and "urmy" in interlocutors:
                interlocutors.remove("urmy")
            elif speaking == "wife" and wife_ == "semet" and "semet" in interlocutors:
                interlocutors.remove("semet")
            elif speaking in interlocutors:
                interlocutors.remove(speaking) #remove the speaking character from the stack
        elif event == "slow_done" and speaking != "player":
	    if speaking == "wife" and wife_ == "urmy" and "urmy" not in interlocutors:
                interlocutors.insert(0,"urmy")
            elif speaking == "wife" and wife_ == "semet" and "semet" not in interlocutors:
                interlocutors.insert(0,"semet")
            elif speaking == "wife":
                pass
            elif speaking not in interlocutors:
                interlocutors.insert(0,speaking) #put the last speaker back into the stack on the first position
            speaking = None
        elif event == "end":
            renpy.show 
            if speaking == "wife" and wife_ == "urmy" and "urmy" not in interlocutors:
                interlocutors.insert(0,"urmy")
            elif speaking == "wife" and wife_ == "semet" and "semet" not in interlocutors:
                interlocutors.insert(0,"semet")
            elif speaking == "wife":
                pass
            elif speaking not in interlocutors:
                interlocutors.insert(0,speaking)
            speaking = None
    speaker = renpy.curry(highlight)

define urmy = Character(_("Urmymuse"), who_color="#ffff00", image="urmy", speaker="urmy", callback=speaker("urmy"))
define semet = Character(_("[semet_name]"), image="semet", callback=speaker("semet"))

default interlocutors = []