Clear Last Popup - Utility Function

Talk about the mods or features you'd like to see in Daggerfall Unity. Give mod creators some ideas!
Post Reply
User avatar
Posts: 48
Joined: Mon Sep 21, 2020 7:01 am

Clear Last Popup - Utility Function

Post by joshcamas »

Since a lot of events (such as interactions and deaths) lead to popups that can't be modified, I made a little function that clears the last created popup. In my case, I'm using it to stop death popups and the "You see a " popup on interaction on a certain enemy. :) It would also be easy to go through the list and remove certain popups, if you wanted to do that.

Code: Select all

public static void ClearLastPopup()
            var flags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance;

            var popupField = typeof(DaggerfallHUD).GetField("popupText",flags);
            var dfHUD = typeof(DaggerfallUI).GetField("dfHUD", flags);
            var textRowsField = typeof(PopupText).GetField("textRows", flags);

            var hud = dfHUD.GetValue(DaggerfallUI.Instance);
            var popup = popupField.GetValue(hud);
            var textRows = (LinkedList<TextLabel>)textRowsField.GetValue(popup);

            if(textRows.Count > 0)

Post Reply