scripted_gui = {

	sst_main_container = {
	
		context_type = selected_country_context
		
		window_name = "sst_main_container"
		
		visible = {
			ROOT = {
				is_ai = no
				has_global_flag = sst_enabled
				OR = {
					has_country_flag = tp_is_host
					NOT = {
						has_global_flag = tp_is_multiplayer
					}
				}
			}
		}
		
		effects = {
### SHIP TYPES ###
			sst_add_xp_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 11 }
				OWNER = {
					navy_experience = 50
				}
			}
			sst_clear_xp_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 11 }
				OWNER = {
					navy_experience = -50000
				}
			}
			sst_help_button_click = {
				ROOT = {
					country_event = toolpack.4
				}
			}
			sst_enable_convoys_click = {
				if = {
					limit = {
						NOT = { has_global_flag = sst_convoys_disabled }
					}
					set_global_flag = sst_convoys_disabled
				}
				else = { clr_global_flag = sst_convoys_disabled }
			}
			sst_type_destroyer_on_click = {
				set_global_flag = sst_destroyer_enabled
			}
			sst_type_destroyer_off_click = {
				clr_global_flag = sst_destroyer_enabled
			}
			sst_type_lc_on_click = {
				set_global_flag = sst_lc_enabled
			}
			sst_type_lc_off_click = {
				clr_global_flag = sst_lc_enabled
			}
			sst_type_hc_on_click = {
				set_global_flag = sst_hc_enabled
			}
			sst_type_hc_off_click = {
				clr_global_flag = sst_hc_enabled
			}
			sst_type_bc_on_click = {
				set_global_flag = sst_bc_enabled
			}
			sst_type_bc_off_click = {
				clr_global_flag = sst_bc_enabled
			}
			sst_type_bs_on_click = {
				set_global_flag = sst_bs_enabled
			}
			sst_type_bs_off_click = {
				clr_global_flag = sst_bs_enabled
			}
			sst_type_carrier_on_click = {
				set_global_flag = sst_carrier_enabled
			}
			sst_type_carrier_off_click = {
				clr_global_flag = sst_carrier_enabled
			}
			sst_type_sub_on_click = {
				set_global_flag = sst_sub_enabled
			}
			sst_type_sub_off_click = {
				clr_global_flag = sst_sub_enabled
			}
			sst_delete_button_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 12 }
				tcw_clear_all_global_confirms = yes
				set_global_flag = tp_open_confirmation_window
				set_global_flag = sst_confirm_ship_deletion
				set_country_flag = sst_ship_deletion_target
			}
### DESIGN YEAR ###
			sst_y1_off_click = {
				clr_global_flag = sst_y1_enabled
			}
			sst_y1_on_click = {
				set_global_flag = sst_y1_enabled

				clr_global_flag = sst_y2_enabled
				clr_global_flag = sst_y3_enabled
				clr_global_flag = sst_y4_enabled
				clr_global_flag = sst_y5_enabled
			}
			sst_y2_off_click = {
				clr_global_flag = sst_y2_enabled
			}
			sst_y2_on_click = {
				set_global_flag = sst_y2_enabled

				clr_global_flag = sst_y1_enabled
				clr_global_flag = sst_y3_enabled
				clr_global_flag = sst_y4_enabled
				clr_global_flag = sst_y5_enabled
			}
			sst_y3_off_click = {
				clr_global_flag = sst_y3_enabled
			}
			sst_y3_on_click = {
				set_global_flag = sst_y3_enabled

				clr_global_flag = sst_y1_enabled
				clr_global_flag = sst_y2_enabled
				clr_global_flag = sst_y4_enabled
				clr_global_flag = sst_y5_enabled
			}
			sst_y4_off_click = {
				clr_global_flag = sst_y4_enabled
			}
			sst_y4_on_click = {
				set_global_flag = sst_y4_enabled

				clr_global_flag = sst_y1_enabled
				clr_global_flag = sst_y2_enabled
				clr_global_flag = sst_y3_enabled
				clr_global_flag = sst_y5_enabled
			}
			sst_y5_off_click = {
				clr_global_flag = sst_y5_enabled
			}
			sst_y5_on_click = {
				set_global_flag = sst_y5_enabled
				
				clr_global_flag = sst_y1_enabled
				clr_global_flag = sst_y2_enabled
				clr_global_flag = sst_y3_enabled
				clr_global_flag = sst_y4_enabled
			}
### SPAWN BUTTONS ###
			sst_add_design_button_click = {
				sst_design_ship = yes		#SCRIPTED EFFECTS
			}
			sst_spawn_1_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 12 }
				sst_spawn_ship = yes		#SCRIPTED EFFECTS
			}
			sst_spawn_5_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 12 }
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
			}
			sst_spawn_20_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 12 }
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
			}
			sst_spawn_50_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 12 }
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
				sst_spawn_ship = yes
			}
			sst_spawn_convoys_10_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 13 }
				add_equipment_to_stockpile = {
					type = convoy
					amount = 10
				}
			}
			sst_spawn_convoys_50_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 13 }
				add_equipment_to_stockpile = {
					type = convoy
					amount = 50
				}
			}
			sst_spawn_convoys_200_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 13 }
				add_equipment_to_stockpile = {
					type = convoy
					amount = 200
				}
			}
			sst_spawn_convoys__10_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 13 }
				add_equipment_to_stockpile = {
					type = convoy
					amount = -10
				}
			}
			sst_spawn_convoys__50_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 13 }
				add_equipment_to_stockpile = {
					type = convoy
					amount = -50
				}
			}
			sst_spawn_convoys__200_click = {
				toolpack_cycle_action_log_variables = yes
				add_to_array = { global.toolpack_mp_action_array_targets = THIS }
				add_to_array = { global.toolpack_mp_action_array = 13 }
				add_equipment_to_stockpile = {
					type = convoy
					amount = -200
				}
			}
		}
		### SHIP TYPES ###
		triggers = {
			sst_delete_button_click_enabled = {
				has_navy_size = {
					size > 0
				}
				OR = {
					has_global_flag = sst_destroyer_enabled
					has_global_flag = sst_lc_enabled
					has_global_flag = sst_hc_enabled
					has_global_flag = sst_bc_enabled
					has_global_flag = sst_bs_enabled
					has_global_flag = sst_carrier_enabled
					has_global_flag = sst_sub_enabled
				}
			}
			sst_type_destroyer_on_visible = {
				NOT = {
					has_global_flag = sst_destroyer_enabled
				}
			}
			sst_type_destroyer_off_visible = {
				has_global_flag = sst_destroyer_enabled
			}
			sst_type_lc_on_visible = {
				NOT = {
					has_global_flag = sst_lc_enabled
				}
			}
			sst_type_lc_off_visible = {
				has_global_flag = sst_lc_enabled
			}
			sst_type_hc_on_visible = {
				NOT = {
					has_global_flag = sst_hc_enabled
				}
			}
			sst_type_hc_off_visible = {
				has_global_flag = sst_hc_enabled
			}
			sst_type_bc_on_visible = {
				NOT = {
					has_global_flag = sst_bc_enabled
				}
			}
			sst_type_bc_off_visible = {
				has_global_flag = sst_bc_enabled
			}
			sst_type_bs_on_visible = {
				NOT = {
					has_global_flag = sst_bs_enabled
				}
			}
			sst_type_bs_off_visible = {
				has_global_flag = sst_bs_enabled
			}
			sst_type_carrier_on_visible = {
				NOT = {
					has_global_flag = sst_carrier_enabled
				}
			}
			sst_type_carrier_off_visible = {
				has_global_flag = sst_carrier_enabled
			}
			sst_type_sub_on_visible = {
				NOT = {
					has_global_flag = sst_sub_enabled
				}
			}
			sst_type_sub_off_visible = {
				has_global_flag = sst_sub_enabled
			}
### DESIGN YEAR ###
			sst_y1_off_visible = {
				has_global_flag = sst_y1_enabled
			}
			sst_y1_on_visible = {
				NOT = {
					has_global_flag = sst_y1_enabled
				}
			}
			sst_y2_off_visible = {
				has_global_flag = sst_y2_enabled
			}
			sst_y2_on_visible = {
				NOT = {
					has_global_flag = sst_y2_enabled
				}
			}
			sst_y3_off_visible = {
				has_global_flag = sst_y3_enabled
			}
			sst_y3_on_visible = {
				NOT = {
					has_global_flag = sst_y3_enabled
				}
			}
			sst_y4_off_visible = {
				has_global_flag = sst_y4_enabled
			}
			sst_y4_on_visible = {
				NOT = {
					has_global_flag = sst_y4_enabled
				}
			}
			sst_y5_off_visible = {
				has_global_flag = sst_y5_enabled
			}
			sst_y5_on_visible = {
				NOT = {
					has_global_flag = sst_y5_enabled
				}
			}
### DESIGN BUTTONS ###
			sst_designer_text_visible = {
				has_dlc = "Man the Guns"
			}
			sst_add_design_button_visible = {
				has_dlc = "Man the Guns"
			}
			sst_add_design_text_text_visible = {
				has_dlc = "Man the Guns"
			}
### SPAWN BUTTONS ###
			sst_add_design_button_click_enabled = {
				OR = {
					has_global_flag = sst_y1_enabled
					has_global_flag = sst_y2_enabled
					has_global_flag = sst_y3_enabled
					has_global_flag = sst_y4_enabled
					has_global_flag = sst_y5_enabled
				}
				OR = {
					has_global_flag = sst_destroyer_enabled
					has_global_flag = sst_lc_enabled
					has_global_flag = sst_hc_enabled
					has_global_flag = sst_bc_enabled
					has_global_flag = sst_bs_enabled
					has_global_flag = sst_carrier_enabled
					has_global_flag = sst_sub_enabled
				}
			}
			sst_spawn_1_click_enabled = {
				OR = {
					has_global_flag = sst_y1_enabled
					has_global_flag = sst_y2_enabled
					has_global_flag = sst_y3_enabled
					has_global_flag = sst_y4_enabled
					has_global_flag = sst_y5_enabled
				}
				OR = {
					has_global_flag = sst_destroyer_enabled
					has_global_flag = sst_lc_enabled
					has_global_flag = sst_hc_enabled
					has_global_flag = sst_bc_enabled
					has_global_flag = sst_bs_enabled
					has_global_flag = sst_carrier_enabled
					has_global_flag = sst_sub_enabled
				}
			}
			sst_spawn_5_click_enabled = {
				OR = {
					has_global_flag = sst_y1_enabled
					has_global_flag = sst_y2_enabled
					has_global_flag = sst_y3_enabled
					has_global_flag = sst_y4_enabled
					has_global_flag = sst_y5_enabled
				}
				OR = {
					has_global_flag = sst_destroyer_enabled
					has_global_flag = sst_lc_enabled
					has_global_flag = sst_hc_enabled
					has_global_flag = sst_bc_enabled
					has_global_flag = sst_bs_enabled
					has_global_flag = sst_carrier_enabled
					has_global_flag = sst_sub_enabled
				}
			}
			sst_spawn_20_click_enabled = {
				OR = {
					has_global_flag = sst_y1_enabled
					has_global_flag = sst_y2_enabled
					has_global_flag = sst_y3_enabled
					has_global_flag = sst_y4_enabled
					has_global_flag = sst_y5_enabled
				}
				OR = {
					has_global_flag = sst_destroyer_enabled
					has_global_flag = sst_lc_enabled
					has_global_flag = sst_hc_enabled
					has_global_flag = sst_bc_enabled
					has_global_flag = sst_bs_enabled
					has_global_flag = sst_carrier_enabled
					has_global_flag = sst_sub_enabled
				}
			}
			sst_spawn_50_click_enabled = {
				OR = {
					has_global_flag = sst_y1_enabled
					has_global_flag = sst_y2_enabled
					has_global_flag = sst_y3_enabled
					has_global_flag = sst_y4_enabled
					has_global_flag = sst_y5_enabled
				}
				OR = {
					has_global_flag = sst_destroyer_enabled
					has_global_flag = sst_lc_enabled
					has_global_flag = sst_hc_enabled
					has_global_flag = sst_bc_enabled
					has_global_flag = sst_bs_enabled
					has_global_flag = sst_carrier_enabled
					has_global_flag = sst_sub_enabled
				}
			}
### CONVOYS ###
			sst_convoy_glow_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
			sst_convoy_bg_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
			sst_convoys_text_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
			sst_spawn_convoys_10_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
			sst_spawn_convoys_50_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
			sst_spawn_convoys_200_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
			sst_spawn_convoys__10_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
			sst_spawn_convoys__50_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
			sst_spawn_convoys__200_visible = {
				NOT = { has_global_flag = sst_convoys_disabled }
			}
		}
	}
}