﻿acs_sg_filter_trait_education_general = {
    saved_scopes = {
        ctrl_value
        position
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            any_in_list = {
                variable = acs_vl_filter_trait_education_general
                save_temporary_scope_value_as = { name = offset value = -1 }
                this = acs_position_value_offset
            }
        }
    }     
    effect = {
        set_local_variable = { name = acs_lv_start value = scope:position }
        acs_simple_checkbox = { LIST = acs_vl_filter_trait_education_general START = local_var:acs_lv_start }
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_education_general
                        always = yes
                    }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 0 }
            }
            else = {
                remove_list_variable = { name = acs_vl_filter_active target = 0 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    }
}
acs_sg_filter_trait_education_general_group = {
    saved_scopes = {
        ctrl_value
        position
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            trigger_if = {
                limit = { 
                    scope:ctrl_value = 0
                }
                NOT = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_education_general
                        AND = {
                            this >= scope:position
                            save_temporary_scope_value_as = { name = offset value = 7 }
                            this <= acs_position_offset
                        }
                    }
                }    
            } 
            trigger_else_if = {
                limit = { 
                    scope:ctrl_value = 1
                }
                any_in_list = {
                    variable =  acs_vl_filter_trait_education_general
                    OR = {
                        this = scope:position
                        save_temporary_scope_value_as = { name = offset value = 2 }
                        this = acs_position_offset
                        save_temporary_scope_value_as = { name = offset value = 4 }
                        this = acs_position_offset
                        save_temporary_scope_value_as = { name = offset value = 6 }
                        this = acs_position_offset
                    }
                    count = 4
                }
            }
            trigger_else = {
                 any_in_list = {
                    variable =  acs_vl_filter_trait_education_general
                    OR = {
                        save_temporary_scope_value_as = { name = offset value = 1 }
                        this = acs_position_offset
                        save_temporary_scope_value_as = { name = offset value = 3 }
                        this = acs_position_offset
                        save_temporary_scope_value_as = { name = offset value = 5 }
                        this = acs_position_offset
                        save_temporary_scope_value_as = { name = offset value = 7 }
                        this = acs_position_offset
                    }
                    count = 4
                }
            }
        }
    }     
    effect = {
        acs_se_save_undo = yes
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    NOT = {
                        any_in_list = {
                            variable = acs_vl_filter_trait_education_general
                            AND = {
                                this >= scope:position
                                save_temporary_scope_value_as = { name = offset value = 7 }
                                this <= acs_position_offset
                            }
                        }
                    }
                }
                set_local_variable = { name = acs_lv_counter value = scope:position }
                set_local_variable = { name = acs_lv_total_left value = 4 }
                while = {
                    limit = {
                        local_var:acs_lv_total_left > 0
                    }
                    add_to_variable_list = { name =  acs_vl_filter_trait_education_general target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 2 }
                    change_local_variable = { name = acs_lv_total_left add = -1 }
                }
            }
            else_if = {
                limit = {
                    any_in_list = {
                        variable =  acs_vl_filter_trait_education_general
                        OR = {
                            this = scope:position
                            save_temporary_scope_value_as = { name = offset value = 2 }
                            this = acs_position_offset
                            save_temporary_scope_value_as = { name = offset value = 4 }
                            this = acs_position_offset
                            save_temporary_scope_value_as = { name = offset value = 6 }
                            this = acs_position_offset
                        }
                        count = 4
                    }
                }
                set_local_variable = { name = acs_lv_counter value = scope:position }
                set_local_variable = { name = acs_lv_total_left value = 4 }
                while = {
                    limit = {
                        local_var:acs_lv_total_left > 0
                    }
                    remove_list_variable = { name = acs_vl_filter_trait_education_general target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                    add_to_variable_list = { name =  acs_vl_filter_trait_education_general target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                    change_local_variable = { name = acs_lv_total_left add = -1 }
                }
            }
            else = {
                set_local_variable = { name = acs_lv_counter value = scope:position }
                set_local_variable = { name = acs_lv_total_left value = 8 }
                while = {
                    limit = {
                        local_var:acs_lv_total_left > 0
                    }
                    remove_list_variable = { name = acs_vl_filter_trait_education_general target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                    change_local_variable = { name = acs_lv_total_left add = -1 }
                }
            }
            if = {
                limit = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_education_general
                        always = yes
                    }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 0 }
            }
            else = {
                remove_list_variable = { name = acs_vl_filter_active target = 0 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    }
}
acs_sg_filter_trait_education_martial = {
    saved_scopes = {
        ctrl_value
        position
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            any_in_list = {
                variable = acs_vl_filter_trait_education_martial
                save_temporary_scope_value_as = { name = offset value = -1 }
                this = acs_position_value_offset
            }
        }
    }     
    effect = {
        set_local_variable = { name = acs_lv_start value = scope:position }
        acs_simple_checkbox = { LIST = acs_vl_filter_trait_education_martial START = local_var:acs_lv_start }
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_education_martial
                        always = yes
                    }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 1 }
            }
            else = {
                remove_list_variable = { name = acs_vl_filter_active target = 1 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    }
}
acs_sg_filter_trait_education_martial_group = {
        saved_scopes = {
        ctrl_value
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            trigger_if = {
                limit = { 
                    scope:ctrl_value = 0
                }
                NOT = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_education_martial
                        always = yes
                    }
                }    
            } 
            trigger_else_if = {
                limit = { 
                    scope:ctrl_value = 1
                }
                any_in_list = {
                    variable =  acs_vl_filter_trait_education_martial
                    save_temporary_scope_value_as = { name = to_get_modulo value = this }
                    save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                    scope:to_test = 0
                    count = 4
                }
            }
            trigger_else = {
                 any_in_list = {
                    variable =  acs_vl_filter_trait_education_martial
                    save_temporary_scope_value_as = { name = to_get_modulo value = this }
                    save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                    scope:to_test = 1
                    count = 4
                }
            }
        }
    }     
    effect = {
        acs_se_save_undo = yes
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    NOT = {
                        any_in_list = {
                            variable = acs_vl_filter_trait_education_martial
                            always = yes
                        }
                    }
                }
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 8
                    }
                    add_to_variable_list = { name =  acs_vl_filter_trait_education_martial target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 2 }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 1 }
            }
            else_if = {
                limit = {
                    any_in_list = {
                        variable =  acs_vl_filter_trait_education_martial
                        save_temporary_scope_value_as = { name = to_get_modulo value = this }
                        save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                        scope:to_test = 0
                        count = 4
                    }
                }
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 8
                    }
                    remove_list_variable = { name = acs_vl_filter_trait_education_martial target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                    add_to_variable_list = { name =  acs_vl_filter_trait_education_martial target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                }
            }
            else = {
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 8
                    }
                    remove_list_variable = { name = acs_vl_filter_trait_education_martial target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                }
                remove_list_global_variable = { name = acs_vl_filter_active target = 1 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    } 
}
acs_sg_filter_trait_fame_born_status = {
    saved_scopes = {
        ctrl_value
        position
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            any_in_list = {
                variable = acs_vl_filter_trait_fame_born_status
                save_temporary_scope_value_as = { name = offset value = -1 }
                this = acs_position_value_offset
            }
        }
    }     
    effect = {
        set_local_variable = { name = acs_lv_start value = scope:position }
        acs_simple_checkbox = { LIST = acs_vl_filter_trait_fame_born_status START = local_var:acs_lv_start }
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_fame_born_status
                        always = yes
                    }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 156 }
            }
            else = {
                remove_list_variable = { name = acs_vl_filter_active target = 156 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    }
}
acs_sg_filter_trait_fame_born_status_group = {
        saved_scopes = {
        ctrl_value
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            trigger_if = {
                limit = { 
                    scope:ctrl_value = 0
                }
                NOT = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_fame_born_status
                        always = yes
                    }
                }    
            } 
            trigger_else_if = {
                limit = { 
                    scope:ctrl_value = 1
                }
                any_in_list = {
                    variable =  acs_vl_filter_trait_fame_born_status
                    save_temporary_scope_value_as = { name = to_get_modulo value = this }
                    save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                    scope:to_test = 0
                    count = 7
                }
            }
            trigger_else = {
                 any_in_list = {
                    variable =  acs_vl_filter_trait_fame_born_status
                    save_temporary_scope_value_as = { name = to_get_modulo value = this }
                    save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                    scope:to_test = 1
                    count = 7
                }
            }
        }
    }     
    effect = {
        acs_se_save_undo = yes
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    NOT = {
                        any_in_list = {
                            variable = acs_vl_filter_trait_fame_born_status
                            always = yes
                        }
                    }
                }
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 14
                    }
                    add_to_variable_list = { name =  acs_vl_filter_trait_fame_born_status target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 2 }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 156 }
            }
            else_if = {
                limit = {
                    any_in_list = {
                        variable =  acs_vl_filter_trait_fame_born_status
                        save_temporary_scope_value_as = { name = to_get_modulo value = this }
                        save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                        scope:to_test = 0
                        count = 7
                    }
                }
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 14
                    }
                    remove_list_variable = { name = acs_vl_filter_trait_fame_born_status target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                    add_to_variable_list = { name =  acs_vl_filter_trait_fame_born_status target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                }
            }
            else = {
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 14
                    }
                    remove_list_variable = { name = acs_vl_filter_trait_fame_born_status target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                }
                remove_list_global_variable = { name = acs_vl_filter_active target = 156 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    } 
}
acs_sg_filter_trait_physical_beauty = {
    saved_scopes = {
        ctrl_value
        position
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            any_in_list = {
                variable = acs_vl_filter_trait_physical_beauty
                save_temporary_scope_value_as = { name = offset value = -1 }
                this = acs_position_value_offset
            }
        }
    }     
    effect = {
        set_local_variable = { name = acs_lv_start value = scope:position }
        acs_simple_checkbox = { LIST = acs_vl_filter_trait_physical_beauty START = local_var:acs_lv_start }
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_physical_beauty
                        always = yes
                    }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 539 }
            }
            else = {
                remove_list_variable = { name = acs_vl_filter_active target = 539 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    }
}
acs_sg_filter_trait_physical_intellect = {
    saved_scopes = {
        ctrl_value
        position
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            any_in_list = {
                variable = acs_vl_filter_trait_physical_intellect
                save_temporary_scope_value_as = { name = offset value = -1 }
                this = acs_position_value_offset
            }
        }
    }     
    effect = {
        set_local_variable = { name = acs_lv_start value = scope:position }
        acs_simple_checkbox = { LIST = acs_vl_filter_trait_physical_intellect START = local_var:acs_lv_start }
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_physical_intellect
                        always = yes
                    }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 540 }
            }
            else = {
                remove_list_variable = { name = acs_vl_filter_active target = 540 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    }
}
acs_sg_filter_trait_physical_physique = {
    saved_scopes = {
        ctrl_value
        position
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            any_in_list = {
                variable = acs_vl_filter_trait_physical_physique
                save_temporary_scope_value_as = { name = offset value = -1 }
                this = acs_position_value_offset
            }
        }
    }     
    effect = {
        set_local_variable = { name = acs_lv_start value = scope:position }
        acs_simple_checkbox = { LIST = acs_vl_filter_trait_physical_physique START = local_var:acs_lv_start }
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    any_in_list = {
                        variable = acs_vl_filter_trait_physical_physique
                        always = yes
                    }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 541 }
            }
            else = {
                remove_list_variable = { name = acs_vl_filter_active target = 541 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    }
}
acs_sg_filter_inspiration = {
    saved_scopes = {
        ctrl_value
        position
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            any_in_list = {
                variable = acs_vl_filter_inspiration
                save_temporary_scope_value_as = { name = offset value = -1 }
                this = acs_position_value_offset
            }
        }
    }     
    effect = {
        set_local_variable = { name = acs_lv_start value = scope:position }
        acs_simple_checkbox = { LIST = acs_vl_filter_inspiration START = local_var:acs_lv_start }
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    any_in_list = {
                        variable = acs_vl_filter_inspiration
                        always = yes
                    }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 1000 }
            }
            else = {
                remove_list_variable = { name = acs_vl_filter_active target = 1000 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    }
}
acs_sg_filter_inspiration_group = {
        saved_scopes = {
        ctrl_value
    }
    is_shown = {
        global_var:acs_gv_main_filters = {
            trigger_if = {
                limit = { 
                    scope:ctrl_value = 0
                }
                NOT = {
                    any_in_list = {
                        variable = acs_vl_filter_inspiration
                        always = yes
                    }
                }    
            } 
            trigger_else_if = {
                limit = { 
                    scope:ctrl_value = 1
                }
                any_in_list = {
                    variable =  acs_vl_filter_inspiration
                    save_temporary_scope_value_as = { name = to_get_modulo value = this }
                    save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                    scope:to_test = 0
                    count = 8
                }
            }
            trigger_else = {
                 any_in_list = {
                    variable =  acs_vl_filter_inspiration
                    save_temporary_scope_value_as = { name = to_get_modulo value = this }
                    save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                    scope:to_test = 1
                    count = 8
                }
            }
        }
    }     
    effect = {
        acs_se_save_undo = yes
        global_var:acs_gv_main_filters = {
            if = {
                limit = {
                    NOT = {
                        any_in_list = {
                            variable = acs_vl_filter_inspiration
                            always = yes
                        }
                    }
                }
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 16
                    }
                    add_to_variable_list = { name =  acs_vl_filter_inspiration target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 2 }
                }
                add_to_variable_list = { name = acs_vl_filter_active target = 1000 }
            }
            else_if = {
                limit = {
                    any_in_list = {
                        variable =  acs_vl_filter_inspiration
                        save_temporary_scope_value_as = { name = to_get_modulo value = this }
                        save_temporary_scope_value_as = { name = to_test value = acs_modulo_2 }
                        scope:to_test = 0
                        count = 8
                    }
                }
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 16
                    }
                    remove_list_variable = { name = acs_vl_filter_inspiration target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                    add_to_variable_list = { name =  acs_vl_filter_inspiration target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                }
            }
            else = {
                set_local_variable = { name = acs_lv_counter value = 0 }
                while = {
                    limit = {
                        local_var:acs_lv_counter < 16
                    }
                    remove_list_variable = { name = acs_vl_filter_inspiration target = local_var:acs_lv_counter }
                    change_local_variable = { name = acs_lv_counter add = 1 }
                }
                remove_list_global_variable = { name = acs_vl_filter_active target = 1000 }
            }
        }
        acs_se_auto_apply_sorting_and_filters = yes
    } 
}