scripted_gui = {	
	rksplus_settings_gui = {
		context_type = player_context
		window_name = "RKSPLUS_rk_settings"
		visible = {
			is_ai = no
			has_global_flag = RKSPLUS_rk_settings_visible
		}
		
		effects = {
			RKSPLUS_rk_settings_exit_click = {
				ROOT = {
					clr_global_flag = RKSPLUS_rk_settings_visible
					if = {
						limit = {
							has_global_flag = RKSPLUS_rk_settings_updatelog_visible
						}
						clr_global_flag = RKSPLUS_rk_settings_updatelog_visible
					}
				}
			}

			RKSPLUS_rk_settings_playbutton_click = {
				ROOT = {
					clr_global_flag = RKSPLUS_rk_settings_visible
					if = {
						limit = {
							has_global_flag = RKSPLUS_rk_settings_updatelog_visible
						}
						clr_global_flag = RKSPLUS_rk_settings_updatelog_visible
					}
				}
			}

			RKSPLUS_rk_settings_option1_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_focusskip_flag
						}
					}
					set_global_flag = rksplus_focusskip_flag
					GER = {
						set_country_flag = GER_rksplus_startup_event_enable
					}
					
				}
				else = {
					clr_global_flag = rksplus_focusskip_flag

					GER = {
						clr_country_flag = GER_rksplus_startup_event_enable
					}
				}
				
			}

			RKSPLUS_rk_settings_option2_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_autonomydisabled_flag
						}
					}
					apply_autonomydisable_enable_rksplus = yes
		
					set_global_flag = rksplus_autonomydisabled_flag
					
				}
				else = {
					apply_autonomydisable_disable_rksplus = yes
		
					clr_global_flag = rksplus_autonomydisabled_flag
				}
				
			}

			RKSPLUS_rk_settings_option3_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_lesstroops_flag
						}
					}
					apply_potatomode_enable_rksplus = yes
		
					set_global_flag = rksplus_lesstroops_flag
					
				}
				else = {
					apply_potatomode_disable_rksplus = yes
		
					clr_global_flag = rksplus_lesstroops_flag
				}
				
			}

			RKSPLUS_rk_settings_option4_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_burgundyfocusskip_flag
						}
					}
					OBG = {
						set_country_flag = OBG_rksplus_startup_event_enable
					}
					
					set_global_flag = rksplus_burgundyfocusskip_flag
					
				}
				else = {
					OBG = {
						clr_country_flag = OBG_rksplus_startup_event_enable
					}
		
					clr_global_flag = rksplus_burgundyfocusskip_flag
				}
				
			}

			RKSPLUS_rk_settings_option5_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_noburgundywar_flag
						}
					}
					OBG = {
						set_country_flag = OBG_rksplus_settings_noburgundywar
					}
					
					set_global_flag = rksplus_noburgundywar_flag
					
				}
				else = {
					OBG = {
						clr_country_flag = OBG_rksplus_settings_noburgundywar
					}
		
					clr_global_flag = rksplus_noburgundywar_flag
				}
				
			}

			RKSPLUS_rk_settings_option6_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_aiunification_flag
						}
					}
					GER = {
						set_country_flag = GER_rksplus_allow_ai_unification_flag
					}
					
					set_global_flag = rksplus_aiunification_flag
					
				}
				else = {
					GER = {
						clr_country_flag = GER_rksplus_allow_ai_unification_flag
					}
		
					clr_global_flag = rksplus_aiunification_flag
				}
				
			}

			RKSPLUS_rk_settings_option7_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_ussr_peace_disabled
						}
					}
			
					set_global_flag = rksplus_ussr_peace_disabled
					
				}
				else = {
					clr_global_flag = rksplus_ussr_peace_disabled
				}
				
			}

			RKSPLUS_rk_settings_option8_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_ussr_peace_ural_only
						}
					}
			
					set_global_flag = rksplus_ussr_peace_ural_only
					
				}
				else = {
					clr_global_flag = rksplus_ussr_peace_ural_only
				}
				
			}

			RKSPLUS_rk_settings_option9_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = rksplus_aicollaboration_flag
						}
					}

					GER = {
						set_country_flag = GER_rksplus_allow_ai_collaboration_flag
					}
			
					set_global_flag = rksplus_aicollaboration_flag
					
				}
				else = {
					GER = {
						clr_country_flag = GER_rksplus_allow_ai_collaboration_flag
					}

					clr_global_flag = rksplus_aicollaboration_flag
				}
				
			}

			RKSPLUS_rk_settings_info_click = {
				if = {
					limit = {
						NOT = {
							has_global_flag = RKSPLUS_rk_settings_updatelog_visible
						}
					}
					set_global_flag = RKSPLUS_rk_settings_updatelog_visible
				}
				else = {
					clr_global_flag = RKSPLUS_rk_settings_updatelog_visible
				}
			}
		}
				
			
	}

	rksplus_settings_gui = {
		context_type = player_context
		window_name = "RKSPLUS_rk_settings_update"
		visible = {
			is_ai = no
			has_global_flag = RKSPLUS_rk_settings_visible
			has_global_flag = RKSPLUS_rk_settings_updatelog_visible
		}
	}

}