scripted_gui = {	
	wrw_settings_gui = {
		context_type = player_context
		window_name = "wrw_settings"
		visible = {
			is_ai = no
			has_global_flag = wrw_settings_visible
		}
		
		effects = {
			wrw_settings_exit_click = {
				ROOT = {
					clr_global_flag = wrw_settings_visible
				}
			}

			wrw_settings_playbutton_click = {
				ROOT = {
					clr_global_flag = wrw_settings_visible
				}
			}

			wrw_settings_option1_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = WRW_GERMANY_BUFF_FLAG
						}
					}
					set_global_flag = WRW_GERMANY_BUFF_FLAG
				}
				else = {
					clr_global_flag = WRW_GERMANY_BUFF_FLAG
				}
			}
			
			wrw_settings_option2_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = WRW_GERMANY_CIVWAR_NOT_FLAG
						}
					}
					set_global_flag = WRW_GERMANY_CIVWAR_NOT_FLAG
				}
				else = {
					clr_global_flag = WRW_GERMANY_CIVWAR_NOT_FLAG
				}
			}
			
			wrw_settings_option3_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = WRW_WINNER_GER_FLAG
							has_global_flag = WRW_WINNER_RUS_FLAG
						}
					}
					set_global_flag = WRW_WINNER_GER_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_WINNER_GER_FLAG
					}
					clr_global_flag = WRW_WINNER_GER_FLAG
					set_global_flag = WRW_WINNER_RUS_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_WINNER_RUS_FLAG
					}
					clr_global_flag = WRW_WINNER_GER_FLAG
					clr_global_flag = WRW_WINNER_RUS_FLAG
					
				}
			}
			
			wrw_settings_option4_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = WRW_WRRF_TUKHACH_FLAG
						}
					}
					set_global_flag = WRW_WRRF_TUKHACH_FLAG
				}
				else = {
					clr_global_flag = WRW_WRRF_TUKHACH_FLAG
				}
			}
			
			wrw_settings_option5_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = WRW_SBI_POKR_FLAG
						}
					}
					set_global_flag = WRW_SBI_POKR_FLAG
				}
				else = {
					clr_global_flag = WRW_SBI_POKR_FLAG
				}
			}
			
			wrw_settings_option6_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = WRW_SBI_WIN_FLAG
							has_global_flag = WRW_SBI_LOST_FLAG
						}
					}
					set_global_flag = WRW_SBI_WIN_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_SBI_WIN_FLAG
					}
					clr_global_flag = WRW_SBI_WIN_FLAG
					set_global_flag = WRW_SBI_LOST_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_SBI_LOST_FLAG
					}
					clr_global_flag = WRW_SBI_WIN_FLAG
					clr_global_flag = WRW_SBI_LOST_FLAG
					
				}
			}
			
			wrw_settings_option7_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = WRW_SBI_COOL_FLAG
							has_global_flag = WRW_SBI_MILITARY_FLAG
							has_global_flag = WRW_SBI_HARMS_FLAG
						}
					}
					set_global_flag = WRW_SBI_COOL_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_SBI_COOL_FLAG
					}
					clr_global_flag = WRW_SBI_COOL_FLAG
					clr_global_flag = WRW_SBI_HARMS_FLAG
					set_global_flag = WRW_SBI_MILITARY_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_SBI_MILITARY_FLAG
					}
					clr_global_flag = WRW_SBI_MILITARY_FLAG
					clr_global_flag = WRW_SBI_COOL_FLAG
					set_global_flag = WRW_SBI_HARMS_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_SBI_HARMS_FLAG
					}
					clr_global_flag = WRW_SBI_COOL_FLAG
					clr_global_flag = WRW_SBI_MILITARY_FLAG
					clr_global_flag = WRW_SBI_HARMS_FLAG
				}
			}
			
			wrw_settings_option8_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = WRW_SBI_WRRF_FLAG
							has_global_flag = WRW_SBI_SIBERIA_FLAG
						}
					}
					set_global_flag = WRW_SBI_WRRF_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_SBI_WRRF_FLAG
					}
					clr_global_flag = WRW_SBI_WRRF_FLAG
					set_global_flag = WRW_SBI_SIBERIA_FLAG
				}
				else_if = {
					limit = {
						has_global_flag = WRW_SBI_SIBERIA_FLAG
					}
					clr_global_flag = WRW_SBI_WRRF_FLAG
					clr_global_flag = WRW_SBI_SIBERIA_FLAG
					
				}
			}
		}
	}

}