on_actions = {
    on_startup = {
        effect = {
            if = {
                limit = { has_global_flag = rl_setup_complete NOT = { has_global_flag = rl_ruleset_configured } }
                set_global_flag = rl_ruleset_configured
                set_global_flag = rl_ruleset_standard
                clr_global_flag = rl_ruleset_hardcore
            }
            if = {
                limit = { has_global_flag = rl_setup_complete NOT = { has_global_flag = rl_hc_replace_mode_configured } }
                set_global_flag = rl_hc_replace_mode_configured
                set_global_flag = rl_hc_manual_replace
                clr_global_flag = rl_hc_auto_replace_weakest
            }
            if = {
                limit = { NOT = { has_global_flag = rl_setup_complete } }
                every_country = { limit = { is_ai = no } country_event = { id = rl.0 days = 1 } }
            }
        }
    }
    on_weekly = {
        effect = {
            if = {
                limit = { NOT = { has_global_flag = rl_setup_complete } is_ai = no }
                if = { limit = { NOT = { has_global_flag = rl_mode_configured } } country_event = { id = rl.0 } }
                else_if = { limit = { NOT = { has_global_flag = rl_frequency_configured } } country_event = { id = rl.2 } }
                else_if = { limit = { NOT = { has_global_flag = rl_rarity_mode_configured } } country_event = { id = rl.4 } }
                else_if = { limit = { has_global_flag = rl_ruleset_hardcore NOT = { has_global_flag = rl_hc_replace_mode_configured } } country_event = { id = rl.6 } }
                else = { rl_finalize_roguelike_setup = yes }
            }
            else_if = {
                limit = { has_global_flag = rl_setup_complete NOT = { has_global_flag = rl_v24_configured } is_ai = no }
                clr_global_flag = rl_setup_complete
                clr_global_flag = rl_frequency_configured
                clr_global_flag = rl_rarity_mode_configured
                country_event = { id = rl.2 }
            }
            else_if = {
                limit = { has_global_flag = rl_setup_complete has_global_flag = rl_v24_configured NOT = { has_global_flag = rl_v241_configured } is_ai = no }
                clr_global_flag = rl_setup_complete
                clr_global_flag = rl_rarity_mode_configured
                country_event = { id = rl.4 }
            }
            else_if = {
                limit = {
                    has_global_flag = rl_setup_complete
                    OR = { has_global_flag = rl_freq_weekly has_global_flag = rl_freq_biweekly }
                    OR = { has_global_flag = rl_mode_all AND = { has_global_flag = rl_mode_player_only is_ai = no } }
                }
                rl_initialize_country = yes
                rl_handle_weekly_offer_schedule = yes
            }
        }
    }
    on_monthly = {
        effect = {
            if = {
                limit = { has_global_flag = rl_mode_player_only is_ai = no }
                rl_update_global_player_only_escalation = yes
            }
            if = {
                limit = { has_global_flag = rl_mode_player_only is_ai = yes }
                rl_apply_player_only_ai_escalation = yes
            }
            if = {
                limit = { NOT = { has_global_flag = rl_setup_complete } is_ai = no }
                if = { limit = { NOT = { has_global_flag = rl_mode_configured } } country_event = { id = rl.0 } }
                else_if = { limit = { NOT = { has_global_flag = rl_frequency_configured } } country_event = { id = rl.2 } }
                else_if = { limit = { NOT = { has_global_flag = rl_rarity_mode_configured } } country_event = { id = rl.4 } }
                else_if = { limit = { has_global_flag = rl_ruleset_hardcore NOT = { has_global_flag = rl_hc_replace_mode_configured } } country_event = { id = rl.6 } }
                else = { rl_finalize_roguelike_setup = yes }
            }
            else_if = {
                limit = {
                    has_global_flag = rl_setup_complete
                    OR = { has_global_flag = rl_mode_all AND = { has_global_flag = rl_mode_player_only is_ai = no } }
                }
                rl_initialize_country = yes
                rl_run_monthly_specials = yes
                rl_handle_monthly_offer_schedule = yes
            }
        }
    }
}
