Source code for tuxemon.event.conditions.dialog_open

# SPDX-License-Identifier: GPL-3.0
# Copyright (c) 2014-2023 William Edwards <>, Benjamin Bean <>
from __future__ import annotations

from tuxemon.event import MapCondition
from tuxemon.event.eventcondition import EventCondition
from tuxemon.session import Session

[docs]class DialogOpenCondition(EventCondition): """ Check to see if a dialog window is open. Script usage: .. code-block:: is dialog_open """ name = "dialog_open"
[docs] def test(self, session: Session, condition: MapCondition) -> bool: """ Check to see if a dialog window is open. Parameters: session: The session object condition: The map condition object. Returns: Whether a dialog window is open or not. """ for state in session.client.active_states: if == "DialogState": return True return False