Starting with FancyMenu v3.8.0, there is a new feature called "listeners".
Listeners execute action scripts when specific client or gameplay events happen.
They can expose variables to actions, placeholders, and requirements nested in the listener.
Other than most things in FancyMenu, listeners are not locked to a screen or overlay. They constantly run in the background, listening to their events. As soon as a listener gets fired, it executes its action script, even if there is no screen open at that time.
To create a new listener that listeners to an event and executes an action script, click on menu bar -> Customization -> Manage Listeners while NOT in the layout editor. There you can find an easy-to-use UI for creating and managing listeners.
Listeners often expose a special type of variable for its nested actions, requirements and placeholders.
These variables can be accessed like placeholders (they are effectively placeholders).
You use these variables by simply using their names with the $$ prefix in text inputs, similar to how you would use a normal placeholder.
For example, if you use the On Keyboard Key Pressed listener and want to print the key name to the log via the Print to Log action, you would use something like Key pressed! The key is: $$key_name as input for the message the action should print. The variable placeholder will later get replaced with the actual name of the key.
Even tho these are called "variables", they are in no way related to FancyMenu's normal variable system. You can't set these variables, since they are read-only. You also can't use any actions, requirements and placeholders meant for FancyMenu's variable system with these special listener variables, so using Get Variable Value [FM Variable], Is Variable Value [FM Variable] or Set Variable Value [FM Variable] will not work for listener variables.
This list should include most, if not all, of FancyMenu's listeners. It is possible that the list is not always up-to-date due to updates of the mod.
$$key_name – display name of the key$$key_keycode – GLFW key code$$key_scancode – GLFW scan code$$key_modifiers – active modifier bit mask$$key_name$$key_keycode$$key_scancode$$key_modifiers$$char – typed character$$mouse_pos_x – current X$$mouse_pos_y – current Y$$mouse_move_delta_x – X delta since last event$$mouse_move_delta_y – Y delta since last event$$button – left/right/middle$$mouse_pos_x – current X$$mouse_pos_y – current Y$$button$$mouse_pos_x$$mouse_pos_y$$scroll_delta_y – vertical scroll amount$$screen_identifier – identifier of the opened screen$$screen_identifier – identifier of the closed screen$$timestamp_millis – epoch millis when quitting$$timestamp_iso – ISO-8601 timestamp of quit moment$$days_survived – days since last death$$death_reason_string – plain-text cause$$death_reason_component – JSON component cause$$death_pos_x – death X coordinate$$death_pos_y – death Y coordinate$$death_pos_z – death Z coordinate$$var_name – variable name$$old_value – previous value$$new_value – new value$$download_url – download source$$target_file_path – saved file path$$download_succeeded – true/false$$selected_file_path – absolute chosen file path or empty if cancelled$$target_file_path – resolved path inside instance$$selection_succeeded – true if copy succeeded$$selection_cancelled – true if dialog closed$$failure_reason – error info on failure$$chat_message_string – plain text line$$chat_message_component – full JSON component$$sender_uuid – sender UUID or ERROR$$sender_name – sender name or ERROR$$chat_message_string – plain text line$$chat_message_component – full JSON component$$effect_key – effect resource location$$effect_type – positive/negative/neutral$$effect_duration – ticks remaining$$effect_key – expired effect$$effect_type – category$$new_experience_amount – after change$$old_experience_amount – before change$$is_level_up – TRUE if level increased$$damage_amount – health removed$$damage_type – damage type resource location$$is_fatal_damage – TRUE if lethal$$damage_source – attacker resource location or NONE$$freezing_intensity – 0.0 none, 1.0 fully frozen$$block_key – targeted block$$block_pos_x – block X$$block_pos_y – block Y$$block_pos_z – block Z$$distance_to_player – eyes to hit position$$block_key$$block_pos_x$$block_pos_y$$block_pos_z$$distance_to_player$$entity_key – targeted entity type$$distance_to_player$$entity_pos_x$$entity_pos_y$$entity_pos_z$$entity_uuid$$entity_key$$distance_to_player$$entity_pos_x$$entity_pos_y$$entity_pos_z$$entity_uuid$$entity_key$$distance_to_player – −1 if other dimension$$entity_pos_x$$entity_pos_y$$entity_pos_z$$entity_uuid$$dimension_key$$is_same_dimension_as_player$$entity_key$$distance_to_player – −1 if other dimension$$death_pos_x$$death_pos_y$$death_pos_z$$entity_uuid$$dimension_key$$damage_type$$is_same_dimension_as_player$$entity_killed_by_name$$entity_killed_by_key$$entity_killed_by_uuid$$entity_key$$distance_to_player$$entity_pos_x$$entity_pos_y$$entity_pos_z$$entity_uuid$$entity_key$$distance_to_player$$entity_pos_x$$entity_pos_y$$entity_pos_z$$entity_uuid$$entity_key$$entity_pos_x$$entity_pos_y$$entity_pos_z$$entity_uuid$$entity_key$$entity_pos_x$$entity_pos_y$$entity_pos_z$$entity_uuid$$entity_key$$entity_pos_x$$entity_pos_y$$entity_pos_z$$entity_uuid$$block_key$$broke_with_item_key – tool used or EMPTY$$block_pos_x$$block_pos_y$$block_pos_z$$block_key$$block_pos_x$$block_pos_y$$block_pos_z$$block_key$$block_pos_x$$block_pos_y$$block_pos_z$$block_key$$block_pos_x$$block_pos_y$$block_pos_z$$biome_key – entered biome$$biome_key – biome just left$$structure_key – entered structure$$structure_key – structure just left$$structure_key$$structure_key$$dimension_key – entered dimension$$fluid_type – fluid resource location$$fluid_type – fluid where swimming stopped$$fluid_type – touched fluid$$fluid_type – fluid no longer touched$$track_resource_location – audio file$$track_display_name – human-readable name or UNKNOWN$$track_artist – artist or UNKNOWN$$track_duration_ms – milliseconds (0 if unknown)$$track_resource_location$$track_display_name$$track_artist$$track_duration_ms$$sound_resource_location – sound file$$sound_display_name – subtitle name when available$$sound_origin_pos_x$$sound_origin_pos_y$$sound_origin_pos_z$$sound_origin_distance_to_player$$sound_origin_direction_from_player – degrees 0–360 relative to facing$$weather_type – clear/rain/thunder$$weather_can_snow – TRUE if snow renders$$weather_can_rain – TRUE if rain renders$old_pos_x – previous block X$old_pos_y – previous block Y$old_pos_z – previous block Z$new_pos_x – new block X$new_pos_y – new block Y$new_pos_z – new block Z$$server_ip – joined server address$$server_ip – left server address$$world_name – display name$$world_save_path – absolute save folder$$world_difficulty – difficulty key$$world_cheats_allowed – TRUE if cheats enabled$$world_icon_path – absolute icon path$$world_is_first_join – TRUE on very first visit$$world_name$$world_save_path$$world_difficulty$$world_cheats_allowed$$world_icon_path$$player_name – name of joining player$$player_uuid – UUID$$player_name$$player_uuid$$player_name$$player_uuid$$death_pos_x$$death_pos_y$$death_pos_z$$item_key – picked-up item resource location$$item_key – dropped item resource location$$item_key – consumed item$$item_key – used item$$used_on_type – block/entity/self/none$$used_on_entity_key – target entity type or empty$$used_on_block_key – target block or empty$$target_pos_x – target X or -1$$target_pos_y – target Y or -1$$target_pos_z – target Z or -1$$item_key – broken item$$item_type – tool/armor/other