scripted_gui = {
    patrick_death_gui = {
        window_name = "patrick_death_window"
        context_type = player_context

        visible = {
              has_country_flag = pat_dialogue
        }

        effects = {
            move_dialogue_pat_click = {
                add_to_variable = {
                    name = pages
                    value = 1
                }
                if = {
                    limit = {
                        check_variable = {
                            name = pages
                            value = 4
                        }
                    }
					sound_effect = pat_dies
                    set_country_flag = pat_death_animation
                }
                if = {
                    limit = {
                        check_variable = {
                            name = pages
                            value = 10
                        }
                    }
                    set_country_flag = ending_pat
                    clr_country_flag = pat_dialogue 
                }
            }
        }

        triggers = {
		
		
            pat_dialogue_visible = {
			NOT = {
                 has_country_flag = pat_death_animation

}           

}           
		
		
            greenblock_visible = {
                 has_country_flag = pat_death_animation
            }
            pat_dead_visible = {
                 has_country_flag = pat_death_animation
            }
            ending_text_1_pat_visible = {
                check_variable = {	
                    name = pages
                    value = 0
                }
            }
            ending_text_2_pat_visible = {
                check_variable = {
                    name = pages
                    value = 1
                }
            }
            ending_text_3_pat_visible = {
                check_variable = {
                    name = pages
                    value = 2
                }
            }
            ending_text_4_pat_visible = {
                check_variable = {
                    name = pages
                    value = 3
                }
            }
            ending_text_5_pat_visible = {
                check_variable = {
                    name = pages
                    value = 4
                }
            }
            ending_text_6_pat_visible = {
                check_variable = {
                    name = pages
                    value = 5
                }
            }
            ending_text_7_pat_visible = {
                check_variable = {
                    name = pages
                    value = 6
                }
            }
            ending_text_8_pat_visible = {
                check_variable = {
                    name = pages
                    value = 7
                }
            }
            ending_text_9_pat_visible = {
                check_variable = {
                    name = pages
                    value = 8
                }
            }
            ending_text_10_pat_visible = {
                check_variable = {
                    name = pages
                    value = 9
                }
            }
        }

        dynamic_lists = {
        }

        properties = {
        }

        ai_enabled = {
            always = no
        }

        ai_test_interval = 290
        ai_test_variance = 0.5

        ai_check = {
        }

        ai_check_scope = {
        }

        ai_weights = {
        }
    }
}
