("cf_save_player_exit", # Here is the script in question called by the event
[(store_script_param, ":player_id", 1), # This is the argument sent in the call_script of the event handler
# And all what follows are the scripts of the block
(player_get_troop_id, ":troop_id", ":player_id"),
(is_between, ":troop_id", playable_troops_begin, playable_troops_end),
(player_get_unique_id, ":player_unique_id", ":player_id"),
(troop_get_slot, ":inactive_array_size", "trp_inactive_players_array", slot_player_array_size),
(assign, ":loop_end", ":inactive_array_size"),
(assign, ":inactive_index", slot_player_array_begin),
(try_for_range, ":unused", 0, ":loop_end"),
(this_or_next|troop_slot_eq, "trp_inactive_players_array", ":inactive_index", 0),
(troop_slot_eq, "trp_inactive_players_array", ":inactive_index", ":player_unique_id"),
(assign, ":loop_end", -1),
(else_try),
(val_add, ":inactive_index", player_array_entry_size),
(try_end),
(try_begin),
(call_script, "script_cf_player_store_inactive", ":player_id", ":inactive_index"),
(troop_set_slot, "trp_inactive_players_array", ":inactive_index", ":player_unique_id"),
(player_set_slot, ":player_id", slot_player_inactive_index, ":inactive_index"),
(neq, ":loop_end", -1),
(val_add, ":inactive_array_size", 1),
(troop_set_slot, "trp_inactive_players_array", slot_player_array_size, ":inactive_array_size"),
(try_end),
(assign, ":loop_end", factions_end),
(try_for_range, ":faction_id", castle_factions_begin, ":loop_end"),
(faction_get_slot, ":lord_player_uid", ":faction_id", slot_faction_lord_player_uid),
(eq, ":lord_player_uid", ":player_unique_id"),
(assign, ":loop_end", -1),
(store_mission_timer_a, ":current_time"),
(faction_set_slot, ":faction_id", slot_faction_lord_last_seen_time, ":current_time"),
(try_end),
]),