So... I still don't know if it's possible to perform this check in some easier manner, but... I've managed to come up at least with
some kind of solution.
There's probably some caveats around this - one is that the cues will trigger a lot (every time you open/close window etc), and the other is the way I've went for global variable set-up. Not quite sure what would be the best way to handle it, but this was also a bit of a quick hack for myself so I can continue playing
Another thing is that the list of menus is a bit static - I almost managed to get around this by using a single UI triggered registration, but unfortunately that one did not cover the case where you move around on foot. There is a
TopLevelMenu or some such which basically corresponds to your cockpit view - so as you open the map and close it, that one will be getting opened/closed.
In the process I've also found it useful to log the
event.param,
event.param2, and
event.param3 on a blank
event_ui_triggered condition. However... Take not that you will most likely want to filter out the
Time menu in that case (triggers all the time - all puns intended). The interesting part is that you will also get the
Hotkey events as well, which can probably be misused in some rather diabolical ways.
If any modder out there happens to know of a better solution, just let me know, and I'll try to at least update this code snippet here.
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<mdscript name="ReportCurrentStatus" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="Initialise">
<actions>
<!-- The RCS_ thing was used mainly as a kind of namespace clutch - just in case someone else decides to name variable $player_can_read_notifications. -->
<set_value name="global.$RCS_player_can_read_notifications" exact="true" comment="Assume that the player is flying or walking and can read notifications."/>
</actions>
</cue>
<cue name="MenuOpened" instantiate="true">
<conditions>
<check_any>
<!-- Empty control string means the UI was opened. -->
<event_ui_triggered screen="'OptionsMenu'" control="''"/>
<event_ui_triggered screen="'PlayerInfoMenu'" control="''"/>
<event_ui_triggered screen="'DockedMenu'" control="''"/>
<event_ui_triggered screen="'MapMenu'" control="''"/>
<event_ui_triggered screen="'EncyclopediaMenu'" control="''"/>
<event_ui_triggered screen="'HelpMenu'" control="''"/>
<event_ui_triggered screen="'ShipConfigurationMenu'" control="''"/>
<event_ui_triggered screen="'StationConfigurationMenu'" control="''"/>
<event_ui_triggered screen="'StationOverviewMenu'" control="''"/>
<event_ui_triggered screen="'TransactionLogMenu'" control="''"/>
<event_ui_triggered screen="'ResearchMenu'" control="''"/>
<event_ui_triggered screen="'TerraformingMenu'" control="''"/>
</check_any>
</conditions>
<actions>
<set_value name="global.$RCS_player_can_read_notifications" exact="false"/>
<debug_text text="'Player can no longer read notifications after opening menu: ' + event.param" />
</actions>
</cue>
<cue name="MenuClosed" instantiate="true">
<conditions>
<check_any>
<event_ui_triggered screen="'OptionsMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'PlayerInfoMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'DockedMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'MapMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'EncyclopediaMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'HelpMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'ShipConfigurationMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'StationConfigurationMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'StationOverviewMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'TransactionLogMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'ResearchMenu'" control="'menu_close'"/>
<event_ui_triggered screen="'TerraformingMenu'" control="'menu_close'"/>
</check_any>
</conditions>
<actions>
<set_value name="global.$RCS_player_can_read_notifications" exact="true"/>
<debug_text text="'Player can read notifications after closing menu: ' + event.param" />
</actions>
</cue>
</cues>
</mdscript>