from header_common import *
from header_presentations import *
from header_mission_templates import *
from ID_meshes import *
from header_operations import *
from header_triggers import *
from header_items import *
from module_constants import *
from header_parties import *
from header_terrain_types import *
import string

import header_triggers

load = ti_on_presentation_load
run = ti_on_presentation_run
event = ti_on_presentation_event_state_change
hover = ti_on_presentation_mouse_enter_leave
click = ti_on_presentation_mouse_press

# Shows coordinates on a presentation for easy development
# Set debug_show_presentation_coordinates on module_constants.py
coord_helper = [
  (load, [
      (eq, debug_show_presentation_coordinates, 1),
      (create_text_overlay, "$mouse_coordinates", "str_empty_string"),
      (overlay_set_color, "$mouse_coordinates", 0xFF0000),
      (position_set_x, pos1, 10),
      (position_set_y, pos1, 700),
      (overlay_set_position, "$mouse_coordinates", pos1),
  ]),
  (run, [
      (eq, debug_show_presentation_coordinates, 1),
      (set_fixed_point_multiplier, 1000),
      
      (mouse_get_position, pos1),
      (position_get_x, reg1, pos1),
      (position_get_y, reg2, pos1),
      (overlay_set_text, "$mouse_coordinates", "@{reg1}, {reg2}"),
  ])
]
prsnt_escape_close = [
  (run,
    [
      (try_begin),
        (this_or_next|key_clicked, key_escape),
        (key_clicked, key_pad_start),
        (presentation_set_duration, 0),
        (change_screen_return,0),
      (try_end),
  ]),
]

####################################################################################################################
#  Each presentation record contains the following fields:
#  1) Presentation id: used for referencing presentations in other files. The prefix prsnt_ is automatically added before each presentation id.
#  2) Presentation flags. See header_presentations.py for a list of available flags
#  3) Presentation background mesh: See module_meshes.py for a list of available background meshes
#  4) Triggers: Simple triggers that are associated with the presentation
####################################################################################################################

presentations = [
  ## mainmenu chief
  ("game_start",prsntf_read_only,0,[
      (ti_on_presentation_load,
        [
          (presentation_set_duration, 999999),
          (set_fixed_point_multiplier, 1000),
          
          (assign, ":vc_version", vc_version),
          (store_div, reg1, ":vc_version", 1000),
          (store_mod, reg2, ":vc_version", 1000),
          (try_begin),
            (eq, reg2, 0),
            (str_store_string, s1, "@{reg1}.0"),
          (else_try),
            (lt, reg2, 10),
            (str_store_string, s1, "@{reg1}.00{reg2}"),
          (else_try),
            (lt, reg2, 100),
            (try_begin),
              (store_mod, ":result", reg2, 10),
              (eq,  ":result", 0),
              (val_div, reg2, 10),
            (try_end),
            (str_store_string, s1, "@{reg1}.0{reg2}"),
          (else_try),
            (try_begin),
              (store_mod, ":result", reg2, 100),
              (eq,  ":result", 0),
              (val_div, reg2, 100),
            (else_try),
              (store_mod, ":result", reg2, 10),
              (eq,  ":result", 0),
              (val_div, reg2, 10),
            (try_end),
            (str_store_string, s1, "@{reg1}.{reg2}"),
          (try_end),
          
          (str_store_string, s2, "str_modifications"),
          (str_store_string, s1, "@{s1} {s2}"),
          (create_text_overlay, "$g_presentation_credits_obj_1", "@{s1}", tf_center_justify|tf_double_space|tf_vertical_align_center),
          (overlay_set_color, "$g_presentation_credits_obj_1", 0x000000),
          #(overlay_set_color, "$g_presentation_credits_obj_1", 0xFF0000),#We could make the version number red if it is edited and not clean any more
          
          #Show versions in the log
          (set_show_messages, 0),
          (display_message, s1),
          (set_show_messages, 1),
          
          #Stop all sounds (VC-3218)
          (stop_all_sounds, 1),
          
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 50),
          (overlay_set_position, "$g_presentation_credits_obj_1", pos1),
          
          #####OPEN BETA INFO
          ##		(create_mesh_overlay, reg0, "mesh_mp_score_b"),
          ##		(position_set_x, pos1, 100),
          ##		(position_set_y, pos1, 225),
          ##		(overlay_set_position, reg0, pos1),
          ##		(position_set_x, pos1, 600),
          ##		(position_set_y, pos1, 450),
          ##		(overlay_set_size, reg0, pos1),
          ##
          ##        (create_text_overlay, reg0, "str_welcome_to_beta", tf_double_space|tf_scrollable|tf_center_justify),
          ##                ##(overlay_set_color, reg0, 0xE12126), #Atomic Red muy leible
          ##		(overlay_set_color, reg0, 0xFFFFFF),
          ##		(position_set_x, pos1, 50),
          ##		(position_set_y, pos1, 230),
          ##		(overlay_set_position, reg0, pos1),
          ##		  (position_set_x, pos1, 1100),
          ##		  (position_set_y, pos1, 1100),
          ##		  (overlay_set_size, reg0, pos1),
          ##                (position_set_x, pos1, 480),
          ##                (position_set_y, pos1, 220),
          ##               (overlay_set_area_size, reg0, pos1),
          ##
          ##
          ##		(try_begin),
          ##		  (neq, "$savegame_id", 0),
          ##		  (neg|str_is_empty, s30),
          ##		  (set_show_messages, 1),
          ##		  (display_message, "str_log_created"),
          ##		  (set_show_messages, 0),
          ##		  (assign, reg1, "$savegame_id"),
          ##		  (assign, reg2, warband_version),
          ##		  (assign, reg3, vc_version),
          ##		  (assign, reg4, "$game_started_with_content_update"),
          ##		  (assign, reg5, "$campaign_type"),
          ##		  (assign, reg6, "$recruitment_on"),
          ##		  (assign, reg7, "$easy_levelling"),
          ##		  (assign, reg8, "$easy_wage"),
          ##		  (display_message, "str_debug_log_print1"),
          ##		  (display_message, "str_debug_log_print2"),
          ##		  (set_show_messages, 1),
          ##		(try_end),
          
          
      ]),
  ]),
  ## main menu chief
  ("game_credits",prsntf_read_only,mesh_load_window,[
      (ti_on_presentation_load,
        [(assign, "$g_presentation_credits_obj_1", -1),
          (assign, "$g_presentation_credits_obj_2", -1),
          (assign, "$g_presentation_credits_obj_3", -1),
          (assign, "$g_presentation_credits_obj_4", -1),
          (assign, "$g_presentation_credits_obj_5", -1),
          (assign, "$g_presentation_credits_obj_6", -1),
          (assign, "$g_presentation_credits_obj_7", -1),
          (assign, "$g_presentation_credits_obj_8", -1),
          (assign, "$g_presentation_credits_obj_9", -1),
          (assign, "$g_presentation_credits_obj_10", -1),
          (assign, "$g_presentation_credits_obj_11", -1),
          (assign, "$g_presentation_credits_obj_12", -1),
          (assign, "$g_presentation_credits_obj_1_alpha", 0),
          (assign, "$g_presentation_credits_obj_2_alpha", 0),
          (assign, "$g_presentation_credits_obj_3_alpha", 0),
          (assign, "$g_presentation_credits_obj_4_alpha", 0),
          (assign, "$g_presentation_credits_obj_5_alpha", 0),
          (assign, "$g_presentation_credits_obj_6_alpha", 0),
          (assign, "$g_presentation_credits_obj_7_alpha", 0),
          (assign, "$g_presentation_credits_obj_8_alpha", 0),
          (assign, "$g_presentation_credits_obj_9_alpha", 0),
          (assign, "$g_presentation_credits_obj_10_alpha", 0),
          (assign, "$g_presentation_credits_obj_11_alpha", 0),
      ]),
      (ti_on_presentation_run,
        [
          (store_trigger_param_1, ":cur_time"),
          (set_fixed_point_multiplier, 1000),
          (presentation_set_duration, 1000000),
          (try_begin),
            (this_or_next|key_clicked, key_space),
            (this_or_next|key_clicked, key_enter),
            (this_or_next|key_clicked, key_escape),
            (this_or_next|key_clicked, key_back_space),
            (this_or_next|key_clicked, key_left_mouse_button),
            (this_or_next|key_clicked, key_right_mouse_button),
            (this_or_next|key_clicked, key_pad_start),
            (this_or_next|key_clicked, key_pad_ltrigger),
            (key_clicked, key_pad_rtrigger),
            (try_begin),
              (eq, "$campaign_type", camp_storyline),
              (presentation_set_duration, 0),
              (jump_to_menu, "mnu_sandboxmode_ok"),
            (else_try),
              (presentation_set_duration, 0),
            (try_end),
          (try_end),
          (try_begin),
            (lt, "$g_presentation_credits_obj_1", 0),
            (str_store_string, s1, "str_credits_1"),
            (create_text_overlay, "$g_presentation_credits_obj_1", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_1", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_1", 0),
            (position_set_x, pos1, 1500),
            (position_set_y, pos1, 1500),
            (overlay_set_size, "$g_presentation_credits_obj_1", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_1", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_1", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 2000),
            (eq, "$g_presentation_credits_obj_1_alpha", 0),
            (assign, "$g_presentation_credits_obj_1_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_1", 1000, 0x00),
          (else_try),
            (gt, ":cur_time", 3500),
            (lt, "$g_presentation_credits_obj_2", 0),
            (str_store_string, s1, "str_credits_2"),
            (create_text_overlay, "$g_presentation_credits_obj_2", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_2", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_2", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_2", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_2", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_2", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 5500),
            (eq, "$g_presentation_credits_obj_2_alpha", 0),
            (assign, "$g_presentation_credits_obj_2_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_2", 1000, 0x00),
          (else_try),
            (gt, ":cur_time", 7000),
            (lt, "$g_presentation_credits_obj_3", 0),
            (str_store_string, s1, "str_credits_3"),
            (create_text_overlay, "$g_presentation_credits_obj_3", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_3", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_3", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_3", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_3", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_3", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 11000),
            (eq, "$g_presentation_credits_obj_3_alpha", 0),
            (assign, "$g_presentation_credits_obj_3_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_3", 1000, 0),
          (else_try),
            (gt, ":cur_time", 12500),
            (lt, "$g_presentation_credits_obj_4", 0),
            (str_store_string, s1, "str_credits_4"),
            (create_text_overlay, "$g_presentation_credits_obj_4", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_4", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_4", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_4", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_4", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_4", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 15500),
            (eq, "$g_presentation_credits_obj_4_alpha", 0),
            (assign, "$g_presentation_credits_obj_4_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_4", 1000, 0),
          (else_try),
            (gt, ":cur_time", 17000),
            (lt, "$g_presentation_credits_obj_5", 0),
            (str_store_string, s1, "str_credits_5"),
            (create_text_overlay, "$g_presentation_credits_obj_5", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_5", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_5", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_5", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_5", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_5", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 20000),
            (eq, "$g_presentation_credits_obj_5_alpha", 0),
            (assign, "$g_presentation_credits_obj_5_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_5", 1000, 0),
          (else_try),
            (gt, ":cur_time", 21500),
            (lt, "$g_presentation_credits_obj_6", 0),
            (str_store_string, s1, "str_credits_6"),
            (create_text_overlay, "$g_presentation_credits_obj_6", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_6", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_6", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_6", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_6", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_6", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 23500),
            (eq, "$g_presentation_credits_obj_6_alpha", 0),
            (assign, "$g_presentation_credits_obj_6_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_6", 1000, 0),
          (else_try),
            (gt, ":cur_time", 25000),
            (lt, "$g_presentation_credits_obj_7", 0),
            (str_store_string, s1, "str_credits_7"),
            (create_text_overlay, "$g_presentation_credits_obj_7", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_7", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_7", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_7", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_7", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_7", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 28000),
            (eq, "$g_presentation_credits_obj_7_alpha", 0),
            (assign, "$g_presentation_credits_obj_7_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_7", 1000, 0),
          (else_try),
            (gt, ":cur_time", 29500),
            (lt, "$g_presentation_credits_obj_8", 0),
            (str_store_string, s1, "str_credits_8"),
            (create_text_overlay, "$g_presentation_credits_obj_8", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_8", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_8", 0),
            (position_set_x, pos1, 1200),
            (position_set_y, pos1, 1200),
            (overlay_set_size, "$g_presentation_credits_obj_8", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_8", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_8", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 34500),
            (eq, "$g_presentation_credits_obj_8_alpha", 0),
            (assign, "$g_presentation_credits_obj_8_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_8", 1000, 0),
          (else_try),
            (gt, ":cur_time", 36000),
            (lt, "$g_presentation_credits_obj_9", 0),
            (str_store_string, s1, "str_credits_10"),
            (create_text_overlay, "$g_presentation_credits_obj_9", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_9", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_9", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_9", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_9", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_9", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 39000),
            (eq, "$g_presentation_credits_obj_9_alpha", 0),
            (assign, "$g_presentation_credits_obj_9_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_9", 1000, 0),
          (else_try),
            (gt, ":cur_time", 40500),
            (lt, "$g_presentation_credits_obj_10", 0),
            (str_store_string, s1, "str_credits_11"),
            (create_text_overlay, "$g_presentation_credits_obj_10", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_10", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_10", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_10", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_10", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_10", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 43500),
            (eq, "$g_presentation_credits_obj_10_alpha", 0),
            (assign, "$g_presentation_credits_obj_10_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_10", 1000, 0),
          (else_try),
            (gt, ":cur_time", 45000),
            (lt, "$g_presentation_credits_obj_11", 0),
            (str_store_string, s1, "str_credits_12"),
            (create_text_overlay, "$g_presentation_credits_obj_11", s1, tf_center_justify|tf_double_space|tf_vertical_align_center),
            (overlay_set_color, "$g_presentation_credits_obj_11", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_11", 0),
            (position_set_x, pos1, 1750),
            (position_set_y, pos1, 1750),
            (overlay_set_size, "$g_presentation_credits_obj_11", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 375),
            (overlay_set_position, "$g_presentation_credits_obj_11", pos1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_11", 1000, 0xFF),
          (else_try),
            (gt, ":cur_time", 49000),
            (eq, "$g_presentation_credits_obj_11_alpha", 0),
            (assign, "$g_presentation_credits_obj_11_alpha", 1),
            (overlay_animate_to_alpha, "$g_presentation_credits_obj_11", 1000, 0),
          (else_try),
            (gt, ":cur_time", 50500),
            (lt, "$g_presentation_credits_obj_12", 0),
            (str_store_string, s1, "str_credits_9"),
            (create_text_overlay, "$g_presentation_credits_obj_12", s1, tf_center_justify|tf_double_space),
            (overlay_set_color, "$g_presentation_credits_obj_12", 0),
            (overlay_set_alpha, "$g_presentation_credits_obj_12", 0xFF),
            (position_set_x, pos1, 1000),
            (position_set_y, pos1, 1000),
            (overlay_set_size, "$g_presentation_credits_obj_12", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, -1400),
            (overlay_set_position, "$g_presentation_credits_obj_12", pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 760),
            (overlay_animate_to_position, "$g_presentation_credits_obj_12", 20000, pos1),
          (else_try),
            (gt, ":cur_time", 70500),
            (try_begin),
              (eq, "$campaign_type", camp_storyline),
              (presentation_set_duration, 0),
              (jump_to_menu, "mnu_sandboxmode_ok"),
            (else_try),
              # (gt, ":cur_time", 70500),
              (presentation_set_duration, 0),
            (try_end),
          (try_end),
      ]),
  ]),
  
  ("game_profile_banner_selection", 0, mesh_load_window, [
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          (str_store_string, s1, "str_profile_banner_selection_text"),
          (create_text_overlay, reg1, s1, tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 600),
          (overlay_set_position, reg1, pos1),
          (overlay_set_text, reg1, s1),
          (create_button_overlay, "$g_presentation_obj_profile_banner_selection_1", "@Next Page", tf_center_justify),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 50),
          (overlay_set_position, "$g_presentation_obj_profile_banner_selection_1", pos1),
          
          (create_button_overlay, "$g_presentation_obj_profile_banner_selection_2", "str_use_default_banner", tf_center_justify),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 50),
          (overlay_set_position, "$g_presentation_obj_profile_banner_selection_2", pos1),
          
          (assign, ":x_pos", 150),
          (assign, ":y_pos", 575),
          (store_mul, ":starting_banner", 16, "$g_presentation_page_no"),
          (store_add, ":ending_banner", ":starting_banner", 16),
          (store_add, "$g_presentation_banner_start", "$g_presentation_obj_profile_banner_selection_2", 1),
          (assign, ":num_valid_banners", 0),
          (try_for_range, ":cur_banner_mesh", banner_meshes_begin, banner_meshes_end),
            (assign, ":end_loop", active_npcs_end),
            (try_for_range, ":kingdom_hero", active_npcs_begin, ":end_loop"),
              (store_sub, ":spr_index", ":cur_banner_mesh", banner_meshes_begin),
              (val_add, ":spr_index", banner_scene_props_begin),
              (troop_slot_eq, ":kingdom_hero", slot_troop_banner_scene_prop, ":spr_index"),
              (assign, ":end_loop", ":kingdom_hero"),
            (try_end),
            
            (eq, ":end_loop", active_npcs_end),
            (val_add, ":num_valid_banners", 1),
            (gt, ":num_valid_banners", ":starting_banner"),
            (le, ":num_valid_banners", ":ending_banner"),
            (create_image_button_overlay, reg1, ":cur_banner_mesh", ":cur_banner_mesh"),
            (position_set_x, pos1, ":x_pos"),
            (position_set_y, pos1, ":y_pos"),
            (overlay_set_position, reg1, pos1),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, 100),
            (overlay_set_size, reg1, pos1),
            (val_add, ":x_pos", 100),
            (ge, ":x_pos", 900),
            (assign, ":x_pos", 150),
            (val_sub, ":y_pos", 250),
          (try_end),
          (presentation_set_duration, 999999),
      ]),
      
      (ti_on_presentation_event_state_change, [
          (store_trigger_param_1, ":object"),
          (try_begin),
            (eq, ":object", "$g_presentation_obj_profile_banner_selection_1"),
            (val_add, "$g_presentation_page_no", 1),
            (store_sub, ":max_pages", banner_meshes_end, banner_meshes_begin),
            (val_div, ":max_pages", 16),
            (val_add, ":max_pages", 1),
            (val_mod, "$g_presentation_page_no", ":max_pages"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_profile_banner_selection"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_profile_banner_selection_2"),
            (profile_set_banner_id, -1),
            (presentation_set_duration, 0),
          (else_try),
            (store_sub, ":selected_banner", ":object", "$g_presentation_banner_start"),
            (store_mul, ":page_adder", 16, "$g_presentation_page_no"),
            (val_add, ":selected_banner", ":page_adder"),
            (assign, ":num_valid_banners", 0),
            (assign, ":end_cond", banner_meshes_end),
            (try_for_range, ":cur_banner_mesh", banner_meshes_begin, ":end_cond"),
              (assign, ":end_loop", active_npcs_end),
              (try_for_range, ":kingdom_hero", active_npcs_begin, ":end_loop"),
                (store_sub, ":spr_index", ":cur_banner_mesh", banner_meshes_begin),
                (val_add, ":spr_index", banner_scene_props_begin),
                (troop_slot_eq, ":kingdom_hero", slot_troop_banner_scene_prop, ":spr_index"),
                (assign, ":end_loop", ":kingdom_hero"),
              (try_end),
              
              (eq, ":end_loop", active_npcs_end),
              
              (try_begin),
                (eq, ":selected_banner", ":num_valid_banners"),
                (store_sub, ":selected_banner_index", ":cur_banner_mesh", banner_meshes_begin),
                (profile_set_banner_id, ":selected_banner_index"),
                (assign, ":end_cond", 0), #break
              (try_end),
              (val_add, ":num_valid_banners", 1),
            (try_end),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("game_custom_battle_designer", prsntf_manual_end_only, mesh_cb_ui_main, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_text_overlay, reg0, "str_player", tf_center_justify|tf_single_line|tf_with_outline),
          (overlay_set_color, reg0, 0xFFFFFFFF),
          (position_set_x, pos1, 1500),
          (position_set_y, pos1, 1500),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, 700),
          (overlay_set_position, reg0, pos1),
          
          (create_text_overlay, reg0, "str_enemy",  tf_center_justify|tf_single_line|tf_with_outline),
          (overlay_set_color, reg0, 0xFFFFFFFF),
          (position_set_x, pos1, 1500),
          (position_set_y, pos1, 1500),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, 700),
          (overlay_set_position, reg0, pos1),
          
          (create_text_overlay, reg0, "str_character", tf_center_justify),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, 670),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_18"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_18", pos1),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, 635),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_18", pos1),
          (try_for_range, ":cur_troop", quick_battle_troops_begin, quick_battle_troops_end),
            (str_store_troop_name, s0, ":cur_troop"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_18", s0),
          (try_end),
          (store_sub, ":cur_troop", "$g_quick_battle_troop", quick_battle_troops_begin),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_18", ":cur_troop"),
          
          (try_begin),
            (eq, "$g_quick_battle_troop", "trp_quick_battle_troops_cam"),  #camera
            (create_mesh_overlay, reg0, "mesh_cb_ui_maps_lense"),
          (else_try),
            (store_mul, ":cur_troop", "$g_quick_battle_troop", 2), #troop with weapons
            (create_mesh_overlay_with_tableau_material, reg0, -1, "tableau_game_party_window", ":cur_troop"),
          (try_end),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, 370),
          (overlay_set_position, reg0, pos1),
          
          (try_begin),
            (eq, "$g_quick_battle_team_2_faction", "fac_culture_welsh"),
            (assign, ":cur_troop", "trp_briton_level2_companion"),
          (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_culture_saxon"),
            (assign, ":cur_troop", "trp_saxon_level3_landed"),
          (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_culture_scotch"),
            (assign, ":cur_troop", "trp_scotch_knight"),
          (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_culture_angle"),
            (assign, ":cur_troop", "trp_angle_level3_landed"),
          (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_culture_irish"),
            (assign, ":cur_troop", "trp_irish_level3_landed"),
          (else_try),
            (eq, "$g_quick_battle_team_2_faction", "fac_culture_norse"),
            (assign, ":cur_troop", "trp_norse_level3_landed"),
          (else_try),
            (assign, ":cur_troop", "trp_taiga_bandit"),
          (try_end),
          (val_mul, ":cur_troop", 2), #with weapons
          (create_mesh_overlay_with_tableau_material, reg0, -1, "tableau_game_party_window", ":cur_troop"),
          (position_set_x, pos1, 670),
          (position_set_y, pos1, 370),
          (overlay_set_position, reg0, pos1),
          
          (create_text_overlay, reg0, "str_biography", tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 700),
          (overlay_set_position, reg0, pos1),
          
          (store_sub, ":cur_troop_text", "$g_quick_battle_troop", quick_battle_troops_begin),
          (val_add, ":cur_troop_text", quick_battle_troop_texts_begin),
          (create_text_overlay, reg0, ":cur_troop_text", tf_scrollable),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 850),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 320),
          (position_set_y, pos1, 560),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 360),
          (position_set_y, pos1, 130),
          (overlay_set_area_size, reg0, pos1),
          
          (create_text_overlay, reg0, "str_map_basic", tf_center_justify),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 1500),
          (position_set_y, pos1, 1500),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 450),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_1"),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 700),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_1", pos1),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 415),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_1", pos1),
          (try_begin),
            (eq, "$g_quick_battle_game_type", 0), #battle
            (try_for_range, ":cur_scene", quick_battle_battle_scenes_begin, quick_battle_battle_scenes_end),
              (store_sub, ":cur_scene_name", ":cur_scene", quick_battle_scenes_begin),
              (val_add, ":cur_scene_name", quick_battle_scene_names_begin),
              (overlay_add_item, "$g_presentation_obj_custom_battle_designer_1", ":cur_scene_name"),
            (try_end),
            (try_begin),
              (is_between, "$g_quick_battle_map", quick_battle_battle_scenes_begin, quick_battle_battle_scenes_end),
              (store_sub, ":cur_map", "$g_quick_battle_map", quick_battle_battle_scenes_begin),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", ":cur_map"),
            (else_try),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", 0),
              (assign, "$g_quick_battle_map", quick_battle_battle_scenes_begin),
            (try_end),
          (else_try),
            (eq, "$g_quick_battle_game_type", 3), #naval battle
            (try_for_range, ":cur_scene", quick_battle_naval_battle_scenes_begin, quick_battle_naval_battle_scenes_end),
              (store_sub, ":cur_scene_name", ":cur_scene", quick_battle_scenes_begin),
              (val_add, ":cur_scene_name", quick_battle_scene_names_begin),
              (overlay_add_item, "$g_presentation_obj_custom_battle_designer_1", ":cur_scene_name"),
            (try_end),
            (try_begin),
              (is_between, "$g_quick_battle_map", quick_battle_naval_battle_scenes_begin, quick_battle_naval_battle_scenes_end),
              (store_sub, ":cur_map", "$g_quick_battle_map", quick_battle_naval_battle_scenes_begin),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", ":cur_map"),
            (else_try),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", 0),
              (assign, "$g_quick_battle_map", quick_battle_naval_battle_scenes_begin),
            (try_end),
          (else_try),
            (this_or_next|eq, "$g_quick_battle_game_type", 4), #coastal assault offense
            (eq, "$g_quick_battle_game_type", 5), #coastal assault defense
            (try_for_range, ":cur_scene", quick_battle_coastal_battle_scenes_begin, quick_battle_coastal_battle_scenes_end),
              (store_sub, ":cur_scene_name", ":cur_scene", quick_battle_scenes_begin),
              (val_add, ":cur_scene_name", quick_battle_scene_names_begin),
              (overlay_add_item, "$g_presentation_obj_custom_battle_designer_1", ":cur_scene_name"),
            (try_end),
            (try_begin),
              (is_between, "$g_quick_battle_map", quick_battle_coastal_battle_scenes_begin, quick_battle_coastal_battle_scenes_end),
              (store_sub, ":cur_map", "$g_quick_battle_map", quick_battle_coastal_battle_scenes_begin),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", ":cur_map"),
            (else_try),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", 0),
              (assign, "$g_quick_battle_map", quick_battle_coastal_battle_scenes_begin),
            (try_end),
          (else_try),
            (try_for_range, ":cur_scene", quick_battle_siege_scenes_begin, quick_battle_siege_scenes_end),
              (store_sub, ":cur_scene_name", ":cur_scene", quick_battle_scenes_begin),
              (val_add, ":cur_scene_name", quick_battle_scene_names_begin),
              (overlay_add_item, "$g_presentation_obj_custom_battle_designer_1", ":cur_scene_name"),
            (try_end),
            (try_begin),
              (is_between, "$g_quick_battle_map", quick_battle_siege_scenes_begin, quick_battle_siege_scenes_end),
              (store_sub, ":cur_map", "$g_quick_battle_map", quick_battle_siege_scenes_begin),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", ":cur_map"),
            (else_try),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_1", 0),
              (assign, "$g_quick_battle_map", quick_battle_siege_scenes_begin),
            (try_end),
          (try_end),
          
          (store_sub, ":cur_mesh", "$g_quick_battle_map", quick_battle_scenes_begin),
          (val_add, ":cur_mesh", quick_battle_scene_images_begin),
          (create_mesh_overlay, reg0, ":cur_mesh"),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 700),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 380),
          (position_set_y, pos1, 220),
          (overlay_set_position, reg0, pos1),
          
          (create_text_overlay, reg0, "str_game_type_basic", tf_center_justify),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 1500),
          (position_set_y, pos1, 1500),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 190),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_23"),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 700),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_23", pos1),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 160),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_23", pos1),
          (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "str_battle"),
          (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "str_siege_offense"),
          (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "str_siege_defense"),
          (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "@Naval Battle"),		#phaiak
          (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "@Coastal Assault (Offense)"),		#phaiak
          (overlay_add_item, "$g_presentation_obj_custom_battle_designer_23", "@Coastal Assault (Defense)"),		#phaiak
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_23", "$g_quick_battle_game_type"),
          
          (create_game_button_overlay, "$g_presentation_obj_custom_battle_designer_24", "str_randomize"),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 110),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_24", pos1),
          
          (assign, ":cur_y", 330),
          (assign, ":cur_y", 350),
          (assign, ":cur_y_adder", 40),
          
          (create_text_overlay, reg0, "str_faction", tf_center_justify),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_text_overlay, reg0, "str_faction", tf_center_justify),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_4"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_4", pos1),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_4", pos1),
          (try_begin),
            (is_trial_version),
            (str_store_faction_name, s0, cb_factions_begin),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_4", s0),
            (store_add, ":cur_faction", cb_factions_begin, 1),
            (str_store_faction_name, s0, ":cur_faction"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_4", s0),
          (else_try),
            (try_for_range, ":cur_faction", cb_factions_begin, cb_factions_end),
              (str_store_faction_name, s0, ":cur_faction"),
              (overlay_add_item, "$g_presentation_obj_custom_battle_designer_4", s0),
            (try_end),
            (str_store_faction_name, s0, "fac_outlaws"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_4", s0),
          (try_end),
          (try_begin),
            (eq, "$g_quick_battle_team_1_faction", "fac_outlaws"),
            (store_sub, ":overlay_value", cb_factions_end, cb_factions_begin),
            (overlay_set_val, "$g_presentation_obj_custom_battle_designer_4", ":overlay_value"),
          (else_try),
            (store_sub, ":team_1_faction", "$g_quick_battle_team_1_faction", cb_factions_begin),
            (overlay_set_val, "$g_presentation_obj_custom_battle_designer_4", ":team_1_faction"),
          (try_end),
          
          (create_combo_label_overlay, "$g_presentation_obj_custom_battle_designer_5"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_5", pos1),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_5", pos1),
          (try_begin),
            (is_trial_version),
            (str_store_faction_name, s0, cb_factions_begin),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_5", s0),
            (store_add, ":cur_faction", cb_factions_begin, 1),
            (str_store_faction_name, s0, ":cur_faction"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_5", s0),
          (else_try),
            (try_for_range, ":cur_faction", cb_factions_begin, cb_factions_end),
              (str_store_faction_name, s0, ":cur_faction"),
              (overlay_add_item, "$g_presentation_obj_custom_battle_designer_5", s0),
            (try_end),
            (str_store_faction_name, s0, "fac_outlaws"),
            (overlay_add_item, "$g_presentation_obj_custom_battle_designer_5", s0),
          (try_end),
          (try_begin),
            (eq, "$g_quick_battle_team_2_faction", "fac_outlaws"),
            (store_sub, ":overlay_value", cb_factions_end, cb_factions_begin),
            (overlay_set_val, "$g_presentation_obj_custom_battle_designer_5", ":overlay_value"),
          (else_try),
            (store_sub, ":team_2_faction", "$g_quick_battle_team_2_faction", cb_factions_begin),
            (overlay_set_val, "$g_presentation_obj_custom_battle_designer_5", ":team_2_faction"),
          (try_end),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_army_composition", tf_center_justify),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_text_overlay, reg0, "str_army_composition", tf_center_justify),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (try_begin),
            (eq, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
            (eq, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 34),
            (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 33),
            (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 33),
            (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 34),
            (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 33),
            (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 33),
            (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
            (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
          (try_end),
          
          (create_mesh_overlay, reg0, "mesh_cb_ui_icon_infantry"),
          (position_set_x, pos1, 5),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 400),
          (overlay_set_size, reg0, pos1),
          
          (create_mesh_overlay, reg0, "mesh_cb_ui_icon_infantry"),
          (position_set_x, pos1, 650),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 400),
          (overlay_set_size, reg0, pos1),
          
          (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_6", 0, 100),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_6", pos1),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_6", pos1),
          
          (assign, reg0, "$g_presentation_obj_custom_battle_designer_6_last_value"),
          (create_text_overlay, "$g_presentation_obj_custom_battle_designer_12", "str_reg0_percent", 0),
          (position_set_x, pos1, 295),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_12", pos1),
          
          (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_9", 0, 100),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_9", pos1),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_9", pos1),
          
          (assign, reg0, "$g_presentation_obj_custom_battle_designer_9_last_value"),
          (create_text_overlay, "$g_presentation_obj_custom_battle_designer_15", "str_reg0_percent", 0),
          (position_set_x, pos1, 940),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_15", pos1),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_mesh_overlay, reg0, "mesh_cb_ui_icon_archer"),
          (position_set_x, pos1, 15),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 400),
          (overlay_set_size, reg0, pos1),
          
          (create_mesh_overlay, reg0, "mesh_cb_ui_icon_archer"),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 400),
          (overlay_set_size, reg0, pos1),
          
          (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_7", 0, 100),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_7", pos1),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_7", pos1),
          
          (assign, reg0, "$g_presentation_obj_custom_battle_designer_7_last_value"),
          (create_text_overlay, "$g_presentation_obj_custom_battle_designer_13", "str_reg0_percent", 0),
          (position_set_x, pos1, 295),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_13", pos1),
          
          (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_10", 0, 100),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_10", pos1),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_10", pos1),
          
          (assign, reg0, "$g_presentation_obj_custom_battle_designer_10_last_value"),
          (create_text_overlay, "$g_presentation_obj_custom_battle_designer_16", "str_reg0_percent", 0),
          (position_set_x, pos1, 940),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_16", pos1),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_mesh_overlay, reg0, "mesh_cb_ui_icon_horseman"),
          (position_set_x, pos1, 10),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 400),
          (overlay_set_size, reg0, pos1),
          
          (create_mesh_overlay, reg0, "mesh_cb_ui_icon_horseman"),
          (position_set_x, pos1, 655),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 400),
          (overlay_set_size, reg0, pos1),
          
          (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_8", 0, 100),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_8", pos1),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_8", pos1),
          
          (assign, reg0, "$g_presentation_obj_custom_battle_designer_8_last_value"),
          (create_text_overlay, "$g_presentation_obj_custom_battle_designer_14", "str_reg0_percent", 0),
          (position_set_x, pos1, 295),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_14", pos1),
          
          (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_11", 0, 100),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_11", pos1),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_11", pos1),
          
          (assign, reg0, "$g_presentation_obj_custom_battle_designer_11_last_value"),
          (create_text_overlay, "$g_presentation_obj_custom_battle_designer_17", "str_reg0_percent", 0),
          (position_set_x, pos1, 940),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_17", pos1),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_army_size", tf_center_justify),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_text_overlay, reg0, "str_army_size", tf_center_justify),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (try_begin),
            (is_trial_version),
            (val_min, "$g_quick_battle_army_1_size", 25),
            (val_min, "$g_quick_battle_army_2_size", 25),
          (try_end),
          
          (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_2", 0, 74),
          # (overlay_set_boundaries, "$g_presentation_obj_custom_battle_designer_2", 1000, 75000),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_2", "$g_quick_battle_army_1_size"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_2", pos1),
          (position_set_x, pos1, 135),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_2", pos1),
          
          (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_1_size"),
          (create_text_overlay, "$g_presentation_obj_custom_battle_designer_21", "str_reg0_men", 0),
          (position_set_x, pos1, 255),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_21", pos1),
          
          (create_slider_overlay, "$g_presentation_obj_custom_battle_designer_3", 0, 74),
          # (overlay_set_boundaries, "$g_presentation_obj_custom_battle_designer_3", 1000, 75000),
          (overlay_set_val, "$g_presentation_obj_custom_battle_designer_3", "$g_quick_battle_army_2_size"),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_custom_battle_designer_3", pos1),
          (position_set_x, pos1, 780),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_3", pos1),
          
          (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_2_size"),
          (create_text_overlay, "$g_presentation_obj_custom_battle_designer_22", "str_reg0_men", 0),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_22", pos1),
          
          (create_game_button_overlay, "$g_presentation_obj_custom_battle_designer_19", "str_start", 0),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 60),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_19", pos1),
          
          (create_game_button_overlay, "$g_presentation_obj_custom_battle_designer_20", "str_back", 0),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 10),
          (overlay_set_position, "$g_presentation_obj_custom_battle_designer_20", pos1),
          
          (presentation_set_duration, 999999),
      ]),
      
      (ti_on_presentation_event_state_change,
        [
          (store_trigger_param_1, ":object"),
          (store_trigger_param_2, ":value"),
          (try_begin),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_1"),
            (try_begin),
              (eq, "$g_quick_battle_game_type", 0),
              (store_add, "$g_quick_battle_map", ":value", quick_battle_battle_scenes_begin),
            (else_try),
              (eq, "$g_quick_battle_game_type", 3),
              (store_add, "$g_quick_battle_map", ":value", quick_battle_naval_battle_scenes_begin),
            (else_try),
              (this_or_next|eq, "$g_quick_battle_game_type", 4),
              (eq, "$g_quick_battle_game_type", 5),
              (store_add, "$g_quick_battle_map", ":value", quick_battle_coastal_battle_scenes_begin),
            (else_try),
              (store_add, "$g_quick_battle_map", ":value", quick_battle_siege_scenes_begin),
            (try_end),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_23"),
            (assign, "$g_quick_battle_game_type", ":value"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_24"),
            #(store_random_in_range, "$g_quick_battle_game_type", 0, 3),
            (store_random_in_range, "$g_quick_battle_game_type", 0, 6),	#phaiak
            (store_random_in_range, "$g_quick_battle_troop", quick_battle_troops_begin, quick_battle_troops_end),
            (try_begin),
              (is_trial_version),
              (store_random_in_range, "$g_quick_battle_team_1_faction", 0, 2),
              (try_begin),
                (eq, "$g_quick_battle_team_1_faction", 0),
                (assign, "$g_quick_battle_team_2_faction", 1),
              (else_try),
                (assign, "$g_quick_battle_team_2_faction", 0),
              (try_end),
              (val_add, "$g_quick_battle_team_1_faction", cb_factions_begin),
              (val_add, "$g_quick_battle_team_2_faction", cb_factions_begin),
              (store_random_in_range, "$g_quick_battle_army_1_size", 10, 16),
              (store_random_in_range, ":random_army_size", 0, 6),
              (val_add, "$g_quick_battle_army_1_size", ":random_army_size"),
              (store_random_in_range, ":random_army_size", 0, 6),
              (val_add, "$g_quick_battle_army_1_size", ":random_army_size"),
            (else_try),
              (store_sub, ":num_factions", cb_factions_end, cb_factions_begin),
              (val_add, ":num_factions", 1),
              (store_random_in_range, "$g_quick_battle_team_1_faction", 0, ":num_factions"),
              (try_begin),
                (eq, "$g_quick_battle_team_1_faction", 0),
                (assign, "$g_quick_battle_team_1_faction", "fac_outlaws"),
              (else_try),
                (val_add, "$g_quick_battle_team_1_faction", cb_factions_begin),
                (val_sub, "$g_quick_battle_team_1_faction", 1),
              (try_end),
              (assign, ":end_cond", 1000),
              (try_for_range, ":unused", 0, ":end_cond"),
                (store_random_in_range, "$g_quick_battle_team_2_faction", 0, ":num_factions"),
                (try_begin),
                  (eq, "$g_quick_battle_team_2_faction", 0),
                  (assign, "$g_quick_battle_team_2_faction", "fac_outlaws"),
                (else_try),
                  (val_add, "$g_quick_battle_team_2_faction", cb_factions_begin),
                  (val_sub, "$g_quick_battle_team_2_faction", 1),
                (try_end),
                (neq, "$g_quick_battle_team_1_faction", "$g_quick_battle_team_2_faction"),
                (assign, ":end_cond", 0),
              (try_end),
              (store_random_in_range, "$g_quick_battle_army_1_size", 10, 21),
              (store_random_in_range, ":random_army_size", 0, 11),
              (val_add, "$g_quick_battle_army_1_size", ":random_army_size"),
              (store_random_in_range, ":random_army_size", 0, 11),
              (val_add, "$g_quick_battle_army_1_size", ":random_army_size"),
            (try_end),
            (assign, "$g_quick_battle_army_2_size", "$g_quick_battle_army_1_size"),
            (try_begin),
              (eq, "$g_quick_battle_game_type", 0), #battle
              (store_random_in_range, "$g_quick_battle_map", quick_battle_battle_scenes_begin, quick_battle_battle_scenes_end),
              (store_random_in_range, ":random_type", 0, 3),
              (store_random_in_range, ":random_type_2", 0, 2),
              (store_random_in_range, ":random_composition", 0, 100),
              (store_sub, ":left_max", 100, ":random_composition"),
              (store_random_in_range, ":random_composition_2", 0, ":left_max"),
              (store_sub, ":random_composition_3", ":left_max", ":random_composition_2"),
              (try_begin),
                (eq, ":random_type", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":random_composition"),
                (try_begin),
                  (eq, ":random_type_2", 0),
                  (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":random_composition_3"),
                (else_try),
                  (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":random_composition_3"),
                (try_end),
              (else_try),
                (eq, ":random_type", 1),
                (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":random_composition"),
                (try_begin),
                  (eq, ":random_type_2", 0),
                  (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":random_composition_3"),
                (else_try),
                  (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":random_composition_3"),
                (try_end),
              (else_try),
                (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":random_composition"),
                (try_begin),
                  (eq, ":random_type_2", 0),
                  (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":random_composition_3"),
                (else_try),
                  (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":random_composition_3"),
                (try_end),
              (try_end),
              (store_random_in_range, ":random_type", 0, 3),
              (store_random_in_range, ":random_type_2", 0, 2),
              (store_random_in_range, ":random_composition", 0, 100),
              (store_sub, ":left_max", 100, ":random_composition"),
              (store_random_in_range, ":random_composition_2", 0, ":left_max"),
              (store_sub, ":random_composition_3", ":left_max", ":random_composition_2"),
              (try_begin),
                (eq, ":random_type", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":random_composition"),
                (try_begin),
                  (eq, ":random_type_2", 0),
                  (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":random_composition_3"),
                (else_try),
                  (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":random_composition_3"),
                (try_end),
              (else_try),
                (eq, ":random_type", 1),
                (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":random_composition"),
                (try_begin),
                  (eq, ":random_type_2", 0),
                  (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":random_composition_3"),
                (else_try),
                  (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":random_composition_3"),
                (try_end),
              (else_try),
                (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":random_composition"),
                (try_begin),
                  (eq, ":random_type_2", 0),
                  (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":random_composition_3"),
                (else_try),
                  (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":random_composition_2"),
                  (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":random_composition_3"),
                (try_end),
              (try_end),
            (else_try),
              (eq, "$g_quick_battle_game_type", 1), #siege offense
              (store_random_in_range, "$g_quick_battle_map", quick_battle_siege_scenes_begin, quick_battle_siege_scenes_end),
              #defender is enemy
              (store_random_in_range, "$g_presentation_obj_custom_battle_designer_10_last_value", 30, 100), #min 30% archer
              (store_sub, "$g_presentation_obj_custom_battle_designer_9_last_value", 100, "$g_presentation_obj_custom_battle_designer_10_last_value"),
              (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 0), #no cavalry
              (store_random_in_range, "$g_presentation_obj_custom_battle_designer_6_last_value", 20, 100), #min 20% infantry
              (store_sub, "$g_presentation_obj_custom_battle_designer_7_last_value", 100, "$g_presentation_obj_custom_battle_designer_6_last_value"),
              (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 0), #no cavalry
            (else_try),
              #siege defense
              (store_random_in_range, "$g_quick_battle_map", quick_battle_siege_scenes_begin, quick_battle_siege_scenes_end),
              #defender is player
              (store_random_in_range, "$g_presentation_obj_custom_battle_designer_7_last_value", 30, 100), #min 30% archer
              (store_sub, "$g_presentation_obj_custom_battle_designer_6_last_value", 100, "$g_presentation_obj_custom_battle_designer_7_last_value"),
              (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 0), #no cavalry
              (store_random_in_range, "$g_presentation_obj_custom_battle_designer_9_last_value", 20, 100), #min 20% infantry
              (store_sub, "$g_presentation_obj_custom_battle_designer_10_last_value", 100, "$g_presentation_obj_custom_battle_designer_9_last_value"),
              (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 0), #no cavalry
            (try_end),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_2"),
            (assign, "$g_quick_battle_army_1_size", ":value"),
            (try_begin),
              (is_trial_version),
              (gt, "$g_quick_battle_army_1_size", 25),
              (assign, "$g_quick_battle_army_1_size", 25),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_2", 25),
            (try_end),
            (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_1_size"),
            (overlay_set_text, "$g_presentation_obj_custom_battle_designer_21", "str_reg0_men"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_3"),
            (assign, "$g_quick_battle_army_2_size", ":value"),
            (try_begin),
              (is_trial_version),
              (gt, "$g_quick_battle_army_2_size", 25),
              (assign, "$g_quick_battle_army_2_size", 25),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_3", 25),
            (try_end),
            (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_2_size"),
            (overlay_set_text, "$g_presentation_obj_custom_battle_designer_22", "str_reg0_men"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_4"),
            (try_begin),
              (store_sub, ":outlaw_index", cb_factions_end, cb_factions_begin),
              (eq, ":value", ":outlaw_index"),
              (assign, "$g_quick_battle_team_1_faction", "fac_outlaws"),
            (else_try),
              (store_add, "$g_quick_battle_team_1_faction", ":value", cb_factions_begin),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_5"),
            (try_begin),
              (store_sub, ":outlaw_index", cb_factions_end, cb_factions_begin),
              (eq, ":value", ":outlaw_index"),
              (assign, "$g_quick_battle_team_2_faction", "fac_outlaws"),
            (else_try),
              (store_add, "$g_quick_battle_team_2_faction", ":value", cb_factions_begin),
            (try_end),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_18"),
            (store_add, "$g_quick_battle_troop", ":value", quick_battle_troops_begin),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_custom_battle_designer"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_6"),
            (try_begin),
              (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
              (neq, ":value", "$g_presentation_obj_custom_battle_designer_6_last_value"),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
            (else_try),
              (try_begin),
                (lt, ":value", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_6_last_value", ":value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":value"),
                (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", ":first_dif"),
                (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", ":second_dif"),
                (try_begin),
                  (gt, "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                (else_try),
                  (gt, "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
              (else_try),
                (gt, ":value", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (store_sub, ":dif", ":value", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", ":value"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_7_last_value", ":first_dif"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_8_last_value", ":second_dif"),
                (try_begin),
                  (lt, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
                (else_try),
                  (lt, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
              (try_end),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_6_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_12", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_7_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_13", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_8_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_14", "str_reg0_percent"),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_7"),
            (try_begin),
              (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
              (neq, ":value", "$g_presentation_obj_custom_battle_designer_7_last_value"),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
            (else_try),
              (try_begin),
                (lt, ":value", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_7_last_value", ":value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":value"),
                (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", ":first_dif"),
                (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", ":second_dif"),
                (try_begin),
                  (gt, "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                (else_try),
                  (gt, "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 100),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
              (else_try),
                (gt, ":value", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (store_sub, ":dif", ":value", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", ":value"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_6_last_value", ":first_dif"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_8_last_value", ":second_dif"),
                (try_begin),
                  (lt, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_8_last_value", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
                (else_try),
                  (lt, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", 0),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
              (try_end),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_6_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_12", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_7_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_13", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_8_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_14", "str_reg0_percent"),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_8"),
            (try_begin),
              (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
              (neq, ":value", "$g_presentation_obj_custom_battle_designer_8_last_value"),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_8", "$g_presentation_obj_custom_battle_designer_8_last_value"),
            (else_try),
              (try_begin),
                (lt, ":value", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_8_last_value", ":value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":value"),
                (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", ":first_dif"),
                (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", ":second_dif"),
                (try_begin),
                  (gt, "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 100),
                (else_try),
                  (gt, "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 100),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
              (else_try),
                (gt, ":value", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (store_sub, ":dif", ":value", "$g_presentation_obj_custom_battle_designer_8_last_value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_8_last_value", ":value"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_7_last_value", ":first_dif"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_6_last_value", ":second_dif"),
                (try_begin),
                  (lt, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_7_last_value", 0),
                (else_try),
                  (lt, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_6_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_6_last_value", 0),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_7", "$g_presentation_obj_custom_battle_designer_7_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_6", "$g_presentation_obj_custom_battle_designer_6_last_value"),
              (try_end),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_6_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_12", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_7_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_13", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_8_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_14", "str_reg0_percent"),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_9"),
            (try_begin),
              (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
              (neq, ":value", "$g_presentation_obj_custom_battle_designer_9_last_value"),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
            (else_try),
              (try_begin),
                (lt, ":value", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_9_last_value", ":value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":value"),
                (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", ":first_dif"),
                (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", ":second_dif"),
                (try_begin),
                  (gt, "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                (else_try),
                  (gt, "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
              (else_try),
                (gt, ":value", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (store_sub, ":dif", ":value", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", ":value"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_10_last_value", ":first_dif"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_11_last_value", ":second_dif"),
                (try_begin),
                  (lt, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
                (else_try),
                  (lt, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
              (try_end),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_9_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_15", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_10_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_16", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_11_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_17", "str_reg0_percent"),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_10"),
            (try_begin),
              (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
              (neq, ":value", "$g_presentation_obj_custom_battle_designer_10_last_value"),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
            (else_try),
              (try_begin),
                (lt, ":value", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_10_last_value", ":value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":value"),
                (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", ":first_dif"),
                (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", ":second_dif"),
                (try_begin),
                  (gt, "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                (else_try),
                  (gt, "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 100),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
              (else_try),
                (gt, ":value", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (store_sub, ":dif", ":value", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", ":value"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_9_last_value", ":first_dif"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_11_last_value", ":second_dif"),
                (try_begin),
                  (lt, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_11_last_value", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
                (else_try),
                  (lt, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", 0),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
              (try_end),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_9_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_15", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_10_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_16", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_11_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_17", "str_reg0_percent"),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_11"),
            (try_begin),
              (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
              (neq, ":value", "$g_presentation_obj_custom_battle_designer_11_last_value"),
              (overlay_set_val, "$g_presentation_obj_custom_battle_designer_11", "$g_presentation_obj_custom_battle_designer_11_last_value"),
            (else_try),
              (try_begin),
                (lt, ":value", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_11_last_value", ":value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":value"),
                (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", ":first_dif"),
                (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", ":second_dif"),
                (try_begin),
                  (gt, "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 100),
                (else_try),
                  (gt, "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                  (store_sub, ":dif", "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                  (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", ":dif"),
                  (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 100),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
              (else_try),
                (gt, ":value", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (store_sub, ":dif", ":value", "$g_presentation_obj_custom_battle_designer_11_last_value"),
                (try_begin),
                  (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                  (assign, ":first_dif", 0),
                  (assign, ":second_dif", ":dif"),
                (else_try),
                  (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                  (assign, ":first_dif", ":dif"),
                  (assign, ":second_dif", 0),
                (else_try),
                  (store_div, ":first_dif", ":dif", 2),
                  (store_sub, ":second_dif", ":dif", ":first_dif"),
                  (try_begin),
                    (neq, ":first_dif", ":second_dif"),
                    (store_random_in_range, ":random_no", 0, 2),
                    (eq, ":random_no", 0),
                    (val_sub, ":second_dif", 1),
                    (val_add, ":first_dif", 1),
                  (try_end),
                (try_end),
                (assign, "$g_presentation_obj_custom_battle_designer_11_last_value", ":value"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_10_last_value", ":first_dif"),
                (val_sub, "$g_presentation_obj_custom_battle_designer_9_last_value", ":second_dif"),
                (try_begin),
                  (lt, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_10_last_value", 0),
                (else_try),
                  (lt, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
                  (val_add, "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_9_last_value"),
                  (assign, "$g_presentation_obj_custom_battle_designer_9_last_value", 0),
                (try_end),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_10", "$g_presentation_obj_custom_battle_designer_10_last_value"),
                (overlay_set_val, "$g_presentation_obj_custom_battle_designer_9", "$g_presentation_obj_custom_battle_designer_9_last_value"),
              (try_end),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_9_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_15", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_10_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_16", "str_reg0_percent"),
              (assign, reg0, "$g_presentation_obj_custom_battle_designer_11_last_value"),
              (overlay_set_text, "$g_presentation_obj_custom_battle_designer_17", "str_reg0_percent"),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_19"),
            (assign, "$g_is_quick_battle", 1),
            (assign, ":cur_scene", "$g_quick_battle_map"),
            (try_begin),
              (eq, "$g_quick_battle_game_type", 0), #battle
              (assign, ":cur_mission_template", "mt_quick_battle_battle"),
              (modify_visitors_at_site, ":cur_scene"),
              (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1),
              (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0),
            (else_try),
              (eq, "$g_quick_battle_game_type", 1), #siege offense
              (assign, ":cur_mission_template", "mt_quick_battle_siege"),
              (modify_visitors_at_site, ":cur_scene"),
              (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1),
              (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 1, 0),
            (else_try),
              (eq, "$g_quick_battle_game_type", 2), #siege defense
              (assign, ":cur_mission_template", "mt_quick_battle_siege"),
              (modify_visitors_at_site, ":cur_scene"),
              (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 1, 1),
              (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0),
            (else_try),
              (eq, "$g_quick_battle_game_type", 3), #naval battle
              (assign, ":cur_mission_template", "mt_quick_battle_sea_battle"),
              ##
              (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_1_size"),
              (val_add, reg0, 1),	#because script dont count player
              (assign, "$startup_battle_size", reg0),
              (call_script, "script_randomize_ships_for_team", 0, reg0),#!
              (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_2_size"),
              (val_add, "$startup_battle_size", reg0),
              (call_script, "script_randomize_ships_for_team", 1, reg0),#!
              ##
              (modify_visitors_at_site, ":cur_scene"),
              (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1),
              (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0),
            (else_try),
              (eq, "$g_quick_battle_game_type", 4), #coastal assault offense
              (assign, ":cur_mission_template", "mt_quick_battle_coastal_battle"),
              ##
              (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_1_size"),
              (val_add, reg0, 1),	#because script dont count player
              (call_script, "script_randomize_ships_for_team_old", 1, reg0),#!
              ##
              (modify_visitors_at_site, ":cur_scene"),
              (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1),
              (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0),
            (else_try),
              (eq, "$g_quick_battle_game_type", 5), #coastal assault defense
              (assign, ":cur_mission_template", "mt_quick_battle_coastal_battle"),
              ##
              (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_2_size"),
              (call_script, "script_randomize_ships_for_team_old", 1, reg0),#!
              ##
              (modify_visitors_at_site, ":cur_scene"),
              (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1),
              (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0),
            (try_end),
            (set_jump_mission,":cur_mission_template"),
            (jump_to_menu, "mnu_custom_battle_end"),
            (jump_to_scene, ":cur_scene"),
            (change_screen_mission),
            (presentation_set_duration, 0),
          (else_try),
            (eq, ":object", "$g_presentation_obj_custom_battle_designer_20"),
            (presentation_set_duration, 0),
          (try_end),
      ]),
      (ti_on_presentation_mouse_enter_leave,
        [
          (store_trigger_param_1, ":object"),
          (store_trigger_param_2, ":enter_leave"),
          (this_or_next|eq, ":object", "$g_presentation_obj_custom_battle_designer_6"),
          (this_or_next|eq, ":object", "$g_presentation_obj_custom_battle_designer_7"),
          (this_or_next|eq, ":object", "$g_presentation_obj_custom_battle_designer_8"),
          (this_or_next|eq, ":object", "$g_presentation_obj_custom_battle_designer_9"),
          (this_or_next|eq, ":object", "$g_presentation_obj_custom_battle_designer_10"),
          (eq, ":object", "$g_presentation_obj_custom_battle_designer_11"),
          (try_begin),
            (eq, ":enter_leave", 1),
            (try_begin),
              (eq, ":object", "$g_presentation_last_mouse_over_object"),
              (assign, "$g_presentation_last_mouse_over_object", -1),
            (try_end),
          (else_try),
            (assign, "$g_presentation_last_mouse_over_object", ":object"),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (presentation_set_duration, 0),
          (else_try),
            (key_clicked, key_right_mouse_button),
            (neq, "$g_presentation_last_mouse_over_object", -1),
            (try_begin),
              (eq, "$g_presentation_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_6"),
              (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 1),
                (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
              (else_try),
                (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
              (try_end),
            (else_try),
              (eq, "$g_presentation_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_7"),
              (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 1),
                (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
              (else_try),
                (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
              (try_end),
            (else_try),
              (eq, "$g_presentation_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_8"),
              (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_6_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_7_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 1),
              (else_try),
                (assign, "$g_presentation_obj_custom_battle_designer_8_locked", 0),
              (try_end),
            (else_try),
              (eq, "$g_presentation_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_9"),
              (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 1),
                (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
              (else_try),
                (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
              (try_end),
            (else_try),
              (eq, "$g_presentation_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_10"),
              (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 1),
                (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
              (else_try),
                (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
              (try_end),
            (else_try),
              (eq, "$g_presentation_last_mouse_over_object", "$g_presentation_obj_custom_battle_designer_11"),
              (try_begin),
                (eq, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_9_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_10_locked", 0),
                (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 1),
              (else_try),
                (assign, "$g_presentation_obj_custom_battle_designer_11_locked", 0),
              (try_end),
            (try_end),
          (try_end),
      ]),
  ]),
  
  ("game_multiplayer_admin_panel", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (try_begin),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_1"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_1"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_2"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_2"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_3"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_3"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_4"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_4"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_5"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_5"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_6"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_6"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_7"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_7"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_8"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_8"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_9"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_9"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_10"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_10"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_11"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_11"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_12"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_12"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_13"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_13"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_14"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_14"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_15"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_15"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_16"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_16"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_17"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_17"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_18"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_18"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_19"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_19"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_inv_1"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_4"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_inv_2"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_20"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_inv_3"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_9"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_inv_4"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_16"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_inv_5"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_19"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_sea_1"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_sea_1"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_sea_2"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_sea_2"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_coast_1"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_coast_1"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_coast_2"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_coast_2"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_coast"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_scene_coast"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_fjord"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_scene_fjord"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_multi_scene_islands"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_scene_islands"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_random_multi_forest"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_randomf"),
          (else_try),
            (eq, "$g_multiplayer_selected_map", "scn_random_multi_snow"),
            (assign, ":map_image", "mesh_mp_ui_host_maps_randoms"),
          (else_try),
            (assign, ":map_image", "mesh_mp_ui_host_maps_randomp"),
          (try_end),
          
          (create_mesh_overlay, reg0, ":map_image"),
          (position_set_x, pos1, -1),
          (position_set_y, pos1, 550),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1002),
          (position_set_y, pos1, 1002),
          (overlay_set_size, reg0, pos1),
          
          (create_mesh_overlay, reg0, "mesh_mp_ui_host_main"),
          (position_set_x, pos1, -1),
          (position_set_y, pos1, -1),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1002),
          (position_set_y, pos1, 1002),
          (overlay_set_size, reg0, pos1),
          
          (assign, ":cur_y", 1560),
          (assign, ":cur_y_adder", 40),
          
          (try_begin),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_team_deathmatch),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
            (val_add, ":cur_y", ":cur_y_adder"), #two more options for these mods (friendly fire options)
            (val_add, ":cur_y", ":cur_y_adder"),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
            (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
            (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
            (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
          (try_end),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_admin_panel_container", s0, tf_scrollable),
          (position_set_x, pos1, 59),
          (position_set_y, pos1, 50),
          (overlay_set_position, "$g_presentation_obj_admin_panel_container", pos1),
          (position_set_x, pos1, 640),
          (position_set_y, pos1, 520),
          (overlay_set_area_size, "$g_presentation_obj_admin_panel_container", pos1),
          (set_container_overlay, "$g_presentation_obj_admin_panel_container"),
          
          
          (create_text_overlay, reg0, "str_add_to_official_game_servers_list", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_14", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_14", pos1),
          (server_get_add_to_game_servers_list, ":add_to_servers_list"),
          (overlay_set_val, "$g_presentation_obj_admin_panel_14", ":add_to_servers_list"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_enable_valve_anti_cheat", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_41", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_41", pos1),
          (server_get_anti_cheat, ":server_anti_cheat"),
          (overlay_set_val, "$g_presentation_obj_admin_panel_41", ":server_anti_cheat"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_server_name", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (str_store_server_name, s0),
          (try_begin),
            (eq, "$g_multiplayer_renaming_server_allowed", 1),
            (create_simple_text_box_overlay, "$g_presentation_obj_admin_panel_20"),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_20", pos1),
            (overlay_set_text, "$g_presentation_obj_admin_panel_20", s0),
          (else_try),
            (assign, "$g_presentation_obj_admin_panel_20", -1),
            (create_text_overlay, reg0, s0, 0),
            (position_set_x, pos1, 385),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
          (try_end),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_game_password", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_simple_text_box_overlay, "$g_presentation_obj_admin_panel_9"),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_9", pos1),
          (str_store_server_password, s0),
          (overlay_set_text, "$g_presentation_obj_admin_panel_9", s0),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_welcome_message", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_simple_text_box_overlay, "$g_presentation_obj_admin_panel_32"),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_32", pos1),
          (str_store_welcome_message, s0),
          (overlay_set_text, "$g_presentation_obj_admin_panel_32", s0),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_map", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (call_script, "script_multiplayer_fill_map_game_types", "$g_multiplayer_game_type"),
          (assign, ":num_maps", reg0),
          (assign, ":selected_index", 0),
          
          (try_begin),
            (gt, ":num_maps", 12),
            (create_combo_label_overlay, "$g_presentation_obj_admin_panel_1"),
          (else_try),
            (create_combo_button_overlay, "$g_presentation_obj_admin_panel_1"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_admin_panel_1", pos1),
          (position_set_x, pos1, 490),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_1", pos1),
          (troop_get_slot, ":first_map", "trp_multiplayer_data", multi_data_maps_for_game_type_begin),
          (assign, ":selected_map_available", 0),
          (try_for_range, ":i_map", 0, ":num_maps"),
            (store_add, ":map_slot", ":i_map", multi_data_maps_for_game_type_begin),
            (troop_get_slot, ":map_no", "trp_multiplayer_data", ":map_slot"),
            (try_begin),
              (is_between,":map_no",multiplayer_addon_scenes_begin,multiplayer_addon_scenes_end),
              (store_sub, ":string_index", ":map_no", multiplayer_addon_scenes_begin),
              (val_add, ":string_index", multiplayer_addon_scene_names_begin),
            (else_try),
              (store_sub, ":string_index", ":map_no", multiplayer_scenes_begin),
              (val_add, ":string_index", multiplayer_scene_names_begin),
            (try_end),
            (str_store_string, s0, ":string_index"),
            (overlay_add_item, "$g_presentation_obj_admin_panel_1", s0),
            (try_begin),
              (eq, ":map_no", "$g_multiplayer_selected_map"),
              (assign, ":selected_index", ":i_map"),
              (assign, ":selected_map_available", 1),
            (try_end),
          (try_end),
          (overlay_set_val, "$g_presentation_obj_admin_panel_1", ":selected_index"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_game_type", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (try_begin),
            (eq, "$g_multiplayer_changing_game_type_allowed", 1),
            (create_combo_button_overlay, "$g_presentation_obj_admin_panel_10"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, "$g_presentation_obj_admin_panel_10", pos1),
            (position_set_x, pos1, 490),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_10", pos1),
            (try_for_range, ":i_game_type", 0, multiplayer_num_game_types),
              (store_add, ":string_index", ":i_game_type", multiplayer_game_type_names_begin),
              (str_store_string, s0, ":string_index"),
              (overlay_add_item, "$g_presentation_obj_admin_panel_10", s0),
            (try_end),
            (overlay_set_val, "$g_presentation_obj_admin_panel_10", "$g_multiplayer_game_type"),
          (else_try),
            (assign, "$g_presentation_obj_admin_panel_10", -1),
            (store_add, ":string_index", "$g_multiplayer_game_type", multiplayer_game_type_names_begin),
            (str_store_string, s0, ":string_index"),
            (create_text_overlay, reg0, s0, 0),
            (position_set_x, pos1, 385),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
          (try_end),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (try_begin),
            (eq,"$g_multiplayer_game_type",multiplayer_game_type_invasion),
            (create_text_overlay, reg0, "@Players:", 0),
          (else_try),
            (assign, reg1, 1),
            (create_text_overlay, reg0, "str_team_reg1_faction", 0),
          (try_end),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_button_overlay, "$g_presentation_obj_admin_panel_11"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_admin_panel_11", pos1),
          (position_set_x, pos1, 490),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_11", pos1),
          (call_script, "script_multiplayer_fill_available_factions_combo_button", "$g_presentation_obj_admin_panel_11", "$g_multiplayer_next_team_1_faction", "$g_multiplayer_next_team_2_faction"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (try_begin),
            (eq,"$g_multiplayer_game_type",multiplayer_game_type_invasion),
            (create_text_overlay, reg0, "@Invaders:", 0),
          (else_try),
            (assign, reg1, 2),
            (create_text_overlay, reg0, "str_team_reg1_faction", 0),
          (try_end),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_button_overlay, "$g_presentation_obj_admin_panel_12"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_admin_panel_12", pos1),
          (position_set_x, pos1, 490),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_12", pos1),
          (call_script, "script_multiplayer_fill_available_factions_combo_button", "$g_presentation_obj_admin_panel_12", "$g_multiplayer_next_team_2_faction", "$g_multiplayer_next_team_1_faction"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (assign, reg1, 1),
          (create_text_overlay, reg0, "str_max_number_of_players", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (try_begin), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_21", 2, 40),
          (else_try),
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_21", 2, 201),
          (try_end), #chief capitan acaba
          
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_21", pos1),
          (server_get_max_num_players, ":max_players"),
          (overlay_set_val, "$g_presentation_obj_admin_panel_21", ":max_players"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (assign, reg1, 1),
          (create_text_overlay, reg0, "str_number_of_bots_in_team_reg1", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_3", 0, "$g_multiplayer_max_num_bots"),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_3", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_3", "$g_multiplayer_num_bots_team_1"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (create_text_overlay, reg0, "@Invasion difficulty (%):", 0),
          (else_try),
            (assign, reg1, 2),
            (create_text_overlay, reg0, "str_number_of_bots_in_team_reg1", 0),
          (try_end),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_4", 1, 301),
            (overlay_set_position, "$g_presentation_obj_admin_panel_4", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_4", "$g_multiplayer_invasion_difficulty"),
          (else_try),
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_4", 0, "$g_multiplayer_max_num_bots"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_4", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_4", "$g_multiplayer_num_bots_team_2"),
          (try_end),
          
          (try_begin),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_deathmatch),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_duel),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_thor),
            
            (val_sub, ":cur_y", ":cur_y_adder"),
            
            (create_text_overlay, reg0, "str_allow_friendly_fire", 0),
            (position_set_x, pos1, 30),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            
            (create_check_box_overlay, "$g_presentation_obj_admin_panel_5", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos1, 7),
            (store_add, ":special_cur_y", ":cur_y", 7),
            (position_set_y, pos1, ":special_cur_y"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_5", pos1),
            (server_get_friendly_fire, ":server_friendly_fire"),
            (overlay_set_val, "$g_presentation_obj_admin_panel_5", ":server_friendly_fire"),
            
            (val_sub, ":cur_y", ":cur_y_adder"),
            
            (create_text_overlay, reg0, "str_allow_melee_friendly_fire", 0),
            (position_set_x, pos1, 30),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            
            (create_check_box_overlay, "$g_presentation_obj_admin_panel_36", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos1, 7),
            (store_add, ":special_cur_y", ":cur_y", 7),
            (position_set_y, pos1, ":special_cur_y"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_36", pos1),
            (server_get_melee_friendly_fire, ":melee_friendly_fire"),
            (overlay_set_val, "$g_presentation_obj_admin_panel_36", ":melee_friendly_fire"),
          (try_end),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_friendly_fire_damage_self_ratio", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_37", 0, 101),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_37", pos1),
          (server_get_friendly_fire_damage_self_ratio, ":friendly_fire_damage_self_ratio"),
          (overlay_set_val, "$g_presentation_obj_admin_panel_37", ":friendly_fire_damage_self_ratio"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_friendly_fire_damage_friend_ratio", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_38", 0, 101),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_38", pos1),
          (server_get_friendly_fire_damage_friend_ratio, ":friendly_fire_damage_friend_ratio"),
          (overlay_set_val, "$g_presentation_obj_admin_panel_38", ":friendly_fire_damage_friend_ratio"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_spectator_camera", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_button_overlay, "$g_presentation_obj_admin_panel_19"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_admin_panel_19", pos1),
          (position_set_x, pos1, 490),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_19", pos1),
          (overlay_add_item, "$g_presentation_obj_admin_panel_19", "str_free"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_19", "str_stick_to_any_player"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_19", "str_stick_to_team_members"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_19", "str_stick_to_team_members_view"),
          (server_get_ghost_mode, ":server_ghost_mode"),
          (overlay_set_val, "$g_presentation_obj_admin_panel_19", ":server_ghost_mode"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_control_block_direction", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_button_overlay, "$g_presentation_obj_admin_panel_15"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_admin_panel_15", pos1),
          (position_set_x, pos1, 490),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_15", pos1),
          (overlay_add_item, "$g_presentation_obj_admin_panel_15", "str_automatic"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_15", "str_by_mouse_movement"),
          (server_get_control_block_dir, ":server_control_block_dir"),
          (overlay_set_val, "$g_presentation_obj_admin_panel_15", ":server_control_block_dir"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_combat_speed", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_button_overlay, "$g_presentation_obj_admin_panel_26"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_admin_panel_26", pos1),
          (position_set_x, pos1, 490),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_26", pos1),
          (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_0"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_1"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_2"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_3"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_26", "str_combat_speed_4"),
          (server_get_combat_speed, ":server_combat_speed"),
          (overlay_set_val, "$g_presentation_obj_admin_panel_26", ":server_combat_speed"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_map_time_limit", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_7", 5, 121),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_7", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_7", "$g_multiplayer_game_max_minutes"),
          
          (try_begin),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
            
            (val_sub, ":cur_y", ":cur_y_adder"),
            
            (create_text_overlay, reg0, "str_round_time_limit", 0),
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_16", multiplayer_round_max_seconds_min, multiplayer_round_max_seconds_max),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_16", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_16", "$g_multiplayer_round_max_seconds"),
          (else_try),
            (assign, "$g_presentation_obj_admin_panel_16", -1),
          (try_end),
          
          (try_begin),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            
            (val_sub, ":cur_y", ":cur_y_adder"),
            
            (create_text_overlay, reg0, "str_players_take_control_of_a_bot_after_death", 0),
            (position_set_x, pos1, 30),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            
            (create_check_box_overlay, "$g_presentation_obj_admin_panel_25", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos1, 7),
            (store_add, ":special_cur_y", ":cur_y", 7),
            (position_set_y, pos1, ":special_cur_y"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_25", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_25", "$g_multiplayer_player_respawn_as_bot"),
          (else_try),
            (assign, "$g_presentation_obj_admin_panel_25", -1),
          (try_end),
          
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
            
            (val_sub, ":cur_y", ":cur_y_adder"),
            
            (create_text_overlay, reg0, "str_defender_spawn_count_limit", 0),
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            
            (create_combo_button_overlay, "$g_presentation_obj_admin_panel_27"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, "$g_presentation_obj_admin_panel_27", pos1),
            (position_set_x, pos1, 490),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_27", pos1),
            (assign, reg0, 5),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (assign, reg0, 4),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (assign, reg0, 3),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (assign, reg0, 2),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (assign, reg0, 1),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_reg0"),
            (overlay_add_item, "$g_presentation_obj_admin_panel_27", "str_unlimited"),
            
            (store_sub, ":value_to_set", 5, "$g_multiplayer_number_of_respawn_count"),
            (overlay_set_val, "$g_presentation_obj_admin_panel_27", ":value_to_set"),
            #(val_sub, ":cur_y", ":cur_y_adder"),
          (else_try),
            (assign, "$g_presentation_obj_admin_panel_27", -1),
          (try_end),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_team_points_limit", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_8", 3, 1001),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_8", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_8", "$g_multiplayer_game_max_points"),
          
          (assign, "$g_presentation_obj_admin_panel_17", -1),
          (assign, "$g_presentation_obj_admin_panel_18", -1),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_respawn_period", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_6", multiplayer_respawn_period_min, multiplayer_respawn_period_max),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_6", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_6", "$g_multiplayer_respawn_period"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (try_begin), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (create_text_overlay, reg0, "str_initial_gold_multiplierboth", 0),
          (else_try),
            (create_text_overlay, reg0, "str_initial_gold_multiplier", 0),
          (try_end), #chief capitan acaba
          
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_33", 0, 1001),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_33", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_33", "$g_multiplayer_initial_gold_multiplier"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (try_begin), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (create_text_overlay, reg0, "str_initial_gold_multipliert1", 0),
          (else_try),
            (create_text_overlay, reg0, "str_battle_earnings_multiplier", 0),
          (try_end), #chief capitan acaba
          
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_34", 0, 1001),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_34", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_34", "$g_multiplayer_battle_earnings_multiplier"),
          
          (try_begin),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
            (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
            
            (val_sub, ":cur_y", ":cur_y_adder"),
            
            (try_begin), #chief capitan
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
              (create_text_overlay, reg0, "str_initial_gold_multipliert2", 0),
            (else_try),
              (create_text_overlay, reg0, "str_round_earnings_multiplier", 0),
            (try_end), #chief capitan acaba
            
            (position_set_x, pos1, 0),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            
            (create_number_box_overlay, "$g_presentation_obj_admin_panel_35", 0, 1001),
            (position_set_x, pos1, 390),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_admin_panel_35", pos1),
            (overlay_set_val, "$g_presentation_obj_admin_panel_35", "$g_multiplayer_round_earnings_multiplier"),
          (else_try),
            (assign, "$g_presentation_obj_admin_panel_35", -1),
          (try_end),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_make_kick_voteable", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_28", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_28", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_28", "$g_multiplayer_kick_voteable"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_make_ban_voteable", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_29", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_29", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_29", "$g_multiplayer_ban_voteable"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_make_gametype_voteable", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_50", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_50", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_50", "$g_multiplayer_gametype_voteable"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_make_maps_voteable", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_24", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_24", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_24", "$g_multiplayer_maps_voteable"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_make_factions_voteable", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_23", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_23", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_23", "$g_multiplayer_factions_voteable"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          ##	  (try_begin), # bot count limit for polls
          ##	    (neq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
          (create_text_overlay, reg0, "str_bots_upper_limit_for_votes", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (assign, ":upper_limit", 51),
          (val_min, ":upper_limit", "$g_multiplayer_max_num_bots"),
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_22", 0, ":upper_limit"),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_22", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_22", "$g_multiplayer_num_bots_voteable"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          ##	  (try_end), #chief capitan
          
          (create_text_overlay, reg0, "str_valid_vote_ratio", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_30", 50, 101),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_30", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_30", "$g_multiplayer_valid_vote_ratio"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_poll_cooldown", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_51", 0, 1000),
          (position_set_x, pos1, 390),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_51", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_51", "$g_multiplayer_poll_cooldown"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          ##	  (try_begin), # bot count limit for polls
          ##	    (neq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
          (create_text_overlay, reg0, "str_auto_team_balance_limit", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_combo_button_overlay, "$g_presentation_obj_admin_panel_31"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_admin_panel_31", pos1),
          (position_set_x, pos1, 490),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_31", pos1),
          (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_unlimited"),
          (assign, reg0, 6),
          (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
          (assign, reg0, 5),
          (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
          (assign, reg0, 4),
          (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
          (assign, reg0, 3),
          (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
          (assign, reg0, 2),
          (overlay_add_item, "$g_presentation_obj_admin_panel_31", "str_reg0"),
          (try_begin),
            (ge, "$g_multiplayer_auto_team_balance_limit", 1000),
            (overlay_set_val, "$g_presentation_obj_admin_panel_31", 0),
          (else_try),
            (store_sub, ":set_value", 7, "$g_multiplayer_auto_team_balance_limit"),
            (overlay_set_val, "$g_presentation_obj_admin_panel_31", ":set_value"),
          (try_end),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          ##	  (try_end), #chief capitan
          
          (create_text_overlay, reg0, "str_allow_player_banners", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_39", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_39", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_39", "$g_multiplayer_allow_player_banners"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_disallow_ranged_weapons", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_42", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_42", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_42", "$g_multiplayer_disallow_ranged_weapons"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "str_force_default_armor", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_40", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_40", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_40", "$g_multiplayer_force_default_armor"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "@Allow Shield Bash", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_44", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_44", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_44", "$g_multiplayer_allow_shield_bash"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "@Allow Falling from Horses", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_45", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_45", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_45", "$g_multiplayer_allow_fall_from_horse"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "@Allow Shield Wall Bonuses", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_46", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_46", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_46", "$g_multiplayer_allow_shieldwalls"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "@Remove Stray Horses after xxx Seconds (0=off)", 0),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_number_box_overlay, "$g_presentation_obj_admin_panel_47", 0, 1000),
          (position_set_x, pos1, 500),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_47", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_47", "$g_multiplayer_remove_stray_horses"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "@Replace All Weapons with Deadly Bow", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_43", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_43", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_43", "$g_multiplayer_deadly_bow"),
          
          (val_sub, ":cur_y", ":cur_y_adder"),
          
          (create_text_overlay, reg0, "@God Mode", 0),
          (position_set_x, pos1, 30),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (create_check_box_overlay, "$g_presentation_obj_admin_panel_48", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 7),
          (store_add, ":special_cur_y", ":cur_y", 7),
          (position_set_y, pos1, ":special_cur_y"),
          (overlay_set_position, "$g_presentation_obj_admin_panel_48", pos1),
          (overlay_set_val, "$g_presentation_obj_admin_panel_48", "$g_multiplayer_god_mode"),
          
          # (val_sub, ":cur_y", ":cur_y_adder"),
          
          # (create_text_overlay, reg0, "@Troop Classes", 0),
          # (position_set_x, pos1, 30),
          # (position_set_y, pos1, ":cur_y"),
          # (overlay_set_position, reg0, pos1),
          
          # (create_check_box_overlay, "$g_presentation_obj_admin_panel_49", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 7),
          # (store_add, ":special_cur_y", ":cur_y", 7),
          # (position_set_y, pos1, ":special_cur_y"),
          # (overlay_set_position, "$g_presentation_obj_admin_panel_49", pos1),
          # (overlay_set_val, "$g_presentation_obj_admin_panel_49", "$g_multiplayer_troop_classes"),
          
          (set_container_overlay, -1),
          
          (str_store_string, s0, "@-------Game Description-------^"),
          (try_begin),
            (ge,"$g_multiplayer_game_type",multiplayer_game_type_raid),
            (store_sub, ":string_index", "$g_multiplayer_game_type",multiplayer_game_type_raid),
            (val_add, ":string_index", "str_multi_game_type_desc_10"),
          (else_try),
            (store_add, ":string_index", "$g_multiplayer_game_type", multiplayer_game_type_descs_begin),
          (try_end),
          (str_store_string, s1, ":string_index"),
          (str_store_string, s0, "str_s0_s1"),
          
          #add explanation of specials if available
          (try_begin),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_deathmatch),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_duel),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_thor),
            (str_store_string, s1, "str_multi_game_type_descs_end"),  #contains general explanations
            (str_store_string, s0, "str_s0_s1"),
          (try_end),
          
          (create_text_overlay, reg0, s0, tf_scrollable),
          (position_set_x, pos1, 900*Screen_Undistort_Width_Num/Screen_Undistort_Width_Den),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 730),
          (position_set_y, pos1, 150),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 260),
          (position_set_y, pos1, 420),
          (overlay_set_area_size, reg0, pos1),
          
          (create_button_overlay, "$g_presentation_obj_admin_panel_13", "str_back", tf_center_justify),
          (position_set_x, pos1, 825),
          (position_set_y, pos1, 50),
          (overlay_set_position, "$g_presentation_obj_admin_panel_13", pos1),
          (position_set_x, pos1, 1500),
          (position_set_y, pos1, 1500),
          (overlay_set_size, "$g_presentation_obj_admin_panel_13", pos1),
          
          (create_button_overlay, "$g_presentation_obj_admin_panel_2", "str_start_map", tf_center_justify),
          (position_set_x, pos1, 825),
          (position_set_y, pos1, 90),
          (overlay_set_position, "$g_presentation_obj_admin_panel_2", pos1),
          (position_set_x, pos1, 1500),
          (position_set_y, pos1, 1500),
          (overlay_set_size, "$g_presentation_obj_admin_panel_2", pos1),
          
          (presentation_set_duration, 999999),
          
          (try_begin),
            (eq, ":selected_map_available", 0),
            (assign, "$g_multiplayer_selected_map", ":first_map"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
          (try_end),
      ]),
      
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (store_trigger_param_2, ":value"),
          (try_begin),
            (eq, ":object", "$g_presentation_obj_admin_panel_1"),
            (store_add, ":slot_no", ":value", multi_data_maps_for_game_type_begin),
            (troop_get_slot, "$g_multiplayer_selected_map", "trp_multiplayer_data", ":slot_no"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_2"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin_start_map, "$g_multiplayer_selected_map", "$g_multiplayer_game_type"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_3"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin_set_num_bots_in_team, 1, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_4"),
            (try_begin),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_invasion_difficulty, ":value"),
            (else_try),
              (multiplayer_send_2_int_to_server, multiplayer_event_admin_set_num_bots_in_team, 2, ":value"),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_5"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_friendly_fire, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_6"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_respawn_period, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_7"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_game_max_minutes, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_8"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_game_max_points, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_9"),
            (multiplayer_send_string_to_server, multiplayer_event_admin_set_game_password, s0),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_10"),
            (assign, "$g_multiplayer_game_type", ":value"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
            
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_11"),
            (store_add, "$g_multiplayer_next_team_1_faction", ":value", mp_factions_begin),
            ##        (try_begin),
            ##          (ge, "$g_multiplayer_next_team_1_faction", "$g_multiplayer_next_team_2_faction"),
            ##          (val_add, "$g_multiplayer_next_team_1_faction", 1),
            ##        (try_end),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin_set_team_faction, 1, "$g_multiplayer_next_team_1_faction"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_12"),
            (store_add, "$g_multiplayer_next_team_2_faction", ":value", mp_factions_begin),
            ##        (try_begin),
            ##          (ge, "$g_multiplayer_next_team_2_faction", "$g_multiplayer_next_team_1_faction"),
            ##          (val_add, "$g_multiplayer_next_team_2_faction", 1),
            ##        (try_end),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin_set_team_faction, 2, "$g_multiplayer_next_team_2_faction"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_game_multiplayer_admin_panel"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_13"),
            (presentation_set_duration, 0),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_14"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_add_to_servers_list, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_15"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_control_block_dir, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_16"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_round_max_seconds, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_17"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_point_gained_from_flags, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_18"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_point_gained_from_capturing_flag, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_19"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_ghost_mode, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_20"),
            (multiplayer_send_string_to_server, multiplayer_event_admin_set_server_name, s0),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_21"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_max_num_players, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_22"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_num_bots_voteable, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_23"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_factions_voteable, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_24"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_maps_voteable, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_25"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_player_respawn_as_bot, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_26"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_combat_speed, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_27"),
            (store_sub, ":value_to_send", 5, ":value"), #opposite index of displayed list
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_respawn_count, ":value_to_send"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_28"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_kick_voteable, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_29"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_ban_voteable, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_30"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_valid_vote_ratio, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_31"),
            (try_begin),
              (eq, ":value", 0),
              (multiplayer_send_int_to_server, multiplayer_event_admin_set_auto_team_balance_limit, 1000),
            (else_try),
              (store_sub, ":value_to_send", 7, ":value"),
              (multiplayer_send_int_to_server, multiplayer_event_admin_set_auto_team_balance_limit, ":value_to_send"),
            (try_end),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_32"),
            (server_set_welcome_message, s0),
            (multiplayer_send_string_to_server, multiplayer_event_admin_set_welcome_message, s0),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_33"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_initial_gold_multiplier, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_34"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_battle_earnings_multiplier, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_35"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_round_earnings_multiplier, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_36"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_melee_friendly_fire, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_37"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_friendly_fire_damage_self_ratio, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_38"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_friendly_fire_damage_friend_ratio, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_39"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_allow_player_banners, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_40"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_force_default_armor, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_41"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_anti_cheat, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_42"),
            (multiplayer_send_int_to_server, multiplayer_event_admin_set_disallow_ranged_weapons, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_43"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_deadly_bow, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_44"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_allow_shield_bash, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_45"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_allow_fall_from_horse, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_46"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_allow_shieldwall, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_47"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_remove_stray_horses, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_48"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_god_mode, ":value"),
            # (else_try),
            # (eq, ":object", "$g_presentation_obj_admin_panel_49"),
            # (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_troop_classes, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_50"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_gametype_voteable, ":value"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_admin_panel_51"),
            (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_set_poll_cooldown, ":value"),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_welcome_message", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          (str_store_welcome_message, s0),
          (try_begin),
            (neg|str_is_empty, s0),
            (eq, "$g_multiplayer_welcome_message_shown", 0),
            (create_mesh_overlay, reg0, "mesh_mp_ui_welcome_panel"),
            (position_set_x, pos1, 200),
            (position_set_y, pos1, 400),
            (overlay_set_position, reg0, pos1),
            (create_text_overlay, reg0, s0, tf_scrollable),
            (overlay_set_color, reg0, 0xFFFFFF),
            (position_set_x, pos1, 230),
            (position_set_y, pos1, 425),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 540),
            (position_set_y, pos1, 150),
            (overlay_set_area_size, reg0, pos1),
            
            (presentation_set_duration, 999999),
          (else_try),
            (eq, "$g_multiplayer_show_server_rules", 1),
            (create_mesh_overlay, reg0, "mesh_mp_ui_welcome_panel"),
            (position_set_x, pos1, 200),
            (position_set_y, pos1, 400),
            (overlay_set_position, reg0, pos1),
            (try_begin),
              (neg|str_is_empty, s0),
              (str_clear, s3),
              (str_store_string, s2, s0),
              (str_store_string, s2, "str_s2_s3"),
              (str_store_string, s2, "str_s2_s3"),
            (else_try),
              (str_clear, s2),
            (try_end),
            (str_store_string, s3, "@Game Rules:^"),
            (str_store_string, s2, "str_s2_s3"),
            (assign, ":end_cond", 1000),
            (call_script, "script_game_multiplayer_get_game_type_mission_template", "$g_multiplayer_game_type"),
            (assign, ":cur_mt", reg0),
            
            (str_store_server_name, s0),
            (str_store_string, s3, "str_server_name_s0"),
            (str_store_string, s2, "str_s2_s3"),
            
            (try_begin),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_deathmatch),
              (str_store_string, s0, "str_multi_game_type_1"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_team_deathmatch),
              (str_store_string, s0, "str_multi_game_type_2"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
              (str_store_string, s0, "str_multi_game_type_3"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
              (str_store_string, s0, "str_multi_game_type_4"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_duel),
              (str_store_string, s0, "str_multi_game_type_5"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
              (str_store_string, s0, "str_multi_game_type_6"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_thor),
              (str_store_string, s0, "str_multi_game_type_7"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
              (str_store_string, s0, "str_multi_game_type_8"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
              (str_store_string, s0, "str_multi_game_type_9"),
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
              (str_store_string, s0, "str_multi_game_type_10"),
            (try_end),
            
            (str_store_string, s3, "str_game_type_s0"),
            (str_store_string, s2, "str_s2_s3"),
            
            (store_current_scene, ":cur_scene"),
            (try_begin),
              (is_between,":cur_scene",multiplayer_addon_scenes_begin,multiplayer_addon_scenes_end),
              (val_sub, ":cur_scene", multiplayer_addon_scenes_begin),
              (val_add, ":cur_scene", multiplayer_addon_scene_names_begin),
            (else_try),
              (val_sub, ":cur_scene", multiplayer_scenes_begin),
              (val_add, ":cur_scene", multiplayer_scene_names_begin),
            (try_end),
            (str_store_string, s0, ":cur_scene"),
            (str_store_string, s3, "str_map_name_s0"),
            (str_store_string, s2, "str_s2_s3"),
            
            (store_mission_timer_a, ":mission_timer"),
            (val_add, ":mission_timer", "$server_mission_timer_while_player_joined"),
            (assign, reg0, ":mission_timer"),
            (store_mul, "$g_multiplayer_game_max_seconds", "$g_multiplayer_game_max_minutes", 60),
            (store_sub, ":remaining_seconds", "$g_multiplayer_game_max_seconds", ":mission_timer"),
            (store_div, reg0, ":remaining_seconds", 60),
            (store_mod, reg1, ":remaining_seconds", 60),
            (try_begin),
              (ge, reg0, 10),
              (ge, reg1, 10),
              (str_clear, s0),
              (str_clear, s1),
            (else_try),
              (ge, reg0, 10),
              (str_clear, s0),
              (str_store_string, s1, "@0"),
            (else_try),
              (ge, reg1, 10),
              (str_store_string, s0, "@0"),
              (str_clear, s1),
            (else_try),
              (str_store_string, s0, "@0"),
              (str_store_string, s1, "@0"),
            (try_end),
            (str_store_string, s3, "str_remaining_time_s0reg0_s1reg1"),
            
            (str_store_string, s2, "str_s2_s3"),
            
            (try_for_range, ":cur_option", 0, ":end_cond"),
              (assign, reg0, -12345), #magic number
              (call_script, "script_game_get_multiplayer_server_option_for_mission_template", ":cur_mt", ":cur_option"),
              (try_begin),
                (eq, reg0, -12345),
                (assign, ":end_cond", 0),
              (else_try),
                (call_script, "script_game_multiplayer_server_option_for_mission_template_to_string", ":cur_mt", ":cur_option", reg0),
                (str_store_string, s3, s0),
                (str_store_string, s2, "str_s2_s3"),
              (try_end),
            (try_end),
            (create_text_overlay, reg0, s2, tf_scrollable),
            (overlay_set_color, reg0, 0xFFFFFF),
            (position_set_x, pos1, 230),
            (position_set_y, pos1, 425),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 540),
            (position_set_y, pos1, 150),
            (overlay_set_area_size, reg0, pos1),
            
            (presentation_set_duration, 999999),
          (try_end),
      ]),
      
      (ti_on_presentation_run,
        [
          (str_store_welcome_message, s0),
          (try_begin),
            (neq, "$g_multiplayer_show_server_rules", 1),
            (this_or_next|str_is_empty, s0),
            (eq, "$g_multiplayer_welcome_message_shown", 1),
            (presentation_set_duration, 0),
            (neg|is_presentation_active, "prsnt_multiplayer_escape_menu"),
            (neg|is_presentation_active, "prsnt_multiplayer_team_select"),
            (start_presentation, "prsnt_multiplayer_team_select"),
          (else_try),
            (store_mission_timer_a, ":mission_timer"),
            (gt, ":mission_timer", 1),
            
            (try_begin),
              (neq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #long game instructions need scroll bar
              (this_or_next|key_clicked, key_left_mouse_button),
              (this_or_next|key_clicked, key_right_mouse_button),
              (this_or_next|key_clicked, key_pad_ltrigger),
              (key_clicked, key_pad_rtrigger),
              (assign, ":do_it", 1),
            (else_try),
              (assign, ":do_it", 0),
            (try_end),
            
            (this_or_next|key_clicked, key_escape),
            (this_or_next|key_clicked, key_pad_start),
            (this_or_next|key_clicked, key_space),
            (this_or_next|key_clicked, key_enter),
            (eq, ":do_it", 1),
            # (this_or_next|key_clicked, key_left_mouse_button),
            # (this_or_next|key_clicked, key_right_mouse_button),
            # (this_or_next|key_clicked, key_pad_ltrigger),
            # (key_clicked, key_pad_rtrigger),
            (assign, "$g_multiplayer_welcome_message_shown", 1),
            (presentation_set_duration, 0),
            (neg|is_presentation_active, "prsnt_multiplayer_escape_menu"),
            (neg|is_presentation_active, "prsnt_multiplayer_team_select"),
            (try_begin),
              (eq, "$g_multiplayer_show_server_rules", 1),
              (assign, "$g_multiplayer_show_server_rules", 0),
              (start_presentation, "prsnt_multiplayer_escape_menu"),
            (else_try),
              (start_presentation, "prsnt_multiplayer_team_select"),
            (try_end),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_team_select", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_mp_score_b"),
          (position_set_x, pos1, 150),
          (position_set_y, pos1, 165),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 700),
          (overlay_set_size, reg0, pos1),
          
          (create_text_overlay, reg0, "str_choose_a_faction", tf_center_justify),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 520),
          (overlay_set_position, reg0, pos1),
          
          (assign, ":number_of_players_at_team_1", 0),
          (assign, ":number_of_players_at_team_2", 0),
          (try_for_players,":cur_player"),
            (player_is_active,":cur_player"),
            (player_get_team_no, ":player_team", ":cur_player"),
            (try_begin),
              (eq, ":player_team", 0),
              (val_add, ":number_of_players_at_team_1", 1),
            (else_try),
              (eq, ":player_team", 1),
              (val_add, ":number_of_players_at_team_2", 1),
            (try_end),
          (try_end),
          
          (position_set_x, pos2, 200),
          (position_set_y, pos2, 200),
          (multiplayer_get_my_player, ":my_player_no"),
          (team_get_faction, ":faction_no", 0),
          (str_store_faction_name, s0, ":faction_no"),
          (create_button_overlay, "$g_presentation_obj_team_select_1", s0, tf_center_justify),
          (try_begin),
            (call_script, "script_cf_multiplayer_team_is_available", ":my_player_no", 0),
            (overlay_set_color, "$g_presentation_obj_team_select_1", 0xFFFFFF),
            (overlay_set_hilight_color, "$g_presentation_obj_team_select_1", 0x55FF50),
            (assign, "$g_multiplayer_team_select_1_available", 1),
          (else_try),
            (overlay_set_color, "$g_presentation_obj_team_select_1", 0x888888),
            (overlay_set_hilight_color, "$g_presentation_obj_team_select_1", 0x888888),
            (assign, "$g_multiplayer_team_select_1_available", 0),
          (try_end),
          (position_set_x, pos1, 320),
          (position_set_y, pos1, 260),
          (overlay_set_position, "$g_presentation_obj_team_select_1", pos1),
          
          (store_sub,":mesh",":faction_no","fac_culture_norse"),
          (val_add,":mesh","mesh_mp_scoreboard_team_1"),
          (create_image_button_overlay,reg0,":mesh",":mesh"),
          (overlay_set_size, reg0, pos2),
          (position_set_y, pos1, 390),
          (overlay_set_position, reg0, pos1),
          
          (assign, reg1, ":number_of_players_at_team_1"),
          (create_text_overlay,reg0,"@Players: {reg1}",tf_center_justify),
          (position_set_y, pos1, 240),
          (overlay_set_position,reg0,pos1),
          (overlay_set_color,reg0, 0x888888),
          
          (team_get_faction, ":faction_no2", 1),
          (str_store_faction_name, s0, ":faction_no2"),
          (try_begin),
            (eq,":faction_no2",":faction_no"),
            (assign,":mesh","mesh_mp_scoreboard_team_rebel"),
            #(str_store_string,s0,"@{s0} Rebels"),
          (else_try),
            (store_sub,":mesh",":faction_no2","fac_culture_norse"),
            (val_add,":mesh","mesh_mp_scoreboard_team_1"),
          (try_end),
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (neg|player_is_admin,":my_player_no"),
            (create_text_overlay, "$g_presentation_obj_team_select_2", s0, tf_center_justify),
            (overlay_set_color, "$g_presentation_obj_team_select_2", 0xAAAAAA),
          (else_try),
            (create_button_overlay, "$g_presentation_obj_team_select_2", s0, tf_center_justify),
            (try_begin),
              (call_script, "script_cf_multiplayer_team_is_available", ":my_player_no", 1),
              (overlay_set_color, "$g_presentation_obj_team_select_2", 0xFFFFFF),
              (overlay_set_hilight_color, "$g_presentation_obj_team_select_2", 0x55FF50),
              (assign, "$g_multiplayer_team_select_2_available", 1),
            (else_try),
              (overlay_set_color, "$g_presentation_obj_team_select_2", 0x888888),
              (overlay_set_hilight_color, "$g_presentation_obj_team_select_2", 0x888888),
              (assign, "$g_multiplayer_team_select_2_available", 0),
            (try_end),
          (try_end),
          (position_set_x, pos1, 680),
          (position_set_y, pos1, 260),
          (overlay_set_position, "$g_presentation_obj_team_select_2", pos1),
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (player_is_admin,":my_player_no"),
            (create_text_overlay, reg1, "@Command enemy troops", tf_center_justify),
            (position_set_x, pos1, 680),
            (position_set_y, pos1, 220),
            (overlay_set_position, reg1, pos1),
            (overlay_set_color, reg1, 0xff3333),
          (try_end),
          
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (neg|player_is_admin,":my_player_no"),
            (create_mesh_overlay,reg0,":mesh"),
          (else_try),
            (create_image_button_overlay,reg0,":mesh",":mesh"),
          (try_end),
          (overlay_set_size, reg0, pos2),
          (position_set_y, pos1, 390),
          (overlay_set_position, reg0, pos1),
          
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (create_text_overlay,reg0,"@Invaders",tf_center_justify),
          (else_try),
            (assign, reg1, ":number_of_players_at_team_2"),
            (create_text_overlay,reg0,"@Players: {reg1}",tf_center_justify),
          (try_end),
          (position_set_y, pos1, 240),
          (overlay_set_position,reg0,pos1),
          (overlay_set_color,reg0, 0x888888),
          
          
          
          (create_button_overlay, "$g_presentation_obj_team_select_3", "str_spectator", tf_center_justify),
          (overlay_set_color, "$g_presentation_obj_team_select_3", 0xFFFFFF),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 200),
          (overlay_set_position, "$g_presentation_obj_team_select_3", pos1),
          
          (presentation_set_duration, 999999),
      ]),
      
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (multiplayer_get_my_player, ":my_player_no"),
          (try_begin),
            (eq, "$g_waiting_for_confirmation_to_terminate", 0),
            (store_add, ":mesh1", "$g_presentation_obj_team_select_1",1),
            (store_add, ":mesh2", "$g_presentation_obj_team_select_2",1),
            (try_begin),
              (this_or_next|eq, ":object", ":mesh1"),
              (eq, ":object", "$g_presentation_obj_team_select_1"),
              (try_begin),
                (call_script, "script_cf_multiplayer_team_is_available", ":my_player_no", 0),
                (try_begin),
                  (player_get_team_no, ":my_team", ":my_player_no"),
                  (neq, ":my_team", 0),
                  (assign, "$g_confirmation_result", 0),
                  (assign, "$g_waiting_for_confirmation_to_terminate", 1),
                  (player_get_troop_id, "$g_confirmation_troop_backup", ":my_player_no"),
                  (player_get_team_no, "$g_confirmation_team_backup", ":my_player_no"),
                  (player_set_troop_id, ":my_player_no", -1),
                  (multiplayer_send_int_to_server, multiplayer_event_change_team_no, 0),
                  (player_set_team_no, ":my_player_no", 0),
                (else_try),
                  (presentation_set_duration, 0),
                  #(start_presentation, "prsnt_multiplayer_troop_select"),
                  (call_script,"script_replace_troop_presentation"),
                (try_end),
              (try_end),
            (else_try),
              (this_or_next|eq, ":object", ":mesh2"),
              (eq, ":object", "$g_presentation_obj_team_select_2"),
              (try_begin),
                (call_script, "script_cf_multiplayer_team_is_available", ":my_player_no", 1),
                (try_begin),
                  (player_get_team_no, ":my_team", ":my_player_no"),
                  (neq, ":my_team", 1),
                  (assign, "$g_confirmation_result", 0),
                  (assign, "$g_waiting_for_confirmation_to_terminate", 1),
                  (player_get_troop_id, "$g_confirmation_troop_backup", ":my_player_no"),
                  (player_get_team_no, "$g_confirmation_team_backup", ":my_player_no"),
                  (player_set_troop_id, ":my_player_no", -1),
                  (multiplayer_send_int_to_server, multiplayer_event_change_team_no, 1),
                  (player_set_team_no, ":my_player_no", 1),
                (else_try),
                  (presentation_set_duration, 0),
                  #(start_presentation, "prsnt_multiplayer_troop_select"),
                  (call_script,"script_replace_troop_presentation"),
                (try_end),
              (try_end),
            (else_try),
              (eq, ":object", "$g_presentation_obj_team_select_3"),
              (player_set_troop_id, ":my_player_no", -1),
              (multiplayer_send_int_to_server, multiplayer_event_change_team_no, multi_team_spectator),
              (player_set_team_no, ":my_player_no", multi_team_spectator),
              (presentation_set_duration, 0),
            (try_end),
          (try_end),
      ]),
      
      (ti_on_presentation_run,
        [
          (multiplayer_get_my_player, ":my_player_no"),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (eq, "$g_waiting_for_confirmation_to_terminate", 0),
            (multiplayer_get_my_team, ":my_team"),
            (try_begin),
              (eq, ":my_team", multi_team_unassigned),
              (player_set_troop_id, ":my_player_no", -1),
              (multiplayer_send_int_to_server, multiplayer_event_change_team_no, multi_team_spectator),
              (player_set_team_no, ":my_player_no", multi_team_spectator),
            (try_end),
            (presentation_set_duration, 0),
          (else_try),
            (eq, "$g_waiting_for_confirmation_to_terminate", 1),
            (eq, "$g_confirmation_result", 1),
            (assign, "$g_waiting_for_confirmation_to_terminate", 0),
            (assign, "$g_confirmation_result", 0),
            (presentation_set_duration, 0),
            #(start_presentation, "prsnt_multiplayer_troop_select"),
            (call_script,"script_replace_troop_presentation"),
          (else_try),
            (eq, "$g_waiting_for_confirmation_to_terminate", 1),
            (eq, "$g_confirmation_result", -1),
            #return troop and team back to the old state
            (player_set_troop_id, ":my_player_no", "$g_confirmation_troop_backup"),
            (player_set_team_no, ":my_player_no", "$g_confirmation_team_backup"),
            (assign, "$g_waiting_for_confirmation_to_terminate", 0),
            (assign, "$g_confirmation_result", 0),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_team_select"),
          (else_try),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (assign, ":do_refresh", 0),
            (try_begin),
              (call_script, "script_cf_multiplayer_team_is_available", ":my_player_no", 0),
              (try_begin),
                (eq, "$g_multiplayer_team_select_1_available", 0),
                (assign, ":do_refresh", 1),
              (try_end),
            (else_try),
              #not available
              (try_begin),
                (eq, "$g_multiplayer_team_select_1_available", 1),
                (assign, ":do_refresh", 1),
              (try_end),
            (try_end),
            (try_begin),
              (call_script, "script_cf_multiplayer_team_is_available", ":my_player_no", 1),
              (try_begin),
                (eq, "$g_multiplayer_team_select_2_available", 0),
                (assign, ":do_refresh", 1),
              (try_end),
            (else_try),
              #not available
              (try_begin),
                (eq, "$g_multiplayer_team_select_2_available", 1),
                (assign, ":do_refresh", 1),
              (try_end),
            (try_end),
            (eq, ":do_refresh", 1),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_team_select"),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_troop_select", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (try_begin), #chief capitan
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
            (position_set_x, pos1, 250), #chief cambia de 250 a 70 para chief capitan
            (position_set_y, pos1, 80),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1000), #chief cambia de 1000 a 1800 para chief capitan
            (position_set_y, pos1, 1000),
            (overlay_set_size, reg0, pos1),
            
            (str_clear, s0),
            (create_text_overlay, "$g_presentation_obj_troop_select_container", s0, tf_scrollable_style_2),
            (position_set_x, pos1, 285), #chief cambia de 285 a 90 pata chief capitan
            (position_set_y, pos1, 125),
            (overlay_set_position, "$g_presentation_obj_troop_select_container", pos1),
            (position_set_x, pos1, 405), #chief cambia a 805 para chief capitan
            (position_set_y, pos1, 500),
            (overlay_set_area_size, "$g_presentation_obj_troop_select_container", pos1),
            (set_container_overlay, "$g_presentation_obj_troop_select_container"),
            
          (else_try), #chief capitan acaba
            (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
            (position_set_x, pos1, 250),
            (position_set_y, pos1, 80),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1000),
            (position_set_y, pos1, 1000),
            (overlay_set_size, reg0, pos1),
            
            (str_clear, s0),
            (create_text_overlay, "$g_presentation_obj_troop_select_container", s0, tf_scrollable_style_2),
            (position_set_x, pos1, 285),
            (position_set_y, pos1, 125),
            (overlay_set_position, "$g_presentation_obj_troop_select_container", pos1),
            (position_set_x, pos1, 405),
            (position_set_y, pos1, 500),
            (overlay_set_area_size, "$g_presentation_obj_troop_select_container", pos1),
            (set_container_overlay, "$g_presentation_obj_troop_select_container"),
          (try_end), #chief capitan
          
          (assign, ":cur_y", 450),
          
          (try_begin), #chief capitan continua aqui
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
            (create_text_overlay, reg0, "str_choose_a_captain", 0),
          (else_try),
            (create_text_overlay, reg0, "str_choose_a_troop", 0),
          (try_end), #chief capitan acaba
          
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          (position_set_y, pos1, ":cur_y"),
          (position_set_x, pos1, 100),
          
          (multiplayer_get_my_player, ":my_player_no"),
          (player_get_team_no, ":my_team_no", ":my_player_no"),
          (team_get_faction, ":my_faction_no", ":my_team_no"),
          (try_for_range, ":i_multi", multi_data_troop_button_indices_begin, multi_data_troop_button_indices_end),
            (troop_set_slot, "trp_multiplayer_data", ":i_multi", -1),
          (try_end),
          
          (assign, ":cur_troop_index", 0),
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle),
            (assign,":begin",multiplayer_lordscapitan_begin),
            (assign,":end",multiplayer_lordscapitan_end),
          (else_try),
            #(eq,"$g_multiplayer_troop_classes",1),
            (assign,":begin",multiplayer_class_troops_begin),
            (assign,":end",multiplayer_class_troops_end),
          (try_end),
          
          (try_for_range, ":troop_no", ":begin", ":end"),
            (store_troop_faction, ":troop_faction", ":troop_no"),
            (eq, ":troop_faction", ":my_faction_no"),
            (call_script,"script_cf_no_mp_cavalry_troops_for_naval_battles",":troop_no"),
            (str_store_troop_name, s1, ":troop_no"),
            (create_button_overlay, ":overlay", s1, 0),
            (overlay_set_color, ":overlay", 0xFFFFFF),
            (store_add, ":button_index_slot", ":cur_troop_index", multi_data_troop_button_indices_begin),
            (troop_set_slot, "trp_multiplayer_data", ":button_index_slot", ":overlay"),
            (val_add, ":cur_troop_index", 1),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, ":overlay", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
          (try_end),
          (presentation_set_duration, 999999),
      ]),
      
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (multiplayer_get_my_player, ":my_player_no"),
          (player_get_team_no, ":my_team_no", ":my_player_no"),
          (team_get_faction, ":my_faction_no", ":my_team_no"),
          (assign, ":selected_troop_no", -1),
          (assign, ":end_cond", multi_data_troop_button_indices_end),
          (try_for_range, ":i_button", multi_data_troop_button_indices_begin, ":end_cond"),
            (troop_slot_eq, "trp_multiplayer_data", ":i_button", ":object"),
            (store_sub, ":selected_troop_index", ":i_button", multi_data_troop_button_indices_begin),
            (try_begin),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle),
              (assign,":begin",multiplayer_lordscapitan_begin),
              (assign,":end_cond_2",multiplayer_lordscapitan_end),
            (else_try),
              #(eq,"$g_multiplayer_troop_classes",1),
              (assign,":begin",multiplayer_class_troops_begin),
              (assign,":end_cond_2",multiplayer_class_troops_end),
            (try_end),
            (try_for_range, ":troop_no", ":begin", ":end_cond_2"),
              (store_troop_faction, ":troop_faction", ":troop_no"),
              (eq, ":troop_faction", ":my_faction_no"),
              (call_script,"script_cf_no_mp_cavalry_troops_for_naval_battles",":troop_no"),
              (val_sub, ":selected_troop_index", 1),
              (lt, ":selected_troop_index", 0),
              (assign, ":selected_troop_no", ":troop_no"),
              (assign, ":end_cond_2", 0), #break
            (try_end),
            (try_begin),
              (multiplayer_get_my_troop, ":troop_no"),
              (neq, ":troop_no", ":selected_troop_no"),
              (player_set_troop_id, ":my_player_no", ":selected_troop_no"),
              (multiplayer_send_int_to_server, multiplayer_event_change_troop_id, ":selected_troop_no"),
              (call_script, "script_multiplayer_set_default_item_selections_for_troop", ":selected_troop_no"),
              (call_script, "script_multiplayer_send_item_selections"),
            (try_end),
            (presentation_set_duration, 0),
            (assign, "$g_presentation_state", 0),
            (start_presentation, "prsnt_multiplayer_item_select"),
            (assign, ":end_cond", 0), #break
          (try_end),
      ]),
      (ti_on_presentation_run,
        [
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (multiplayer_get_my_team,":team_no"),
            (eq,":team_no",1),
            (presentation_set_duration, 0),
          (try_end),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (multiplayer_get_my_player, ":my_player_no"),
            (is_between, ":my_player_no", 0, multiplayer_max_possible_player_id),
            (multiplayer_get_my_troop, ":my_troop"),
            (try_begin),
              (neg|is_between, ":my_troop", multiplayer_troops_begin, multiplayer_troops_end),
              (neg|is_between, ":my_troop", multiplayer_addon_troops_begin, multiplayer_addon_troops_end),
              (player_set_troop_id, ":my_player_no", -1),
              (multiplayer_send_int_to_server, multiplayer_event_change_troop_id, -1),
              (multiplayer_send_int_to_server, multiplayer_event_change_team_no, multi_team_spectator),
              (player_set_team_no, ":my_player_no", multi_team_spectator),
            (try_end),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_item_select", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          (multiplayer_get_my_player, ":my_player_no"),
          
          (assign, "$g_presentation_obj_item_select_1", -1),
          (assign, "$g_presentation_obj_item_select_2", -1),
          (assign, "$g_presentation_obj_item_select_3", -1),
          (assign, "$g_presentation_obj_item_select_4", -1),
          (assign, "$g_presentation_obj_item_select_5", -1),
          (assign, "$g_presentation_obj_item_select_6", -1),
          (assign, "$g_presentation_obj_item_select_7", -1),
          (assign, "$g_presentation_obj_item_select_8", -1),
          (assign, "$g_presentation_obj_item_select_9", -1),
          (assign, "$g_presentation_obj_item_select_10", -1),
          (assign, "$g_presentation_obj_item_select_11", -1),
          (assign, "$g_presentation_obj_item_select_12", -1),
          (assign, "$g_presentation_obj_item_select_13", -1),
          (assign, "$g_presentation_obj_item_select_14", -1),
          (assign, "$g_presentation_obj_item_select_15", -1),
          (assign, "$g_presentation_obj_item_select_16", -1),
          
          (try_begin),
            (neq, "$g_current_opened_item_details", -1),
            (close_item_details),
            (assign, "$g_current_opened_item_details", -1),
          (try_end),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 0),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_1", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 526),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_1", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_1", "mesh_mp_inventory_slot_equip", "mesh_mp_inventory_slot_equip"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_1", pos1),
          (position_set_x, pos1, 899),
          (position_set_y, pos1, 475),
          (overlay_set_position, "$g_presentation_obj_item_select_1", pos1),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 1),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_2", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 426),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_2", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_2", "mesh_mp_inventory_slot_equip", "mesh_mp_inventory_slot_equip"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_2", pos1),
          (position_set_x, pos1, 899),
          (position_set_y, pos1, 375),
          (overlay_set_position, "$g_presentation_obj_item_select_2", pos1),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 2),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_3", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 326),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_3", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_3", "mesh_mp_inventory_slot_equip", "mesh_mp_inventory_slot_equip"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_3", pos1),
          (position_set_x, pos1, 899),
          (position_set_y, pos1, 275),
          (overlay_set_position, "$g_presentation_obj_item_select_3", pos1),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 3),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_4", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 950),
            (position_set_y, pos1, 226),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_4", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_4", "mesh_mp_inventory_slot_equip", "mesh_mp_inventory_slot_equip"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_4", pos1),
          (position_set_x, pos1, 899),
          (position_set_y, pos1, 175),
          (overlay_set_position, "$g_presentation_obj_item_select_4", pos1),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 4),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_5", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 576),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_5", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_5", "mesh_mp_inventory_slot_helmet", "mesh_mp_inventory_slot_helmet"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_5", pos1),
          (position_set_x, pos1, 2),
          (position_set_y, pos1, 525),
          (overlay_set_position, "$g_presentation_obj_item_select_5", pos1),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 5),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_6", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 476),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_6", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_6", "mesh_mp_inventory_slot_armor", "mesh_mp_inventory_slot_armor"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_6", pos1),
          (position_set_x, pos1, 2),
          (position_set_y, pos1, 425),
          (overlay_set_position, "$g_presentation_obj_item_select_6", pos1),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 6),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_7", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 376),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_7", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_7", "mesh_mp_inventory_slot_boot", "mesh_mp_inventory_slot_boot"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_7", pos1),
          (position_set_x, pos1, 2),
          (position_set_y, pos1, 325),
          (overlay_set_position, "$g_presentation_obj_item_select_7", pos1),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 7),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (create_image_button_overlay, "$g_presentation_obj_item_select_8", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 276),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_8", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_8", "mesh_mp_inventory_slot_glove", "mesh_mp_inventory_slot_glove"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_8", pos1),
          (position_set_x, pos1, 2),
          (position_set_y, pos1, 225),
          (overlay_set_position, "$g_presentation_obj_item_select_8", pos1),
          
          (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 8),
          (player_get_slot, ":selected_item_id", ":my_player_no", ":selected_item_index"),
          (try_begin),
            (ge, ":selected_item_id", 0),
            (eq, "$g_horses_are_avaliable", 1),
            (create_image_button_overlay, "$g_presentation_obj_item_select_9", "mesh_mp_inventory_slot_empty", "mesh_mp_inventory_slot_empty"),
            (create_mesh_overlay_with_item_id, reg0, ":selected_item_id"),
            (position_set_x, pos1, 53),
            (position_set_y, pos1, 176),
            (overlay_set_position, reg0, pos1),
            (assign, "$g_inside_obj_9", reg0),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_item_select_9", "mesh_mp_inventory_slot_horse", "mesh_mp_inventory_slot_horse"),
          (try_end),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_item_select_9", pos1),
          (position_set_x, pos1, 2),
          (position_set_y, pos1, 125),
          (overlay_set_position, "$g_presentation_obj_item_select_9", pos1),
          
          (create_mesh_overlay, reg0, "mesh_mp_inventory_left"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, 14),
          (overlay_set_position, reg0, pos1),
          
          (create_mesh_overlay, reg0, "mesh_mp_inventory_right"),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, 894),
          (position_set_y, pos1, 65),
          (overlay_set_position, reg0, pos1),
          
          (create_in_game_button_overlay, "$g_presentation_obj_item_select_10", "str_reset_to_default", 0),
          (overlay_set_color, "$g_presentation_obj_item_select_10", 0xFFFFFF),
          (position_set_x, pos1, 605),
          (position_set_y, pos1, 25),
          (overlay_set_position, "$g_presentation_obj_item_select_10", pos1),
          
          (create_in_game_button_overlay, "$g_presentation_obj_item_select_11", "str_done", 0),
          (overlay_set_color, "$g_presentation_obj_item_select_11", 0xFFFFFF),
          (position_set_x, pos1, 395),
          (position_set_y, pos1, 25),
          (overlay_set_position, "$g_presentation_obj_item_select_11", pos1),
          
          (assign, ":cur_y", 725),
          (multiplayer_get_my_player, ":my_player_no"),
          (player_get_team_no, ":my_team_no", ":my_player_no"),
          (assign, ":has_bots", 0),
          (try_begin),
            (eq,"$g_multiplayer_game_type",multiplayer_game_type_lords_battle),
            (assign, ":has_bots", 1),
          (else_try),
            (eq, ":my_team_no", 0),
            (try_begin),
              (neq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
              (gt, "$g_multiplayer_num_bots_team_1", 0),
              (assign, ":has_bots", 1),
            (try_end),
          (else_try),
            (try_begin),
              (gt, "$g_multiplayer_num_bots_team_2", 0),
              (assign, ":has_bots", 1),
            (try_end),
          (try_end),
          (team_get_faction, ":my_faction_no", ":my_team_no"),
          
          (try_begin),
            (eq, ":has_bots", 1),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_deathmatch),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_duel),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_thor),
            
            (assign, ":num_lines", 0),
            (try_begin),
              (eq, ":has_bots", 1),
              (try_for_range, ":ai_troop_no", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
                (store_troop_faction, ":ai_troop_faction", ":ai_troop_no"),
                (eq, ":ai_troop_faction", ":my_faction_no"),
                (call_script,"script_cf_is_not_special_troop",":ai_troop_no"),
                (assign,":stop",1),
                (try_begin),
                  (eq,"$g_multiplayer_game_type",multiplayer_game_type_lords_battle),
                  (call_script,"script_cf_lbt_skip_weak_infantry_troops",":ai_troop_no"),
                  (assign,":stop",0),
                (else_try),
                  (neq,"$g_multiplayer_game_type",multiplayer_game_type_lords_battle),
                  (assign,":stop",0),
                (try_end),
                (eq,":stop",0),
                (val_add, ":num_lines", 1),
              (try_end),
            (try_end),
            
            (store_mul, ":board_height", ":num_lines", 20),
            (val_add, ":board_height", 40),
            
            (create_mesh_overlay, reg0, "mesh_mp_ui_command_border_r"),
            (position_set_x, pos1, 280),
            (position_set_y, pos1, 680),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 2500),
            (position_set_y, pos1, 2500),
            (overlay_set_size, reg0, pos1),
            
            (create_mesh_overlay, reg0, "mesh_mp_ui_command_border_l"),
            (position_set_x, pos1, 650),
            (position_set_y, pos1, 680),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 2500),
            (position_set_y, pos1, 2500),
            (overlay_set_size, reg0, pos1),
            
            (create_mesh_overlay, reg0, "mesh_mp_ui_command_panel"),
            (position_set_x, pos1, 350),
            (store_sub, ":board_pos_y", 750, ":board_height"),
            (position_set_y, pos1, ":board_pos_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 3000),
            (position_set_y, pos1, 3000),
            (overlay_set_size, reg0, pos1),
            
            (try_begin), #chief capitan
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
              (multiplayer_get_my_troop, ":troop_no"),
              #          (neq, ":troop_no", ":selected_troop_no"),
              
              (this_or_next|eq, ":troop_no", "trp_norse_capitan"),
              (this_or_next|eq, ":troop_no", "trp_angle_capitan"),
              (this_or_next|eq, ":troop_no", "trp_briton_capitan"),
              (this_or_next|eq, ":troop_no", "trp_scotch_capitan"),
              (this_or_next|eq, ":troop_no", "trp_irish_capitan"),
              (eq, ":troop_no", "trp_saxon_capitan"),
              # (eq, ":troop_no", "trp_viking_merc"),
              (create_text_overlay, reg0, "str_buy_tropas", 0),
              
            (else_try),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
              (create_text_overlay, reg0, "str_nopuedes_comprar", 0),
              (val_sub, ":cur_y", 20),  #this string is two lines high
              
            (else_try),
              (create_text_overlay, reg0, "str_command", 0),
            (try_end), #chief capitan acaba
            
            (overlay_set_color, reg0, 0xFFFFFF),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 370),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            (val_sub, ":cur_y", 20),
            
            (try_begin),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle),
              (multiplayer_get_my_troop, ":troop_no"),
              (this_or_next|eq, ":troop_no", "trp_norse_capitan"),
              (this_or_next|eq, ":troop_no", "trp_saxon_capitan"),
              (this_or_next|eq, ":troop_no", "trp_angle_capitan"),
              (this_or_next|eq, ":troop_no", "trp_briton_capitan"),
              (this_or_next|eq, ":troop_no", "trp_irish_capitan"),
              (eq, ":troop_no", "trp_scotch_capitan"),
              (multiplayer_get_my_team,":team"),
              (try_begin),
                (eq, ":team", 0),
                (store_mul,reg2,"$g_multiplayer_battle_earnings_multiplier",10),
              (else_try),
                (store_mul,reg2,"$g_multiplayer_round_earnings_multiplier",10),
              (try_end),
              (create_text_overlay,reg1,"@Extra silver for troops: {reg2}", tf_left_align|tf_single_line|tf_with_outline),
              (overlay_set_color,reg1, 0xCCFFFF00),
              (position_set_x, pos1, 680),
              (position_set_y, pos1, 622),
              (overlay_set_position,reg1,pos1),
            (try_end),
            
            (assign, ":cur_ai_troop_index", 0),
            (try_for_range, ":ai_troop_no", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
              (store_troop_faction, ":ai_troop_faction", ":ai_troop_no"),
              (eq, ":ai_troop_faction", ":my_faction_no"),
              (call_script,"script_cf_is_not_special_troop",":ai_troop_no"),
              (assign,":stop",1),
              (try_begin),
                (eq,"$g_multiplayer_game_type",multiplayer_game_type_lords_battle),
                (call_script,"script_cf_lbt_skip_weak_infantry_troops",":ai_troop_no"),
                (assign,":stop",0),
              (else_try),
                (neq,"$g_multiplayer_game_type",multiplayer_game_type_lords_battle),
                (assign,":stop",0),
              (try_end),
              (eq,":stop",0),
              
              (try_begin), #chief capitan
                (eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
                (multiplayer_get_my_troop, ":troop_no"),
                #          (neq, ":troop_no", ":selected_troop_no"),
                
                (this_or_next|eq, ":troop_no", "trp_norse_capitan"),
                (this_or_next|eq, ":troop_no", "trp_angle_capitan"),
                (this_or_next|eq, ":troop_no", "trp_briton_capitan"),
                (this_or_next|eq, ":troop_no", "trp_scotch_capitan"),
                (this_or_next|eq, ":troop_no", "trp_irish_capitan"),
                (eq, ":troop_no", "trp_saxon_capitan"),
                # (eq, ":troop_no", "trp_viking_merc"),
                
                (create_check_box_overlay, reg0, "mesh_checkbox_off", "mesh_checkbox_on"),
                (position_set_x, pos1, 800),
                (position_set_y, pos1, 800),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, 377),
                (store_add, ":special_cur_y", ":cur_y", 2),
                (position_set_y, pos1, ":special_cur_y"),
                (overlay_set_position, reg0, pos1),
                (try_begin),
                  (eq, ":cur_ai_troop_index", 0),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_1_wanted"),
                  (assign, "$g_presentation_obj_item_select_13", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 1),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_2_wanted"),
                  (assign, "$g_presentation_obj_item_select_14", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 2),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_3_wanted"),
                  (assign, "$g_presentation_obj_item_select_15", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 3),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_4_wanted"),
                  (assign, "$g_presentation_obj_item_select_16", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 4),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_5_wanted"),
                  (assign, "$g_presentation_obj_item_select_17", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 5),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_6_wanted"),
                  (assign, "$g_presentation_obj_item_select_18", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 6),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_7_wanted"),
                  (assign, "$g_presentation_obj_item_select_19", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 7),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_8_wanted"),
                  (assign, "$g_presentation_obj_item_select_20", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 8),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_9_wanted"),
                  (assign, "$g_presentation_obj_item_select_21", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 9),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_10_wanted"),
                  (assign, "$g_presentation_obj_item_select_22", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 10),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_11_wanted"),
                  (assign, "$g_presentation_obj_item_select_23", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 11),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_12_wanted"),
                  (assign, "$g_presentation_obj_item_select_24", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 12),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_13_wanted"),
                  (assign, "$g_presentation_obj_item_select_25", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 13),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_14_wanted"),
                  (assign, "$g_presentation_obj_item_select_26", reg0),
                (else_try),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_15_wanted"),
                  (assign, "$g_presentation_obj_item_select_27", reg0),
                (try_end),
                
                (troop_get_slot, ":alt_desc", ":ai_troop_no", slot_troop_multi_desc),
                (try_begin),
                  (eq, ":alt_desc", 0),
                  (str_store_troop_name, s0, ":ai_troop_no"),
                (else_try),
                  (str_store_string, s0, ":alt_desc"),
                (try_end),
                (call_script,"script_lbt_get_troop_cost_to_reg1",":ai_troop_no"),
                (create_text_overlay, reg0, "@{s0} ({reg1}s)", 0),
                (overlay_set_color, reg0, 0xFFFFFF),
                (position_set_x, pos1, 800),
                (position_set_y, pos1, 800),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, 397),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
                (val_sub, ":cur_y", 20),
                (val_add, ":cur_ai_troop_index", 1),
              (try_end), #chief capitan acaba
              
              (try_begin),
                (neq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
                (create_check_box_overlay, reg0, "mesh_checkbox_off", "mesh_checkbox_on"),
                (position_set_x, pos1, 800),
                (position_set_y, pos1, 800),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, 377),
                (store_add, ":special_cur_y", ":cur_y", 2),
                (position_set_y, pos1, ":special_cur_y"),
                (overlay_set_position, reg0, pos1),
                (try_begin),
                  (eq, ":cur_ai_troop_index", 0),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_1_wanted"),
                  (assign, "$g_presentation_obj_item_select_13", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 1),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_2_wanted"),
                  (assign, "$g_presentation_obj_item_select_14", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 2),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_3_wanted"),
                  (assign, "$g_presentation_obj_item_select_15", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 3),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_4_wanted"),
                  (assign, "$g_presentation_obj_item_select_16", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 4),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_5_wanted"),
                  (assign, "$g_presentation_obj_item_select_17", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 5),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_6_wanted"),
                  (assign, "$g_presentation_obj_item_select_18", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 6),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_7_wanted"),
                  (assign, "$g_presentation_obj_item_select_19", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 7),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_8_wanted"),
                  (assign, "$g_presentation_obj_item_select_20", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 8),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_9_wanted"),
                  (assign, "$g_presentation_obj_item_select_21", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 9),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_10_wanted"),
                  (assign, "$g_presentation_obj_item_select_22", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 10),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_11_wanted"),
                  (assign, "$g_presentation_obj_item_select_23", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 11),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_12_wanted"),
                  (assign, "$g_presentation_obj_item_select_24", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 12),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_13_wanted"),
                  (assign, "$g_presentation_obj_item_select_25", reg0),
                (else_try),
                  (eq, ":cur_ai_troop_index", 13),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_14_wanted"),
                  (assign, "$g_presentation_obj_item_select_26", reg0),
                (else_try),
                  (overlay_set_val, reg0, "$g_multiplayer_bot_type_15_wanted"),
                  (assign, "$g_presentation_obj_item_select_27", reg0),
                (try_end),
                
                (troop_get_slot, ":alt_desc", ":ai_troop_no", slot_troop_multi_desc),
                (try_begin),
                  (eq, ":alt_desc", 0),
                  (str_store_troop_name, s0, ":ai_troop_no"),
                (else_try),
                  (str_store_string, s0, ":alt_desc"),
                (try_end),
                (create_text_overlay, reg0, "str_s0", 0),
                (overlay_set_color, reg0, 0xFFFFFF),
                (position_set_x, pos1, 800),
                (position_set_y, pos1, 800),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, 397),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
                (val_sub, ":cur_y", 20),
                (val_add, ":cur_ai_troop_index", 1),
              (try_end), #chief capitan acaba
              
            (try_end),
            (val_sub, ":cur_y", 20),
          (try_end),
          
          (multiplayer_get_my_player, ":my_player_no"),
          (player_get_gold, ":player_gold", ":my_player_no"),
          (call_script, "script_multiplayer_calculate_cur_selected_items_cost", ":my_player_no", 1),
          (create_text_overlay, "$g_presentation_obj_item_select_12", "str_total_item_cost_reg0", tf_left_align|tf_single_line|tf_with_outline),
          (try_begin),
            (ge, ":player_gold", reg0),
            (overlay_set_color, "$g_presentation_obj_item_select_12", 0xFFFFFF),
          (else_try),
            (overlay_set_color, "$g_presentation_obj_item_select_12", 0xFF0000),
          (try_end),
          (position_set_x, pos1, 680),
          (position_set_y, pos1, 652),
          (overlay_set_position, "$g_presentation_obj_item_select_12", pos1),
          
          (store_add, "$g_presentation_obj_item_select_next", "$g_presentation_obj_item_select_12", 1),
          
          (player_get_troop_id, ":my_troop_no", ":my_player_no"),
          (try_begin),
            (eq, "$g_presentation_state", 1),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_weapons_begin, multi_item_class_type_weapons_end, 781, 474),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_right_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 881),
            (position_set_y, pos1, 515),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (eq, "$g_presentation_state", 2),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_weapons_begin, multi_item_class_type_weapons_end, 781, 374),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_right_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 881),
            (position_set_y, pos1, 415),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (eq, "$g_presentation_state", 3),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_weapons_begin, multi_item_class_type_weapons_end, 781, 274),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_right_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 881),
            (position_set_y, pos1, 315),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (eq, "$g_presentation_state", 4),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_weapons_begin, multi_item_class_type_weapons_end, 781, 174),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_right_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 881),
            (position_set_y, pos1, 215),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (eq, "$g_presentation_state", 5),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_heads_begin, multi_item_class_type_heads_end, 117, 524),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 565),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (eq, "$g_presentation_state", 6),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_bodies_begin, multi_item_class_type_bodies_end, 117, 424),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 465),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (eq, "$g_presentation_state", 7),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_feet_begin, multi_item_class_type_feet_end, 117, 324),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 365),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (eq, "$g_presentation_state", 8),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_gloves_begin, multi_item_class_type_gloves_end, 117, 224),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 265),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (eq, "$g_presentation_state", 9),
            (eq, "$g_horses_are_avaliable", 1),
            (call_script, "script_multiplayer_display_available_items_for_troop_and_item_classes", ":my_troop_no", multi_item_class_type_horses_begin, multi_item_class_type_horses_end, 117, 124),
            (create_mesh_overlay, reg0, "mesh_mp_inventory_left_arrow"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 106),
            (position_set_y, pos1, 165),
            (overlay_set_position, reg0, pos1),
          (try_end),
          (presentation_set_duration, 999999),
      ]),
      
      (ti_on_presentation_mouse_enter_leave,
        [(store_trigger_param_1, ":object"),
          (store_trigger_param_2, ":enter_leave"),
          
          (try_begin),
            (eq, "$g_close_equipment_selection", 0),
            (try_begin),
              (eq, ":enter_leave", 0),
              
              (assign, ":item_no", -1),
              (try_begin),
                (ge, ":object", "$g_presentation_obj_item_select_next"),
                (store_sub, ":tested_object", ":object", "$g_presentation_obj_item_select_next"),
                (store_mod, ":mod_value", ":tested_object", 2),
                (store_sub, ":mod_value", 1, ":mod_value"),
                (val_div, ":tested_object", 2),
                (store_add, ":cur_slot", multi_data_item_button_indices_begin, ":tested_object"),
                (troop_get_slot, ":item_no", "trp_multiplayer_data", ":cur_slot"),
                
                (assign, ":target_obj", ":object"),
                (val_add, ":target_obj", ":mod_value"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_1"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 1),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_1"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_2"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 2),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_2"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_3"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 3),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_3"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_4"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 4),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_4"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_5"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 5),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_5"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_6"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 6),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_6"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_7"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 7),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_7"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_8"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 8),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_8"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_9"),
                (eq, "$g_horses_are_avaliable", 1),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 9),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_9"),
              (try_end),
              
              (try_begin),
                (ge, ":item_no", 0),
                (overlay_get_position, pos0, ":target_obj"),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_troop_id, ":my_player_troop_no", ":my_player_no"),
                (try_begin),
                  (call_script, "script_cf_multiplayer_is_item_default_for_troop", ":item_no", ":my_player_troop_no"),
                  (show_item_details, ":item_no", pos0, 0),
                (else_try),
                  (store_troop_faction, ":my_player_faction_no", ":my_player_troop_no"),
                  (store_sub, ":faction_slot", ":my_player_faction_no", mp_factions_begin),
                  (val_add, ":faction_slot", slot_item_multiplayer_faction_price_multipliers_begin),
                  (item_get_slot, ":price_multiplier", ":item_no", ":faction_slot"),
                  (show_item_details, ":item_no", pos0, ":price_multiplier"),
                (try_end),
                (assign, "$g_current_opened_item_details", ":item_no"),
              (try_end),
            (else_try),
              (assign, ":item_no", -1),
              (try_begin),
                (ge, ":object", "$g_presentation_obj_item_select_next"),
                (store_sub, ":tested_object", ":object", "$g_presentation_obj_item_select_next"),
                (val_div, ":tested_object", 2),
                (store_add, ":cur_slot", multi_data_item_button_indices_begin, ":tested_object"),
                (troop_get_slot, ":item_no", "trp_multiplayer_data", ":cur_slot"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_1"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 1),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_1"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_2"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 2),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_2"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_3"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 3),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_3"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_4"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 4),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_4"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_5"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 5),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_5"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_6"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 6),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_6"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_7"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 7),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_7"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_8"),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 8),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_8"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_9"),
                (eq, "$g_horses_are_avaliable", 1),
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, 9),
                (val_sub, ":player_slot_index", 1),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_slot, ":item_no", ":my_player_no", ":player_slot_index"),
                (assign, ":target_obj", "$g_inside_obj_9"),
              (try_end),
              
              (try_begin),
                (eq, "$g_current_opened_item_details", ":item_no"),
                (close_item_details),
                (assign, "$g_current_opened_item_details", -1),
              (try_end),
            (try_end),
          (else_try),
            (assign, "$g_close_equipment_selection", 0),
            (presentation_set_duration, 0),
          (try_end),
      ]),
      
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (store_trigger_param_2, ":value"),
          (multiplayer_get_my_player, ":my_player_no"),
          (player_get_troop_id, ":my_troop_no", ":my_player_no"),
          
          (try_begin),
            (eq, "$g_close_equipment_selection", 0),
            (try_begin),
              (eq, "$g_presentation_state", 0),
              (try_begin),
                (eq, ":object", "$g_presentation_obj_item_select_1"),
                (assign, "$g_presentation_state", 1),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_2"),
                (assign, "$g_presentation_state", 2),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_3"),
                (assign, "$g_presentation_state", 3),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_4"),
                (assign, "$g_presentation_state", 4),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_5"),
                (assign, "$g_presentation_state", 5),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_6"),
                (assign, "$g_presentation_state", 6),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_7"),
                (assign, "$g_presentation_state", 7),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_8"),
                (assign, "$g_presentation_state", 8),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (else_try),
                (eq, ":object", "$g_presentation_obj_item_select_9"),
                (eq, "$g_horses_are_avaliable", 1),
                (assign, "$g_presentation_state", 9),
                (presentation_set_duration, 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (try_end),
            (else_try),
              (gt, "$g_presentation_state", 0),
              (store_sub, ":tested_object", ":object", "$g_presentation_obj_item_select_next"),
              (val_div, ":tested_object", 2),
              (assign, ":end_cond", multi_data_item_button_indices_end),
              (try_for_range, ":cur_slot", multi_data_item_button_indices_begin, ":end_cond"),
                (neg|troop_slot_eq, "trp_multiplayer_data", ":cur_slot", -1),
                (store_sub, ":button_id", ":cur_slot", multi_data_item_button_indices_begin),
                (eq, ":tested_object", ":button_id"),
                (troop_get_slot, ":item_no", "trp_multiplayer_data", ":cur_slot"),
                
                (store_add, ":player_slot_index", slot_player_selected_item_indices_begin, "$g_presentation_state"),
                (val_sub, ":player_slot_index", 1),
                (player_set_slot, ":my_player_no", ":player_slot_index", ":item_no"),
                
                (player_get_gold, ":player_gold", ":my_player_no"),
                (call_script, "script_multiplayer_calculate_cur_selected_items_cost", ":my_player_no", 1),
                (overlay_set_text, "$g_presentation_obj_item_select_12", "str_total_item_cost_reg0"),
                (try_begin),
                  (ge, ":player_gold", reg0),
                  (overlay_set_color, "$g_presentation_obj_item_select_12", 0xFFFFFF),
                (else_try),
                  (overlay_set_color, "$g_presentation_obj_item_select_12", 0xFF0000),
                (try_end),
                
                (assign, ":end_cond", 0), #break
              (try_end),
              (presentation_set_duration, 0),
              (assign, "$g_presentation_state", 0),
              (start_presentation, "prsnt_multiplayer_item_select"),
            (try_end),
            (try_begin),
              (eq, ":object", "$g_presentation_obj_item_select_10"),
              (call_script, "script_multiplayer_set_default_item_selections_for_troop", ":my_troop_no"),
              (presentation_set_duration, 0),
              (assign, "$g_presentation_state", 0),
              (start_presentation, "prsnt_multiplayer_item_select"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_11"),
              (call_script, "script_multiplayer_send_item_selections"),
              (presentation_set_duration, 0),
              
              (try_begin),
                (try_begin),
                  (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
                  (gt, "$g_multiplayer_number_of_respawn_count", 0),
                  
                  (ge, "$g_my_spawn_count", "$g_multiplayer_number_of_respawn_count"),
                  
                  (multiplayer_get_my_player, ":my_player_no"),
                  (player_get_team_no, ":my_player_team", ":my_player_no"),
                  
                  (this_or_next|eq, ":my_player_team", 0),
                  (ge, "$g_my_spawn_count", 999),
                  
                  (assign, "$g_show_no_more_respawns_remained", 1),
                (else_try),
                  (assign, "$g_show_no_more_respawns_remained", 0),
                (try_end),
                
                (eq, "$g_show_no_more_respawns_remained", 1),
                
                (store_mission_timer_a, "$g_multiplayer_respawn_start_time"),
                (start_presentation, "prsnt_multiplayer_respawn_time_counter"),
              (try_end),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_13"),
              (assign, "$g_multiplayer_bot_type_1_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_1_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_14"),
              (assign, "$g_multiplayer_bot_type_2_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_2_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_15"),
              (assign, "$g_multiplayer_bot_type_3_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_3_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_16"),
              (assign, "$g_multiplayer_bot_type_4_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_4_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_17"),
              (assign, "$g_multiplayer_bot_type_5_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_5_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_18"),
              (assign, "$g_multiplayer_bot_type_6_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_6_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_19"),
              (assign, "$g_multiplayer_bot_type_7_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_7_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_20"),
              (assign, "$g_multiplayer_bot_type_8_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_8_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_21"),
              (assign, "$g_multiplayer_bot_type_9_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_9_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_22"),
              (assign, "$g_multiplayer_bot_type_10_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_10_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_23"),
              (assign, "$g_multiplayer_bot_type_11_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_11_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_24"),
              (assign, "$g_multiplayer_bot_type_12_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_12_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_25"),
              (assign, "$g_multiplayer_bot_type_13_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_13_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_26"),
              (assign, "$g_multiplayer_bot_type_14_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_14_wanted, ":value"),
            (else_try),
              (eq, ":object", "$g_presentation_obj_item_select_27"),
              (assign, "$g_multiplayer_bot_type_15_wanted", ":value"),
              (multiplayer_send_2_int_to_server, multiplayer_event_set_bot_selection, slot_player_bot_type_15_wanted, ":value"),
            (try_end),
          (else_try),
            (assign, "$g_close_equipment_selection", 0),
            (presentation_set_duration, 0),
          (try_end),
      ]),
      
      (ti_on_presentation_mouse_press,
        [(store_trigger_param_1, ":object"),
          (store_trigger_param_2, ":mouse_state"),
          
          (try_begin),
            (eq, "$g_close_equipment_selection", 0),
            (try_begin),
              (eq, ":mouse_state", 1), #right click (clears the item slot)
              (try_begin),
                (eq, "$g_presentation_state", 0),
                (multiplayer_get_my_player, ":my_player_no"),
                (try_begin),
                  (eq, ":object", "$g_presentation_obj_item_select_1"),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 0),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                  (eq, ":object", "$g_presentation_obj_item_select_2"),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 1),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                  (eq, ":object", "$g_presentation_obj_item_select_3"),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 2),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                  (eq, ":object", "$g_presentation_obj_item_select_4"),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 3),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                  (eq, ":object", "$g_presentation_obj_item_select_5"),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 4),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                  (eq, ":object", "$g_presentation_obj_item_select_6"),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 5),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                  (eq, ":object", "$g_presentation_obj_item_select_7"),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 6),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                  (eq, ":object", "$g_presentation_obj_item_select_8"),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 7),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (else_try),
                  (eq, ":object", "$g_presentation_obj_item_select_9"),
                  (eq, "$g_horses_are_avaliable", 1),
                  (store_add, ":selected_item_index", slot_player_selected_item_indices_begin, 8),
                  (player_set_slot, ":my_player_no", ":selected_item_index", -1),
                  (presentation_set_duration, 0),
                  (assign, "$g_presentation_state", 0),
                  (start_presentation, "prsnt_multiplayer_item_select"),
                (try_end),
              (else_try),
                (gt, "$g_presentation_state", 0),
                (presentation_set_duration, 0),
                (assign, "$g_presentation_state", 0),
                (start_presentation, "prsnt_multiplayer_item_select"),
              (try_end),
            (try_end),
          (else_try),
            (assign, "$g_close_equipment_selection", 0),
            (presentation_set_duration, 0),
          (try_end),
      ]),
      
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          
          ## this causes an error sometimes
          ##      (multiplayer_get_my_player, ":my_player_no"),
          ##      (player_get_gold, ":player_gold", ":my_player_no"),
          ##      (call_script, "script_multiplayer_calculate_cur_selected_items_cost", ":my_player_no", 1),
          ##      (try_begin),
          ##        (ge, ":player_gold", reg0),
          ##        (overlay_set_color, "$g_presentation_obj_item_select_12", 0xFFFFFF),
          ##      (else_try),
          ##        (overlay_set_color, "$g_presentation_obj_item_select_12", 0xFF0000),
          ##      (try_end),
          
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (multiplayer_get_my_team,":team_no"),
            (eq,":team_no",1),
            (presentation_set_duration, 0),
          (try_end),
          (try_begin),
            (eq, "$g_close_equipment_selection", 0),
            (try_begin),
              (this_or_next|key_clicked, key_escape),
              (key_clicked, key_pad_start),
              (try_begin),
                (neq, "$g_current_opened_item_details", -1),
                (close_item_details),
                (assign, "$g_current_opened_item_details", -1),
              (try_end),
              (gt, ":cur_time", 200),
              (presentation_set_duration, 0),
            (try_end),
          (else_try),
            (assign, "$g_close_equipment_selection", 0),
            #daha sonra buraya siege modundaysa ve takimini yeni degistirdigi icin spawn olamiyorsa start_presentation, spawn_counter satirini ekle sdsd.
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_message_1", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          (try_begin),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_round_result_in_battle_mode),
            (assign, ":winner_agent_team", "$g_multiplayer_message_value_1"),
            
            (try_begin),
              (eq, ":winner_agent_team", -1),
              (assign, ":text_font_color", 0xFFFFFFFF),
              
              (str_store_string, s0, "str_round_draw_no_one_remained"),
            (else_try),
              (try_begin), #for spectators initializing, we assume spectators are fan of team0 so coloring is applied as they are at team0.
                (eq, ":winner_agent_team", 0),
                (assign, ":text_font_color", 0xFF33DD11),
              (else_try),
                (assign, ":text_font_color", 0xFFFF4422),
              (try_end), #initializing ends
              (try_begin),
                (lt, "$my_team_at_start_of_round", 2),
                (try_begin),
                  (eq, "$my_team_at_start_of_round", ":winner_agent_team"),
                  (assign, ":text_font_color", 0xFF33DD11),
                (else_try),
                  (assign, ":text_font_color", 0xFFFF4422),
                (try_end),
              (try_end),
              
              (team_get_faction, ":faction_of_winner_team", ":winner_agent_team"),
              (str_store_faction_name, s1, ":faction_of_winner_team"),
              (str_store_string, s0, "str_s1_won_round"),
            (try_end),
            
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (try_begin),
              (neq, ":winner_agent_team", -1),
              (position_set_x, pos1, 375), #375
            (else_try),
              (position_set_x, pos1, 400), #400
            (try_end),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 300),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_capture_the_flag_score),
            
            (agent_get_team, ":winner_agent_team", "$g_multiplayer_message_value_1"), #assign given agent's team to winner agent team.
            (team_get_faction, ":winner_agent_faction", ":winner_agent_team"),
            (str_store_faction_name, s1, ":winner_agent_faction"),
            
            (try_begin), #for spectators initializing, we assume spectators are fan of team0 so coloring is applied as they are at team0.
              (eq, ":winner_agent_team", 0),
              (assign, ":text_font_color", 0xFF33DD11),
            (else_try),
              (assign, ":text_font_color", 0xFFFF4422),
            (try_end), #initializing ends
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_agent_id, ":my_player_agent", ":my_player_no"),
              (try_begin),
                (ge, ":my_player_agent", 0),
                (agent_get_team, ":my_player_team", ":my_player_agent"),
                (try_begin),
                  (eq, ":my_player_team", ":winner_agent_team"),
                  (assign, ":text_font_color", 0xFF33DD11),
                  (play_sound, "snd_team_scored_a_point"),
                (else_try),
                  (assign, ":text_font_color", 0xFFFF4422),
                  (play_sound, "snd_enemy_scored_a_point"),
                (try_end),
              (try_end),
            (try_end),
            
            (str_store_string, s0, "str_s1_captured_flag"),
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_flag_returned_home),
            
            (try_begin),
              (ge, "$g_multiplayer_message_value_1", 0),
              (agent_get_team, ":returned_flag_agent_team", "$g_multiplayer_message_value_1"),
              (team_get_faction, ":returned_flag_agent_faction", ":returned_flag_agent_team"),
              (str_store_faction_name, s1, ":returned_flag_agent_faction"),
              (str_store_string, s0, "str_s1_returned_flag"),
            (else_try),
              (val_add, "$g_multiplayer_message_value_1", 1),
              (val_mul, "$g_multiplayer_message_value_1", -1),
              (assign, ":returned_flag_agent_team", "$g_multiplayer_message_value_1"),
              (team_get_faction, ":returned_flag_agent_faction", ":returned_flag_agent_team"),
              (str_store_faction_name, s1, ":returned_flag_agent_faction"),
              (str_store_string, s0, "str_s1_auto_returned_flag"),
            (try_end),
            
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_agent_id, ":my_player_agent", ":my_player_no"),
              (try_begin),
                (ge, ":my_player_agent", 0),
                (play_sound, "snd_flag_returned"),
              (try_end),
            (try_end),
            (assign, ":text_font_color", 0xFFFFFFFF),
            
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 325),
            (position_set_y, pos1, 400),
            (position_set_x, pos1, 500), #new
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_capture_the_flag_stole),
            
            (agent_get_team, ":stolen_flag_agent_team", "$g_multiplayer_message_value_1"),
            (team_get_faction, ":stolen_flag_agent_faction", ":stolen_flag_agent_team"),
            (str_store_faction_name, s1, ":stolen_flag_agent_faction"),
            
            (assign, ":text_font_color", 0xFFFFFFFF),
            
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_agent_id, ":my_player_agent", ":my_player_no"),
              (try_begin),
                (ge, ":my_player_agent", 0),
                (agent_get_team, ":my_player_team", ":my_player_agent"),
                (try_begin),
                  (eq, ":my_player_team", ":stolen_flag_agent_team"),
                  (play_sound, "snd_enemy_flag_taken"),
                (else_try),
                  (play_sound, "snd_your_flag_taken"),
                (try_end),
              (try_end),
            (try_end),
            
            (str_store_string, s0, "str_s1_taken_flag"),
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 365),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_flag_captured),
            
            (store_div, ":winner_agent_team", "$g_multiplayer_message_value_1", 100),
            (store_mod, reg0, "$g_multiplayer_message_value_1", 100),
            (val_sub, ":winner_agent_team", 1),
            
            (try_begin), #for spectators initializing, we assume spectators are fan of team0 so coloring is applied as they are at team0.
              (eq, ":winner_agent_team", 0),
              (assign, ":text_font_color", 0xFF33DD11),
            (else_try),
              (assign, ":text_font_color", 0xFFFF4422),
            (try_end), #initializing ends
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_agent_id, ":my_player_agent", ":my_player_no"),
              (try_begin),
                (ge, ":my_player_agent", 0),
                (agent_get_team, ":my_player_team", ":my_player_agent"),
                (try_begin),
                  (eq, ":my_player_team", ":winner_agent_team"),
                  (assign, ":text_font_color", 0xFF33DD11),
                  (play_sound, "snd_team_scored_a_point"),
                (else_try),
                  (assign, ":text_font_color", 0xFFFF4422),
                  (play_sound, "snd_enemy_scored_a_point"),
                (try_end),
              (try_end),
            (try_end),
            
            (team_get_faction, ":winner_agent_faction", ":winner_agent_team"),
            (str_store_faction_name, s1, ":winner_agent_faction"),
            
            (str_store_string, s0, "str_s1_captured_flag_reg0"),
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 345),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_flag_is_pulling),
            
            (store_div, ":winner_agent_team", "$g_multiplayer_message_value_1", 100),
            (store_mod, reg0, "$g_multiplayer_message_value_1", 100),
            (val_sub, ":winner_agent_team", 1),
            
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_agent_id, ":my_player_agent", ":my_player_no"),
              (try_begin),
                (ge, ":my_player_agent", 0),
                (agent_get_team, ":my_player_team", ":my_player_agent"),
                (try_begin),
                  (eq, ":my_player_team", ":winner_agent_team"),
                  (play_sound, "snd_enemy_flag_taken"),
                (else_try),
                  (play_sound, "snd_your_flag_taken"),
                (try_end),
              (try_end),
            (try_end),
            
            (assign, ":text_font_color", 0xFFFFFFFF),
            
            (team_get_faction, ":winner_agent_faction", ":winner_agent_team"),
            (str_store_faction_name, s1, ":winner_agent_faction"),
            
            (str_store_string, s0, "str_s1_pulling_flag_reg0"),
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 345),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_flag_neutralized),
            
            (store_div, ":winner_agent_team", "$g_multiplayer_message_value_1", 100),
            (store_mod, reg0, "$g_multiplayer_message_value_1", 100),
            (val_sub, ":winner_agent_team", 1),
            
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_agent_id, ":my_player_agent", ":my_player_no"),
              (try_begin),
                (ge, ":my_player_agent", 0),
                (play_sound, "snd_flag_returned"),
              (try_end),
            (try_end),
            
            (try_begin), #for spectators initializing, we assume spectators are fan of team0 so coloring is applied as they are at team0.
              (eq, ":winner_agent_team", 0),
              (assign, ":text_font_color", 0xFF33DD11),
            (else_try),
              (assign, ":text_font_color", 0xFFFF4422),
            (try_end), #initializing ends
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_agent_id, ":my_player_agent", ":my_player_no"),
              (try_begin),
                (ge, ":my_player_agent", 0),
                (agent_get_team, ":my_player_team", ":my_player_agent"),
                (try_begin),
                  (eq, ":my_player_team", ":winner_agent_team"),
                  (assign, ":text_font_color", 0xFF33DD11),
                (else_try),
                  (assign, ":text_font_color", 0xFFFF4422),
                (try_end),
              (try_end),
            (try_end),
            
            (team_get_faction, ":winner_agent_faction", ":winner_agent_team"),
            (str_store_faction_name, s1, ":winner_agent_faction"),
            
            (str_store_string, s0, "str_s1_neutralized_flag_reg0"),
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 345),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_round_result_in_siege_mode),
            
            (assign, ":winner_agent_team", "$g_multiplayer_message_value_1"),
            
            (try_begin), #for spectators initializing, we assume spectators are fan of team0 so coloring is applied as they are at team0.
              (eq, ":winner_agent_team", 0),
              (assign, ":text_font_color", 0xFF33DD11),
            (else_try),
              (assign, ":text_font_color", 0xFFFF4422),
            (try_end), #initializing ends
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_agent_id, ":my_player_agent", ":my_player_no"),
              (try_begin),
                (ge, ":my_player_agent", 0),
                (agent_get_team, ":my_player_team", ":my_player_agent"),
                (try_begin),
                  (eq, ":my_player_team", ":winner_agent_team"),
                  (assign, ":text_font_color", 0xFF33DD11),
                (else_try),
                  (assign, ":text_font_color", 0xFFFF4422),
                (try_end),
              (try_end),
            (try_end),
            
            (try_begin),
              (eq, "$g_multiplayer_message_value_1", 0),
              (str_store_string, s0, "str_s1_defended_castle"),
            (else_try),
              (eq, "$g_multiplayer_message_value_1", 1),
              (str_store_string, s0, "str_s1_captured_castle"),
            (else_try),
              (str_store_string, s0, "str_round_draw"),
              (assign, ":text_font_color", 0xFFFFFFFF),
            (try_end),
            
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (try_begin),
              (neq, "$g_multiplayer_message_value_1", -1),
              (position_set_x, pos1, 325),
            (else_try),
              (position_set_x, pos1, 400),
            (try_end),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_round_draw),
            
            (assign, ":text_font_color", 0xFFFFFFFF),
            (str_store_string, s0, "str_round_draw"),
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 375),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_start_death_mode),
            
            (assign, ":text_font_color", 0xFFFFFFFF),
            (str_store_string, s0, "str_death_mode_started"),
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_start_capitan_mode), #chief capitan
            (assign, ":text_font_color", 0xFFFFFFFF),
            
            (try_begin),
              (eq, "$g_round_tropas", 0), #chief capitan
              (str_store_string, s1, "str_capitan_mode_started"),
              (presentation_set_duration, 600),
            (else_try),
              #(eq, "$g_round_tropas", 1), #chief capitan
              (str_store_string, s1, "str_capitan_mode_started2"),
              (presentation_set_duration, 400),
            (try_end),
            
            (create_text_overlay, "$g_multiplayer_message_1", s1, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_target_destroyed),
            
            (try_begin),
              (lt, "$g_multiplayer_message_value_1", 0),
              (val_mul, "$g_multiplayer_message_value_1", -1),
              (assign, ":scene_prop_team", 0),
              
              (team_get_faction, ":faction_of_winner_team", 1),
              (str_store_faction_name, s1, ":faction_of_winner_team"),
            (else_try),
              (assign, ":scene_prop_team", 1),
              
              (team_get_faction, ":faction_of_winner_team", 0),
              (str_store_faction_name, s1, ":faction_of_winner_team"),
            (try_end),
            
            (try_begin), #for spectators initializing, we assume spectators are fan of team0 so coloring is applied as they are at team0.
              (eq, "$g_multiplayer_message_value_1", 1),
              (assign, ":text_font_color", 0xFF33DD11),
            (else_try),
              (assign, ":text_font_color", 0xFFFF4422),
            (try_end), #initializing ends
            (multiplayer_get_my_player, ":my_player_no"),
            (try_begin),
              (ge, ":my_player_no", 0),
              (try_begin),
                (multiplayer_get_my_player, ":my_player_no"),
                (player_get_team_no, ":my_team_no", ":my_player_no"),
                (neq, ":scene_prop_team", ":my_team_no"), #if scene prop and I have different teams this means we won
                (assign, ":text_font_color", 0xFF33DD11),
              (else_try),
                (assign, ":text_font_color", 0xFFFF4422),
              (try_end),
            (try_end),
            
            (try_begin),
              (eq, "$g_multiplayer_message_value_1", 9),
              (str_store_string, s0, "str_s1_destroyed_all_targets"),
            (else_try),
              (eq, "$g_multiplayer_message_value_1", 1),
              (str_store_string, s0, "str_s1_destroyed_catapult"),
            (else_try),
              (eq, "$g_multiplayer_message_value_1", 2),
              (str_store_string, s0, "str_s1_destroyed_trebuchet"),
            (try_end),
            
            (create_text_overlay, "$g_multiplayer_message_1", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_1", ":text_font_color"),
            (position_set_x, pos1, 350),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 400),
            (overlay_set_position, "$g_multiplayer_message_1", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_1", pos1),
            (presentation_set_duration, 400),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [
      ]),
  ]),
  
  ("multiplayer_message_2", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          (try_begin),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_auto_team_balance_done),
            (assign, ":text_font_color", 0xFFFFFFFF),
            (str_store_string, s0, "str_auto_team_balance_done"),
            (create_text_overlay, "$g_multiplayer_message_2", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_2", ":text_font_color"),
            (position_set_x, pos1, 375),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 550),
            (overlay_set_position, "$g_multiplayer_message_2", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_2", pos1),
            (presentation_set_duration, 300),
          (else_try),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_auto_team_balance_next),
            (assign, ":text_font_color", 0xFFFFFFFF),
            
            (try_begin),
              (neq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
              (neq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
              (neq, "$g_multiplayer_game_type", multiplayer_game_type_sea),#naval battles
              (neq, "$g_multiplayer_game_type", multiplayer_game_type_raid),
              (neq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle), #chief capitan
              (neq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
              (str_store_string, s0, "str_auto_team_balance_in_20_seconds"),
              (position_set_x, pos1, 375),
            (else_try),
              (str_store_string, s0, "str_auto_team_balance_next_round"),
              (position_set_x, pos1, 375),
            (try_end),
            
            (create_text_overlay, "$g_multiplayer_message_2", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_2", ":text_font_color"),
            (position_set_y, pos1, 550),
            (position_set_x, pos1, 500), #new
            (overlay_set_position, "$g_multiplayer_message_2", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_2", pos1),
            (presentation_set_duration, 300),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [
      ]),
  ]),
  
  ("multiplayer_message_3", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          (try_begin),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_poll_result),
            
            (assign, ":text_font_color", 0xFFFFFFFF),
            (try_begin),
              (eq, "$g_multiplayer_message_value_3", 1),
              (str_store_string, s0, "str_poll_result_yes"),
            (else_try),
              (str_store_string, s0, "str_poll_result_no"),
            (try_end),
            (create_text_overlay, "$g_multiplayer_message_3", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_message_3", ":text_font_color"),
            (position_set_x, pos1, 380),
            (position_set_x, pos1, 500), #new
            (position_set_y, pos1, 475),
            (overlay_set_position, "$g_multiplayer_message_3", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_message_3", pos1),
            (presentation_set_duration, 400),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [
      ]),
  ]),
  
  ("multiplayer_message_champion", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          (assign, ":text_font_color", 0xffff22),
          (assign,":new_champion","$g_multiplayer_message_type"),
          
          (try_begin),
            (eq, "$temp", 1),
            (try_begin),
              (neg|agent_is_active,":new_champion"),
              (str_store_string,s0,"@Thor's champion has been killed!"),
              (assign, ":text_font_color", 0xFF4444),
            (else_try),
              (get_player_agent_no,":my_agent"),
              (try_begin),
                (eq,":my_agent",":new_champion"),
                (str_store_string,s0,"@You have killed the champion and gained Thor's favour!"),
                (assign, "$is_berserk", 0),
                (assign, ":text_font_color", 0x44FF44),
                (mission_cam_set_screen_color, 0xCCFFFFFF),
                (mission_cam_animate_to_screen_color,0x00000000,1500),
              (else_try),
                (agent_get_player_id,":player",":new_champion"),
                (try_begin),
                  (player_is_active,":player"),
                  (str_store_player_username,s1,":player"),
                (else_try),
                  (agent_get_troop_id,":troop",":new_champion"),
                  (str_store_troop_name,s1,":troop"),
                (try_end),
                (str_store_string,s0,"@{s1} has killed the Champion and gained Thor's favour!"),
              (try_end),
            (try_end),
          (else_try),
            (agent_get_troop_id,":troop",":new_champion"),
            (str_store_troop_name,s1,":troop"),
            (str_store_string,s0,"@Thor has chosen {s1} as his new champion!"),
          (try_end),
          
          (create_text_overlay, "$g_multiplayer_message_2", s0, tf_center_justify|tf_with_outline),
          (overlay_set_color, "$g_multiplayer_message_2", ":text_font_color"),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 350),
          (overlay_set_position, "$g_multiplayer_message_2", pos1),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_multiplayer_message_2", pos1),
          (presentation_set_duration, 500),
      ]),
      (ti_on_presentation_run,[]),
  ]),
  
  ("multiplayer_round_time_counter", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          (assign, "$g_multiplayer_last_round_time_counter_value", -1),
          (str_clear, s0),
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (create_text_overlay, "$g_multiplayer_round_time_counter_overlay", s0, tf_center_justify|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_round_time_counter_overlay", 0xFFFFFF),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 600),
            (overlay_set_position, "$g_multiplayer_round_time_counter_overlay", pos1),
            (position_set_x, pos1, 1500),
            (position_set_y, pos1, 1500),
            (overlay_set_size, "$g_multiplayer_round_time_counter_overlay", pos1),
          (else_try),
            (create_text_overlay, "$g_multiplayer_round_time_counter_overlay", s0, tf_left_align|tf_single_line|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_round_time_counter_overlay", 0xFFFFFF),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 690),
            (overlay_set_position, "$g_multiplayer_round_time_counter_overlay", pos1),
            (position_set_x, pos1, 2000),
            (position_set_y, pos1, 2000),
            (overlay_set_size, "$g_multiplayer_round_time_counter_overlay", pos1),
          (try_end),
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_run,[
          (store_mission_timer_a, ":current_time"),
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (try_begin),
              (eq,"$g_multiplayer_invasion_wave_number",-1),
              (str_store_string, s0, "@^^Congratulations!^^You have survived the invasion!"),
              (overlay_set_text, "$g_multiplayer_round_time_counter_overlay", s0),
              (position_set_x, pos1, 500),
              (position_set_y, pos1, 450),
              (overlay_set_position, "$g_multiplayer_round_time_counter_overlay", pos1),
            (else_try),
              (neq,"$g_multiplayer_invasion_wave_time",-1),
              (store_sub, ":seconds_left_in_round", "$g_multiplayer_invasion_wave_time", ":current_time"),
              (val_max, ":seconds_left_in_round", 0),
              (try_begin),
                (neq, "$g_multiplayer_last_round_time_counter_value", ":seconds_left_in_round"),
                (assign, "$g_multiplayer_last_round_time_counter_value", ":seconds_left_in_round"),
                (multiplayer_get_my_player,":player"),
                (player_get_agent_id,":agent",":player"),
                (try_begin),
                  (store_sub,":time",":current_time","$g_round_start_time"),
                  (le,":time",5),
                  (str_clear,s0),
                (else_try),
                  (agent_is_active,":agent"),
                  (agent_is_alive,":agent"),
                  (str_store_string, s0, "@New enemies are coming!^Prepare yourself!"),
                (else_try),
                  (store_div, reg0, ":seconds_left_in_round", 60),
                  (store_div, reg1, ":seconds_left_in_round", 10),
                  (val_mod, reg1, 6),
                  (assign, reg2, ":seconds_left_in_round"),
                  (val_mod, reg2, 10),
                  (str_store_string, s0, "@{reg0}:{reg1}{reg2} until the next enemy wave."),
                (try_end),
                (overlay_set_text, "$g_multiplayer_round_time_counter_overlay", s0),
              (try_end),
            (else_try),
              (str_store_string, s0, "str_empty_string"),
              (overlay_set_text, "$g_multiplayer_round_time_counter_overlay", s0),
            (try_end),
          (else_try),
            (store_sub, ":seconds_past_in_round", ":current_time", "$g_round_start_time"),
            (store_sub, ":seconds_left_in_round", "$g_multiplayer_round_max_seconds", ":seconds_past_in_round"),
            (val_max, ":seconds_left_in_round", 0),
            (try_begin),
              (neq, "$g_multiplayer_last_round_time_counter_value", ":seconds_left_in_round"),
              (assign, "$g_multiplayer_last_round_time_counter_value", ":seconds_left_in_round"),
              (store_div, reg0, ":seconds_left_in_round", 60),
              (store_div, reg1, ":seconds_left_in_round", 10),
              (val_mod, reg1, 6),
              (assign, reg2, ":seconds_left_in_round"),
              (val_mod, reg2, 10),
              (str_store_string, s0, "str_reg0_dd_reg1reg2"),
              (overlay_set_text, "$g_multiplayer_round_time_counter_overlay", s0),
            (try_end),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_team_score_display", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          (assign, "$g_multiplayer_team_1_last_displayed_score", -1),
          (assign, "$g_multiplayer_team_2_last_displayed_score", -1),
          (str_clear, s0),
          (create_text_overlay, "$g_multiplayer_team_1_score_display_overlay", s0, tf_left_align|tf_single_line|tf_with_outline),
          (overlay_set_color, "$g_multiplayer_team_1_score_display_overlay", 0xFFFFFF),
          (position_set_x, pos1, 40),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_multiplayer_team_1_score_display_overlay", pos1),
          (position_set_x, pos1, 1500),
          (position_set_y, pos1, 1500),
          (overlay_set_size, "$g_multiplayer_team_1_score_display_overlay", pos1),
          
          (try_begin),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (create_text_overlay, "$g_multiplayer_team_2_score_display_overlay", s0, tf_left_align|tf_single_line|tf_with_outline),
            (overlay_set_color, "$g_multiplayer_team_2_score_display_overlay", 0xFFFFFF),
            (position_set_x, pos1, 40),
            (position_set_y, pos1, 645),
            (overlay_set_position, "$g_multiplayer_team_2_score_display_overlay", pos1),
            (position_set_x, pos1, 1500),
            (position_set_y, pos1, 1500),
            (overlay_set_size, "$g_multiplayer_team_2_score_display_overlay", pos1),
          (try_end),
          
          (try_begin),
            (eq, "$g_multiplayer_team_1_faction", "fac_culture_norse"),
            (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_1"),
          (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_culture_saxon"),
            (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_2"),
          (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_culture_angle"),
            (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_3"),
          (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_culture_welsh"),
            (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_4"),
          (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_culture_irish"),
            (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_5"),
          (else_try),
            (eq, "$g_multiplayer_team_1_faction", "fac_culture_scotch"),
            (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_6"),
          (try_end),
          
          (position_set_x, pos3, 25),
          (position_set_y, pos3, 715),
          (overlay_set_position, reg0, pos3),
          (position_set_x, pos1, 50),
          (position_set_y, pos1, 50),
          (overlay_set_size, reg0, pos1),
          
          (try_begin),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (try_begin),
              (eq, "$g_multiplayer_team_1_faction", "$g_multiplayer_team_2_faction"),
              (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_rebel"),
            (else_try),
              (eq, "$g_multiplayer_team_2_faction", "fac_culture_norse"),
              (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_1"),
            (else_try),
              (eq, "$g_multiplayer_team_2_faction", "fac_culture_saxon"),
              (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_2"),
            (else_try),
              (eq, "$g_multiplayer_team_2_faction", "fac_culture_angle"),
              (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_3"),
            (else_try),
              (eq, "$g_multiplayer_team_2_faction", "fac_culture_welsh"),
              (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_4"),
            (else_try),
              (eq, "$g_multiplayer_team_2_faction", "fac_culture_irish"),
              (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_5"),
            (else_try),
              (eq, "$g_multiplayer_team_2_faction", "fac_culture_scotch"),
              (create_mesh_overlay, reg0, "mesh_mp_scoreboard_team_6"),
            (try_end),
            
            (position_set_x, pos3, 25),
            (position_set_y, pos3, 660),
            (overlay_set_position, reg0, pos3),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
          (try_end),
          
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_run, [
          (team_get_score, ":team_1_score", 0),
          (team_get_score, ":team_2_score", 1),
          (try_begin),
            (this_or_next|neq, ":team_1_score", "$g_multiplayer_team_1_last_displayed_score"),
            (neq, ":team_2_score", "$g_multiplayer_team_2_last_displayed_score"),
            (assign, "$g_multiplayer_team_1_last_displayed_score", ":team_1_score"),
            (assign, "$g_multiplayer_team_2_last_displayed_score", ":team_2_score"),
            
            (str_store_faction_name, s0, "$g_multiplayer_team_1_faction"),
            (assign, reg0, ":team_1_score"),
            (overlay_set_text, "$g_multiplayer_team_1_score_display_overlay", "str_reg0"),
            
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (str_store_faction_name, s0, "$g_multiplayer_team_2_faction"),
            (assign, reg0, ":team_2_score"),
            (overlay_set_text, "$g_multiplayer_team_2_score_display_overlay", "str_reg0"),
          (try_end),
      ]),
  ]),
  
  # ("multiplayer_flag_projection_display", prsntf_read_only|prsntf_manual_end_only, 0, [
      # (ti_on_presentation_load,
        # [
          # (set_fixed_point_multiplier, 1000),
          
          # (store_sub, ":flag_mesh", "$g_multiplayer_team_1_faction", mp_factions_begin),
          # (val_add, ":flag_mesh", multiplayer_objective_projections_begin),
          # (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_1", ":flag_mesh"),
          # (val_sub, ":flag_mesh", multiplayer_objective_projections_begin),
          # (val_add, ":flag_mesh", multiplayer_objective_taken_projections_begin),
          # (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_2", ":flag_mesh"),
          
          # (try_begin),
            # (neq, "$g_multiplayer_team_1_faction", "$g_multiplayer_team_2_faction"),
            # (store_sub, ":flag_mesh", "$g_multiplayer_team_2_faction", mp_factions_begin),
            # (val_add, ":flag_mesh", multiplayer_objective_projections_begin),
            # (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_3", ":flag_mesh"),
            # (val_sub, ":flag_mesh", multiplayer_objective_projections_begin),
            # (val_add, ":flag_mesh", multiplayer_objective_taken_projections_begin),
            # (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_4", ":flag_mesh"),
          # (else_try),
            # (assign, ":flag_mesh", "mesh_mp_objective_projection_team_rebel"),
            # (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_3", ":flag_mesh"),
            # (assign, ":flag_mesh", "mesh_mp_objective_projection_team_rebel_miss"),
            # (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_4", ":flag_mesh"),
          # (try_end),
          
          # (position_set_x, pos1, 250),
          # (position_set_y, pos1, 250),
          # (overlay_set_size, "$g_presentation_obj_flag_projection_display_1", pos1),
          # (overlay_set_size, "$g_presentation_obj_flag_projection_display_2", pos1),
          # (overlay_set_size, "$g_presentation_obj_flag_projection_display_3", pos1),
          # (overlay_set_size, "$g_presentation_obj_flag_projection_display_4", pos1),
          # (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
          # (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
          # (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
          # (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 0),
          # (presentation_set_duration, 999999),
      # ]),
      
      # (ti_on_presentation_run,
        # [
          # (set_fixed_point_multiplier, 1000),
          
          # (scene_prop_get_instance, ":flag_red_id", "$team_1_flag_scene_prop", 0),
          # (team_get_slot, ":team_0_flag_situation", 0, slot_team_flag_situation),
          # (try_begin),
            # (neq, ":team_0_flag_situation", 1),
            # (prop_instance_get_position, pos1, ":flag_red_id"), #hold position of flag of team 1 (red flag) at pos1
          # (else_try),
            # (entry_point_get_position, pos1, multi_base_point_team_1), #moved from above to here after auto-set position
          # (try_end),
          # (position_move_z, pos1, 200, 1),
          
          # (scene_prop_get_instance, ":flag_blue_id", "$team_2_flag_scene_prop", 0),
          # (team_get_slot, ":team_1_flag_situation", 1, slot_team_flag_situation),
          # (try_begin),
            # (neq, ":team_1_flag_situation", 1),
            # (prop_instance_get_position, pos2, ":flag_blue_id"), #hold position of flag of team 1 (red flag) at pos1
          # (else_try),
            # (entry_point_get_position, pos2, multi_base_point_team_2), #moved from above to here after auto-set position
          # (try_end),
          # (position_move_z, pos2, 200, 1),
          
          # (position_get_screen_projection, pos3, pos1),
          # (position_get_x, ":x_pos", pos3),
          # (position_get_y, ":y_pos", pos3),
          # (position_set_y, pos3, ":y_pos"),
          # (try_begin),
            # (is_between, ":x_pos", -100, 1100),
            # (is_between, ":y_pos", -100, 850),
            
            # (multiplayer_get_my_player, ":my_player_number"),
            # (try_begin),
              # (ge, ":my_player_number", 0),
              # (player_get_team_no, ":my_player_team", ":my_player_number"),
            # (else_try),
              # (assign, ":my_player_team", multi_team_spectator),
            # (try_end),
            
            # (try_begin),
              # (neq, ":my_player_team", 1), #if I am at team 0 or spectator
              # (try_begin),
                # (neq, ":team_0_flag_situation", 1), #if our flag is not stolen
                # (overlay_set_position, "$g_presentation_obj_flag_projection_display_1", pos3),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 1),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
              # (else_try), #if our flag is stolen
                # (try_begin),
                  # (eq, ":my_player_team", 0),
                  # (assign, ":our_base_entry_id", multi_base_point_team_1),
                # (else_try),
                  # (assign, ":our_base_entry_id", multi_base_point_team_2),
                # (try_end),
                
                # (entry_point_get_position, pos5, ":our_base_entry_id"), #moved from above to here after auto-set position
                # (position_get_screen_projection, pos3, pos5),
                
                # (overlay_set_position, "$g_presentation_obj_flag_projection_display_2", pos3),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 1),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
              # (try_end),
            # (else_try),
              # (try_begin),
                # (neq, ":team_0_flag_situation", 1),
                # (overlay_set_position, "$g_presentation_obj_flag_projection_display_1", pos3),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 1),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
              # (try_end),
            # (try_end),
          # (else_try),
            # (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
            # (overlay_set_display, "$g_presentation_obj_flag_projection_display_2", 0),
          # (try_end),
          
          # (position_get_screen_projection, pos3, pos2),
          # (position_get_x, ":x_pos", pos3),
          # (position_get_y, ":y_pos", pos3),
          # (position_set_y, pos3, ":y_pos"),
          # (try_begin),
            # (is_between, ":x_pos", -100, 1100),
            # (is_between, ":y_pos", -100, 850),
            
            # (team_get_slot, ":team_1_flag_situation", 1, slot_team_flag_situation),
            
            # (multiplayer_get_my_player, ":my_player_number"),
            # (try_begin),
              # (ge, ":my_player_number", 0),
              # (player_get_team_no, ":my_player_team", ":my_player_number"),
            # (else_try),
              # (assign, ":my_player_team", multi_team_spectator),
            # (try_end),
            
            # (try_begin),
              # (neq, ":my_player_team", 0), #if I am at team 0 or spectator
              # (try_begin),
                # (neq, ":team_1_flag_situation", 1), #if our flag is not stolen
                # (overlay_set_position, "$g_presentation_obj_flag_projection_display_3", pos3),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 1),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 0),
              # (else_try), #if our flag is stolen
                # (try_begin),
                  # (eq, ":my_player_team", 0),
                  # (assign, ":our_base_entry_id", multi_base_point_team_1),
                # (else_try),
                  # (assign, ":our_base_entry_id", multi_base_point_team_2),
                # (try_end),
                
                # (entry_point_get_position, pos5, ":our_base_entry_id"), #moved from above to here after auto-set position
                # (position_get_screen_projection, pos3, pos5),
                
                # (overlay_set_position, "$g_presentation_obj_flag_projection_display_4", pos3),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 1),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
              # (try_end),
            # (else_try),
              # (try_begin),
                # (neq, ":team_1_flag_situation", 1),
                # (overlay_set_position, "$g_presentation_obj_flag_projection_display_3", pos3),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 1),
                # (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 0),
              # (try_end),
            # (try_end),
          # (else_try),
            # (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
            # (overlay_set_display, "$g_presentation_obj_flag_projection_display_4", 0),
          # (try_end),
      # ]),
  # ]),
  
  ("multiplayer_flag_projection_display_bt", prsntf_read_only|prsntf_manual_end_only, 0, [ #this is for search and destroy death mode flags.
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          
          (store_sub, ":flag_mesh", "$g_multiplayer_team_1_faction", mp_factions_begin),
          (val_add, ":flag_mesh", multiplayer_objective_projections_begin),
          (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_1", ":flag_mesh"),
          
          (try_begin),
            (neq, "$g_multiplayer_team_1_faction", "$g_multiplayer_team_2_faction"),
            (store_sub, ":flag_mesh", "$g_multiplayer_team_2_faction", mp_factions_begin),
            (val_add, ":flag_mesh", multiplayer_objective_projections_begin),
          (else_try),
            (assign, ":flag_mesh", "mesh_mp_objective_projection_team_rebel"),
          (try_end),
          (create_mesh_overlay, "$g_presentation_obj_flag_projection_display_3", ":flag_mesh"),
          
          (position_set_x, pos1, 250),
          (position_set_y, pos1, 250),
          
          (overlay_set_size, "$g_presentation_obj_flag_projection_display_1", pos1),
          (overlay_set_size, "$g_presentation_obj_flag_projection_display_3", pos1),
          (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
          (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_run, [
          (try_begin),
            (eq, "$g_round_ended", 0),
            (set_fixed_point_multiplier, 1000),
            (scene_prop_get_instance, ":flag_1_id", "$team_1_flag_scene_prop", 0),
            (prop_instance_get_position, pos1, ":flag_1_id"), #hold position of flag of team 1 at pos1
            (position_move_z, pos1, 250, 1),
            
            (scene_prop_get_instance, ":flag_2_id", "$team_2_flag_scene_prop", 0),
            (prop_instance_get_position, pos2, ":flag_2_id"), #hold position of flag of team 2 at pos2
            (position_move_z, pos2, 250, 1),
            
            (position_get_screen_projection, pos3, pos1),
            (position_get_x, ":x_pos", pos3),
            (position_get_y, ":y_pos", pos3),
            (position_set_y, pos3, ":y_pos"),
            (try_begin),
              (is_between, ":x_pos", -100, 1100),
              (is_between, ":y_pos", -100, 850),
              
              (overlay_set_position, "$g_presentation_obj_flag_projection_display_1", pos3),
              (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 1),
            (else_try),
              (overlay_set_display, "$g_presentation_obj_flag_projection_display_1", 0),
            (try_end),
            
            (position_get_screen_projection, pos3, pos2),
            (position_get_x, ":x_pos", pos3),
            (position_get_y, ":y_pos", pos3),
            (position_set_y, pos3, ":y_pos"),
            (try_begin),
              (is_between, ":x_pos", -100, 1100),
              (is_between, ":y_pos", -100, 850),
              
              (overlay_set_position, "$g_presentation_obj_flag_projection_display_3", pos3),
              (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 1),
            (else_try),
              (overlay_set_display, "$g_presentation_obj_flag_projection_display_3", 0),
            (try_end),
          (else_try),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_respawn_time_counter", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load, [
          (set_fixed_point_multiplier, 1000),
          
          (assign, "$g_multiplayer_respawn_counter_overlay", -1),
          (assign, "$g_multiplayer_respawn_remained_overlay", -1),
          
          (assign, ":do_not_show_respawn_counter", 0),
          (try_begin),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_round_result_in_siege_mode),
            (this_or_next|eq, "$g_round_ended", 1),
            (eq, "$g_flag_is_not_ready", 1),
            (assign, ":do_not_show_respawn_counter", 1),
          (try_end),
          (eq, ":do_not_show_respawn_counter", 0),
          
          (assign, "$g_multiplayer_last_respawn_counter_value", -1),
          (str_clear, s0),
          (create_text_overlay, "$g_multiplayer_respawn_counter_overlay", s0, tf_center_justify|tf_with_outline),
          (overlay_set_color, "$g_multiplayer_respawn_counter_overlay", 0xFFFFFF),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 600),
          (overlay_set_position, "$g_multiplayer_respawn_counter_overlay", pos1),
          (position_set_x, pos1, 2000),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_multiplayer_respawn_counter_overlay", pos1),
          
          (str_clear, s0),
          (create_text_overlay, "$g_multiplayer_respawn_remained_overlay", s0, tf_center_justify|tf_with_outline),
          (overlay_set_color, "$g_multiplayer_respawn_remained_overlay", 0xFFFFFF),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 570),
          (overlay_set_position, "$g_multiplayer_respawn_remained_overlay", pos1),
          (position_set_x, pos1, 1400),
          (position_set_y, pos1, 1400),
          (overlay_set_size, "$g_multiplayer_respawn_remained_overlay", pos1),
          
          #(store_mission_timer_a, "$g_multiplayer_respawn_start_time"),
          (presentation_set_duration, 999999),
      ]),
      
      (ti_on_presentation_run, [
          (ge, "$g_multiplayer_respawn_counter_overlay", 0),
          (multiplayer_get_my_player, ":my_player_no"),
          (try_begin),
            (ge, ":my_player_no", 0),
            (neq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (player_get_team_no, ":player_team", ":my_player_no"),
            (try_begin),
              (eq, ":player_team", multi_team_spectator),
              (presentation_set_duration, 0),
            (else_try),
              (store_mission_timer_a, ":current_time"),
              (store_sub, ":seconds_past_in_respawn", ":current_time", "$g_multiplayer_respawn_start_time"),
              (try_begin),
                (eq, "$g_show_no_more_respawns_remained", 0),
                (assign, ":total_respawn_time", "$g_multiplayer_respawn_period"),
                (try_begin),
                  (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
                  (player_get_team_no, ":player_team", ":my_player_no"),
                  (eq, ":player_team", 0),
                  (val_add, ":total_respawn_time", multiplayer_siege_mod_defender_team_extra_respawn_time),
                (try_end),
              (else_try),
                (assign, ":total_respawn_time", 6),
              (try_end),
              (store_sub, ":seconds_left_in_respawn", ":total_respawn_time", ":seconds_past_in_respawn"),
              (try_begin),
                (le, ":seconds_left_in_respawn", 0),
                (presentation_set_duration, 0),
              (else_try),
                (neq, "$g_multiplayer_last_respawn_counter_value", ":seconds_left_in_respawn"),
                (assign, "$g_multiplayer_last_respawn_counter_value", ":seconds_left_in_respawn"),
                (try_begin),
                  (eq, "$g_show_no_more_respawns_remained", 0),
                  (assign, reg0, ":seconds_left_in_respawn"),
                  (str_store_string, s0, "str_respawning_in_reg0_seconds"),
                  (try_begin),
                    (gt, "$g_multiplayer_number_of_respawn_count", 0),
                    (store_sub, reg0, "$g_multiplayer_number_of_respawn_count", "$g_my_spawn_count"),
                    
                    (multiplayer_get_my_player, ":my_player_no"),
                    (player_get_team_no, ":my_player_team", ":my_player_no"),
                    (eq, ":my_player_team", 0),
                    
                    (try_begin),
                      (gt, reg0, 1),
                      (str_store_string, s1, "str_reg0_respawns_remained"),
                    (else_try),
                      (str_store_string, s1, "str_this_is_your_last_respawn"),
                    (try_end),
                  (else_try),
                    (str_clear, s1),
                  (try_end),
                (else_try),
                  (eq, "$g_show_no_more_respawns_remained", 1),
                  ##(assign, "$g_informed_about_no_more_respawns_remained", 1),
                  (str_store_string, s0, "str_no_more_respawns_remained_this_round"),
                  (str_clear, s1),
                  (str_store_string, s1, "str_wait_next_round"),
                (try_end),
                (overlay_set_text, "$g_multiplayer_respawn_counter_overlay", s0),
                (overlay_set_text, "$g_multiplayer_respawn_remained_overlay", s1),
              (try_end),
            (try_end),
          (else_try),
            (presentation_set_duration, 0),
          (try_end),
          
          (try_begin),
            (eq, "$g_multiplayer_message_type", multiplayer_message_type_round_result_in_siege_mode),
            (this_or_next|eq, "$g_round_ended", 1),
            (eq, "$g_flag_is_not_ready", 1),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_stats_chart", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_mp_score_b"),
          (position_set_x, pos1, 100),
          (position_set_y, pos1, 100),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, reg0, pos1),
          
          (assign, ":team_1_rows", 0),
          (assign, ":team_2_rows", 0),
          (assign, ":spectator_rows", 0),
          (get_max_players, ":num_players"),
          (try_for_range, ":player_no", 0, ":num_players"),
            (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
            (try_begin),
              (player_is_active, ":player_no"),
              (troop_set_slot, "trp_multiplayer_data", ":slot_index", 1),
              (player_get_team_no, ":player_team", ":player_no"),
              (try_begin),
                (eq, ":player_team", 0),
                (val_add, ":team_1_rows", 1),
              (else_try),
                (eq, ":player_team", 1),
                (val_add, ":team_2_rows", 1),
              (else_try),
                (eq, ":player_team", multi_team_spectator),
                (val_add, ":spectator_rows", 1),
              (try_end),
            (else_try),
              (troop_set_slot, "trp_multiplayer_data", ":slot_index", 0),
            (try_end),
          (try_end),
          (try_begin),
            (gt, "$g_multiplayer_num_bots_team_1", 0),
            (val_add, ":team_1_rows", 1),
          (try_end),
          (try_begin),
            (gt, "$g_multiplayer_num_bots_team_2", 0),
            (val_add, ":team_2_rows", 1),
          (try_end),
          
          (assign, ":total_rows", ":team_1_rows"),
          (val_max, ":total_rows", ":team_2_rows"),
          (val_add, ":total_rows", ":spectator_rows"),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_stats_chart_container", s0, tf_scrollable_style_2),
          (position_set_x, pos1, 100),
          (position_set_y, pos1, 120),#120
          (overlay_set_position, "$g_presentation_obj_stats_chart_container", pos1),
          (position_set_x, pos1, 746),
          (position_set_y, pos1, 530),#530
          (overlay_set_area_size, "$g_presentation_obj_stats_chart_container", pos1),
          (set_container_overlay, "$g_presentation_obj_stats_chart_container"),
          
          (store_mul, ":y_needed", ":total_rows", 20),
          (val_add, ":y_needed", 100),
          (try_begin),
            (gt, ":spectator_rows", 0),
            (val_add, ":y_needed", 70),
          (try_end),
          
          (multiplayer_get_my_player, ":my_player_no"),
          
          (try_begin),
            (gt, ":y_needed", 490),
            (assign, "$g_stats_chart_update_period", 8),
          (else_try),
            (assign, "$g_stats_chart_update_period", 1),
          (try_end),
          
          #assuming only 2 teams in scene
          (try_for_range, ":i_team", 0, multi_team_spectator),
            (assign, ":number_of_players", 0),
            (get_max_players, ":num_players"),
            (try_for_range, ":player_no", 0, ":num_players"),
              (player_is_active, ":player_no"),
              (player_get_team_no, ":team_no", ":player_no"),
              (eq, ":team_no", ":i_team"),
              (val_add, ":number_of_players", 1),
            (try_end),
            (assign, reg0, ":number_of_players"),
            (try_begin),
              (eq,":i_team",1),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
              (create_text_overlay, reg1, "@Invaders", 0),
            (else_try),
              (neq, ":number_of_players", 1),
              (create_text_overlay, reg1, "str_reg0_players", 0),
            (else_try),
              (create_text_overlay, reg1, "str_reg0_player", 0),
            (try_end),
            
            (assign, ":cur_y", ":y_needed"),
            (team_get_faction, ":cur_faction", ":i_team"),
            (try_begin),
              (eq, ":i_team", 1),
              (team_get_faction, ":faction_of_team_1", 0),
              (team_get_faction, ":faction_of_team_2", 1),
              (eq, ":faction_of_team_1", ":faction_of_team_2"),
              (str_store_faction_name, s1, ":cur_faction"),
              #(str_store_string,s1,"@{s0} Rebels"),
              (assign, ":mesh", "mesh_mp_scoreboard_team_rebel"),
            (else_try),
              (store_sub,":mesh",":cur_faction","fac_culture_norse"),
              (val_add,":mesh","mesh_mp_scoreboard_team_1"),
              (str_store_faction_name, s1, ":cur_faction"),
            (try_end),
            (create_text_overlay, reg0, s1, 0),
            (try_begin),
              (eq, ":i_team", 0),
              (overlay_set_color, reg0, 0xFF0000),
              (overlay_set_color, reg1, 0xFF0000),
            (else_try),
              (overlay_set_color, reg0, 0x0099FF),
              (overlay_set_color, reg1, 0x0099FF),
            (try_end),
            (assign, ":distance_between_teams", 373),
            (store_mul, ":cur_x", ":distance_between_teams", ":i_team"),
            (val_add, ":cur_x", 42),
            (store_add, ":cur_x_add_15", ":cur_x", 15),
            (position_set_x, pos3, ":cur_x_add_15"),
            (position_set_y, pos3, ":cur_y"),
            (store_add, ":cur_x_add_35", ":cur_x", 35),
            (position_set_x, pos1, ":cur_x_add_35"),
            (position_set_y, pos1, ":cur_y"),
            (copy_position, pos2, pos1),
            (store_sub, ":cur_y_sub_10", ":cur_y", 10),
            (position_set_x, pos2, ":cur_x_add_35"),
            (position_set_y, pos2, ":cur_y_sub_10"),
            (overlay_set_position, reg0, pos1),
            (overlay_set_position, reg1, pos2),
            (position_set_x, pos1, 1000),
            (position_set_y, pos1, 1000),
            (position_set_x, pos2, 600),
            (position_set_y, pos2, 600),
            (overlay_set_size, reg0, pos1),
            (overlay_set_size, reg1, pos2),
            
            
            (create_mesh_overlay, reg0, ":mesh"),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, 100),
            (overlay_set_position, reg0, pos3),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
            
            (team_get_score, reg0, ":i_team"),
            (create_text_overlay, reg0, "str_score_reg0", tf_right_align),
            (overlay_set_color, reg0, 0xFFFFFF),
            (store_add, ":sub_cur_x", ":cur_x", 325), #325
            (store_add, ":sub_cur_y", ":cur_y", 0),
            (position_set_x, pos1, ":sub_cur_x"),
            (position_set_y, pos1, ":sub_cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1200),
            (position_set_y, pos1, 1200),
            (overlay_set_size, reg0, pos1),
            
            (val_sub, ":cur_y", 60),
            
            (try_begin),
              (this_or_next|neq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
              (eq,":i_team",0),
              
              (create_text_overlay, reg0, "str_player_name", 0),
              (overlay_set_color, reg0, 0xFFFFFF),
              (position_set_x, pos1, ":cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              
              (create_text_overlay, reg0, "str_kills", tf_center_justify),
              (overlay_set_color, reg0, 0xFFFFFF),
              (store_add, ":sub_cur_x", ":cur_x", 206), #191
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              
              (create_text_overlay, reg0, "str_deaths", tf_center_justify),
              (overlay_set_color, reg0, 0xFFFFFF),
              (store_add, ":sub_cur_x", ":cur_x", 260), #232
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              
              (create_text_overlay, reg0, "str_ping", tf_center_justify),
              (overlay_set_color, reg0, 0xFFFFFF),
              (store_add, ":sub_cur_x", ":cur_x", 308), #291
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
            (try_end),
            
            (create_mesh_overlay, reg0, "mesh_white_plane"),
            (overlay_set_color, reg0, 0xFFFFFF),
            (overlay_set_alpha, reg0, 0xD0),
            (store_add, ":sub_cur_x", ":cur_x", 0),
            (position_set_x, pos1, ":sub_cur_x"),
            (store_add, ":sub_cur_y", ":cur_y", -10),
            (position_set_y, pos1, ":sub_cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 16500),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
            
            (val_sub, ":cur_y", 35),
            
            (store_add, ":end_cond", ":num_players", 1),
            (try_for_range, ":unused", 0, ":end_cond"),
              (assign, ":max_score_plus_death", -30030),
              (assign, ":max_score_plus_death_player_no", -1),
              (try_for_range, ":player_no", 0, ":num_players"),
                (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
                (troop_slot_eq, "trp_multiplayer_data", ":slot_index", 1),
                (player_get_team_no, ":player_team", ":player_no"),
                (eq, ":player_team", ":i_team"),
                
                (player_get_kill_count, ":kill_count", ":player_no"), #get kill count in "siege" or "battle" or "team deathmatch" or "deathmatch"
                (player_get_death_count, ":death_count", ":player_no"), #get_death_count
                (store_mul, ":player_score_plus_death", ":kill_count", 1000),
                (val_sub, ":player_score_plus_death", ":death_count"),
                
                (this_or_next|gt, ":player_score_plus_death", ":max_score_plus_death"),
                (eq, ":player_score_plus_death", -30030),
                
                (assign, ":max_score_plus_death", ":player_score_plus_death"),
                (assign, ":max_score_plus_death_player_no", ":player_no"),
              (try_end),
              (try_begin),
                (ge, ":max_score_plus_death_player_no", 0),
                (store_add, ":slot_index", ":max_score_plus_death_player_no", multi_data_player_index_list_begin),
                (troop_set_slot, "trp_multiplayer_data", ":slot_index", 0),
                
                (try_begin),
                  (eq, ":my_player_no", ":max_score_plus_death_player_no"),
                  (create_mesh_overlay, reg0, "mesh_white_plane"),
                  (overlay_set_color, reg0, 0xFFFFFF),
                  (overlay_set_alpha, reg0, 0x35),
                  (store_add, ":sub_cur_x", ":cur_x", 0),
                  (position_set_x, pos1, ":sub_cur_x"),
                  (store_add, ":sub_cur_y", ":cur_y", 0),
                  (position_set_y, pos1, ":sub_cur_y"),
                  (overlay_set_position, reg0, pos1),
                  (position_set_x, pos1, 16500),
                  (position_set_y, pos1, 1000),
                  (overlay_set_size, reg0, pos1),
                (try_end),
                
                (assign, ":font_color", 0xFFFFFF),
                (player_get_agent_id, ":max_score_plus_death_agent_id", ":max_score_plus_death_player_no"),
                (try_begin),
                  (this_or_next|lt, ":max_score_plus_death_agent_id", 0),
                  (neg|agent_is_alive, ":max_score_plus_death_agent_id"),
                  (assign, ":font_color", 0xFF0000),
                  (create_text_overlay, reg0, "str_dead", 0),
                  (overlay_set_color, reg0, ":font_color"),
                  (position_set_x, pos1, 750),
                  (position_set_y, pos1, 750),
                  (overlay_set_size, reg0, pos1),
                  (store_add, ":sub_cur_x", ":cur_x", 130),
                  (position_set_x, pos1, ":sub_cur_x"),
                  (position_set_y, pos1, ":cur_y"),
                  (overlay_set_position, reg0, pos1),
                (try_end),
                
                (str_store_player_username, s1, ":max_score_plus_death_player_no"),
                (create_text_overlay, reg0, s1, 0),
                (overlay_set_color, reg0, ":font_color"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, ":cur_x"),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
                
                (player_get_kill_count, reg0, ":max_score_plus_death_player_no"), #get_kill_count
                (create_text_overlay, reg0, "str_reg0", tf_right_align),
                (overlay_set_color, reg0, ":font_color"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":sub_cur_x", ":cur_x", 215), #200
                (position_set_x, pos1, ":sub_cur_x"),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
                
                (player_get_death_count, reg0, ":max_score_plus_death_player_no"),
                (create_text_overlay, reg0, "str_reg0", tf_right_align),
                (overlay_set_color, reg0, ":font_color"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":sub_cur_x", ":cur_x", 265), #250
                (position_set_x, pos1, ":sub_cur_x"),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
                
                (player_get_ping, reg0, ":max_score_plus_death_player_no"),
                (create_text_overlay, reg0, "str_reg0", tf_right_align),
                (overlay_set_color, reg0, ":font_color"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":sub_cur_x", ":cur_x", 315), #300
                (position_set_x, pos1, ":sub_cur_x"),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
                (val_sub, ":cur_y", 20),
              (else_try),
                (try_begin),
                  (eq,"$g_multiplayer_game_type",multiplayer_game_type_invasion),
                  (try_begin),
                    (eq, ":i_team", 1),
                    (assign,reg1,"$g_multiplayer_invasion_bots_left"),
                    (create_text_overlay, reg0, "@Enemies left: {reg1}", 0),
                    (overlay_set_color, reg0, 0xD0D0D0),
                    (position_set_x, pos1, 800),
                    (position_set_y, pos1, 800),
                    (overlay_set_size, reg0, pos1),
                    (position_set_x, pos1, ":cur_x"),
                    (position_set_y, pos1, ":cur_y"),
                    (overlay_set_position, reg0, pos1),
                  (try_end),
                (else_try),
                  (try_begin),
                    (eq, ":i_team", 0),
                    (assign, ":number_of_bots_in_cur_team", "$g_multiplayer_num_bots_team_1"),
                  (else_try),
                    (assign, ":number_of_bots_in_cur_team", "$g_multiplayer_num_bots_team_2"),
                  (try_end),
                  
                  (team_get_bot_kill_count, reg0, ":i_team"),
                  (team_get_bot_death_count, reg1, ":i_team"),
                  (try_begin),
                    (this_or_next|neq, reg0, 0),
                    (this_or_next|neq, reg1, 0),
                    (neq, ":number_of_bots_in_cur_team", 0),
                    (assign, ":write_bot_informations_of_team", 1),
                  (else_try),
                    (assign, ":write_bot_informations_of_team", 0),
                  (try_end),
                  
                  (eq, ":write_bot_informations_of_team", 1),
                  
                  (assign, ":number_of_alive_bots", 0),
                  (try_for_agents, ":cur_agent"),
                    (agent_is_non_player, ":cur_agent"),
                    (agent_is_alive, ":cur_agent"),
                    (agent_get_team, ":cur_agent_team", ":cur_agent"),
                    (eq, ":cur_agent_team", ":i_team"),
                    (val_add, ":number_of_alive_bots", 1),
                  (try_end),
                  (store_sub, ":number_of_dead_bots", ":number_of_bots_in_cur_team", ":number_of_alive_bots"),
                  (try_begin),
                    (eq, ":number_of_alive_bots", 0),
                    (assign, ":font_color", 0xFF0000),
                  (else_try),
                    (assign, ":font_color", 0xD0D0D0),
                  (try_end),
                  
                  (try_begin),
                    (gt, ":number_of_dead_bots", 0),
                    (try_begin),
                      (eq, ":number_of_bots_in_cur_team", 1),
                      (create_text_overlay, reg0, "str_dead", 0),
                      (store_add, ":sub_cur_x", ":cur_x", 130),
                    (else_try),
                      (assign, reg0, ":number_of_dead_bots"),
                      (create_text_overlay, reg0, "str_reg0_dead", 0),
                      (store_add, ":sub_cur_x", ":cur_x", 123),
                    (try_end),
                    (overlay_set_color, reg0, ":font_color"),
                    (position_set_x, pos1, 750),
                    (position_set_y, pos1, 750),
                    (overlay_set_size, reg0, pos1),
                    (position_set_x, pos1, ":sub_cur_x"),
                    (position_set_y, pos1, ":cur_y"),
                    (overlay_set_position, reg0, pos1),
                  (try_end),
                  
                  (try_begin),
                    (gt, ":number_of_bots_in_cur_team", 1),
                    (assign, reg0, ":number_of_bots_in_cur_team"),
                    (create_text_overlay, reg0, "str_bots_reg0_agents", 0),
                  (else_try),
                    (create_text_overlay, reg0, "str_bot_1_agent", 0),
                  (try_end),
                  (overlay_set_color, reg0, ":font_color"),
                  (position_set_x, pos1, 750),
                  (position_set_y, pos1, 750),
                  (overlay_set_size, reg0, pos1),
                  (position_set_x, pos1, ":cur_x"),
                  (position_set_y, pos1, ":cur_y"),
                  (overlay_set_position, reg0, pos1),
                  
                  (team_get_bot_kill_count, reg0, ":i_team"),
                  (create_text_overlay, reg0, "str_reg0", tf_right_align),
                  (overlay_set_color, reg0, ":font_color"),
                  (position_set_x, pos1, 750),
                  (position_set_y, pos1, 750),
                  (overlay_set_size, reg0, pos1),
                  (store_add, ":sub_cur_x", ":cur_x", 215), #200
                  (position_set_x, pos1, ":sub_cur_x"),
                  (position_set_y, pos1, ":cur_y"),
                  (overlay_set_position, reg0, pos1),
                  
                  (team_get_bot_death_count, reg0, ":i_team"),
                  (create_text_overlay, reg0, "str_reg0", tf_right_align),
                  (overlay_set_color, reg0, ":font_color"),
                  (position_set_x, pos1, 750),
                  (position_set_y, pos1, 750),
                  (overlay_set_size, reg0, pos1),
                  (store_add, ":sub_cur_x", ":cur_x", 265), #250
                  (position_set_x, pos1, ":sub_cur_x"),
                  (position_set_y, pos1, ":cur_y"),
                  (overlay_set_position, reg0, pos1),
                  (val_sub, ":cur_y", 20),
                (try_end),
                (assign, ":end_cond", 0), #all players are written for this team, break
              (try_end),
            (try_end),
            
            (try_begin),
              (eq, ":i_team", 0),
              (assign, ":old_cur_y", ":cur_y"),
            (try_end),
          (try_end),
          
          (try_begin),
            (le, ":old_cur_y", ":cur_y"),
            (assign, ":cur_y", ":old_cur_y"),
          (try_end),
          
          (assign, ":cur_x", 42),
          
          #white line between playing players and spectators
          (create_mesh_overlay, reg0, "mesh_white_plane"),
          (overlay_set_color, reg0, 0xFFFFFF),
          (overlay_set_alpha, reg0, 0xD0),
          (store_add, ":sub_cur_x", ":cur_x", 0),
          (position_set_x, pos1, ":sub_cur_x"),
          (store_add, ":sub_cur_y", ":cur_y", 10),
          (position_set_y, pos1, ":sub_cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 36000),
          (position_set_y, pos1, 50),
          (overlay_set_size, reg0, pos1),
          
          (try_begin),
            (gt, ":spectator_rows", 0),
            
            (assign, ":cur_x", 280),
            (val_sub, ":cur_y", 50),
            
            #"spectators" text
            (create_text_overlay, reg0, "str_spectators", 0),
            (overlay_set_color, reg0, 0xFFFFFF),
            (position_set_x, pos1, ":cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1000),
            (position_set_y, pos1, 1000),
            (overlay_set_size, reg0, pos1),
            
            (create_text_overlay, reg0, "str_ping", tf_right_align),
            (overlay_set_color, reg0, 0xFFFFFF),
            (store_add, ":sub_cur_x", ":cur_x", 215), #200
            (position_set_x, pos1, ":sub_cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            
            #white line for spectators list
            (create_mesh_overlay, reg0, "mesh_white_plane"),
            (overlay_set_color, reg0, 0xFFFFFF),
            (overlay_set_alpha, reg0, 0xD0),
            (store_add, ":sub_cur_x", ":cur_x", 0),
            (position_set_x, pos1, ":sub_cur_x"),
            (store_add, ":sub_cur_y", ":cur_y", -10),
            (position_set_y, pos1, ":sub_cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 12000),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
            
            (val_sub, ":cur_y", 30),
            
            (assign, ":font_color", 0xC0C0C0),
            
            (store_add, ":end_cond", ":num_players", 1),
            (try_for_range, ":player_no", 0, ":end_cond"),
              (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
              (troop_slot_eq, "trp_multiplayer_data", ":slot_index", 1),
              
              (player_get_team_no, ":player_team", ":player_no"),
              (eq, ":player_team", multi_team_spectator), #to not to allow dedicated server to pass below, dedicated servers have -1 for team_no not 2(multi_team_spectator).
              
              (troop_set_slot, "trp_multiplayer_data", ":slot_index", 1),
              
              (try_begin),
                (eq, ":my_player_no", ":player_no"),
                (create_mesh_overlay, reg0, "mesh_white_plane"),
                (overlay_set_color, reg0, 0xFFFFFF),
                (overlay_set_alpha, reg0, 0x35),
                (store_add, ":sub_cur_x", ":cur_x", 0),
                (position_set_x, pos1, ":sub_cur_x"),
                (store_add, ":sub_cur_y", ":cur_y", 0),
                (position_set_y, pos1, ":sub_cur_y"),
                (overlay_set_position, reg0, pos1),
                (position_set_x, pos1, 12000),
                (position_set_y, pos1, 1000),
                (overlay_set_size, reg0, pos1),
              (try_end),
              
              (str_store_player_username, s1, ":player_no"),
              (create_text_overlay, reg0, s1, 0),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (position_set_x, pos1, ":cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              
              (player_get_ping, reg0, ":player_no"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", 215), #200
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (val_sub, ":cur_y", 20),
            (try_end),
          (try_end),
          
          (omit_key_once, key_mouse_scroll_up),
          (omit_key_once, key_mouse_scroll_down),
          
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_mouse_scroll_up),
            (key_clicked, key_mouse_scroll_down),
            (omit_key_once, key_mouse_scroll_up),
            (omit_key_once, key_mouse_scroll_down),
          (try_end),
          (try_begin),
            (eq, "$g_multiplayer_stats_chart_opened_manually", 1),
            (neg|game_key_is_down, gk_leave),
            (assign, "$g_multiplayer_stats_chart_opened_manually", 0),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
          (try_end),
          (try_begin),
            (store_mul, ":update_period_time_limit", "$g_stats_chart_update_period", 1000),
            (gt, ":cur_time", ":update_period_time_limit"),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_stats_chart"),
          (try_end),
      ]),
  ]),
  
  #this score table is used in only deathmatch
  ("multiplayer_stats_chart_deathmatch", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_mp_score_a"),
          (position_set_x, pos1, 295),
          (position_set_y, pos1, 115),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, reg0, pos1),
          
          (assign, ":team_rows", 0),
          (assign, ":spectator_rows", 0),
          (get_max_players, ":num_players"),
          (try_for_range, ":player_no", 0, ":num_players"),
            (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
            (try_begin),
              (player_is_active, ":player_no"),
              (troop_set_slot, "trp_multiplayer_data", ":slot_index", 1),
              (player_get_team_no, ":player_team", ":player_no"),
              (try_begin),
                (this_or_next|eq, ":player_team", 0),
                (eq, ":player_team", 1),
                (val_add, ":team_rows", 1),
              (else_try),
                (eq, ":player_team", multi_team_spectator),
                (val_add, ":spectator_rows", 1),
              (try_end),
            (else_try),
              (troop_set_slot, "trp_multiplayer_data", ":slot_index", 0),
            (try_end),
          (try_end),
          (try_begin),
            (this_or_next|gt, "$g_multiplayer_num_bots_team_1", 0),
            (gt, "$g_multiplayer_num_bots_team_2", 0),
            (val_add, ":team_rows", 1),
          (try_end),
          
          (store_add, ":total_rows", ":team_rows", ":spectator_rows"),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_stats_chart_deathmatch_container", s0, tf_scrollable_style_2),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 140),
          (overlay_set_position, "$g_presentation_obj_stats_chart_deathmatch_container", pos1),
          (position_set_x, pos1, 346),
          (position_set_y, pos1, 530),
          (overlay_set_area_size, "$g_presentation_obj_stats_chart_deathmatch_container", pos1),
          (set_container_overlay, "$g_presentation_obj_stats_chart_deathmatch_container"),
          
          (store_mul, ":y_needed", ":total_rows", 20),
          (val_add, ":y_needed", 80),
          (try_begin),
            (gt, ":spectator_rows", 0),
            (val_add, ":y_needed", 70),
          (try_end),
          
          (try_begin),
            (ge, ":total_rows", 17),
            (assign, "$g_stats_chart_update_period", 10),
          (else_try),
            (assign, "$g_stats_chart_update_period", 1),
          (try_end),
          
          (multiplayer_get_my_player, ":my_player_no"),
          
          #assuming only 2 teams in scene
          (assign, ":cur_y", ":y_needed"),
          (assign, ":cur_x", 42),
          
          (create_text_overlay, reg0, "str_player_name", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, ":cur_x"),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg0, pos1),
          
          (assign,":x_add",179),
          (try_begin),
            (eq,"$g_multiplayer_game_type",multiplayer_game_type_thor),
            (create_text_overlay, reg0, "str_score", tf_center_justify),
            (overlay_set_color, reg0, 0xFFFF22),
            (store_add, ":sub_cur_x", ":cur_x", 149),
            (position_set_x, pos1, ":sub_cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (assign,":x_add",189),
          (try_end),
          
          
          (create_text_overlay, reg0, "str_kills", tf_center_justify),
          (overlay_set_color, reg0, 0xFFFFFF),
          (store_add, ":sub_cur_x", ":cur_x", ":x_add"), #164
          (position_set_x, pos1, ":sub_cur_x"),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg0, pos1),
          
          (create_text_overlay, reg0, "str_deaths", tf_center_justify),
          (overlay_set_color, reg0, 0xFFFFFF),
          (store_add, ":sub_cur_x", ":cur_x", 233), #205
          (position_set_x, pos1, ":sub_cur_x"),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg0, pos1),
          
          (create_text_overlay, reg0, "str_ping", tf_center_justify),
          (overlay_set_color, reg0, 0xFFFFFF),
          (store_add, ":sub_cur_x", ":cur_x", 282), #264
          (position_set_x, pos1, ":sub_cur_x"),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg0, pos1),
          
          (create_mesh_overlay, reg0, "mesh_white_plane"),
          (overlay_set_color, reg0, 0xFFFFFF),
          (overlay_set_alpha, reg0, 0xD0),
          (store_add, ":sub_cur_x", ":cur_x", 0),
          (position_set_x, pos1, ":sub_cur_x"),
          (store_add, ":sub_cur_y", ":cur_y", -10),
          (position_set_y, pos1, ":sub_cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 15250),
          (position_set_y, pos1, 50),
          (overlay_set_size, reg0, pos1),
          
          (val_sub, ":cur_y", 35),
          
          (store_add, ":end_cond", ":num_players", 1),
          (try_for_range, ":unused", 0, ":end_cond"),
            (assign, ":max_score_plus_death", -30030),
            (assign, ":max_kills_player_no", -1),
            (try_for_range, ":player_no", 0, ":num_players"),
              (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
              (troop_slot_eq, "trp_multiplayer_data", ":slot_index", 1),
              (player_get_team_no, ":player_team", ":player_no"),
              (this_or_next|eq, ":player_team", 0),
              (eq, ":player_team", 1),
              
              (player_get_kill_count, ":kill_count", ":player_no"),
              (player_get_death_count, ":death_count", ":player_no"), #get_death_count
              (store_mul, ":player_score_plus_death", ":kill_count", 1000),
              
              (try_begin),
                (eq,"$g_multiplayer_game_type",multiplayer_game_type_thor),
                (player_get_score,":killed_champions",":player_no"),
                (val_mul,":player_score_plus_death",10),#1 killed champion = 10 frags
                (val_mul,":killed_champions",1000),#1 score = 1 kill as champion
                #(val_mul,":killed_champions",10000),#1 killed champion = 10 frags
                (val_add,":player_score_plus_death",":killed_champions"),
              (try_end),
              
              (val_sub, ":player_score_plus_death", ":death_count"),
              
              (this_or_next|gt, ":player_score_plus_death", ":max_score_plus_death"),
              (eq, ":player_score_plus_death", -30030),
              
              (assign, ":max_score_plus_death", ":player_score_plus_death"),
              (assign, ":max_kills_player_no", ":player_no"),
            (try_end),
            (try_begin),
              (ge, ":max_kills_player_no", 0),
              (store_add, ":slot_index", ":max_kills_player_no", multi_data_player_index_list_begin),
              (troop_set_slot, "trp_multiplayer_data", ":slot_index", 0),
              (str_store_player_username, s1, ":max_kills_player_no"),
              
              
              (assign,":font_color",0xFFFFFF),
              (try_begin),
                (eq,"$g_multiplayer_game_type",multiplayer_game_type_thor),
                (player_get_agent_id,":agent",":max_kills_player_no"),
                (try_begin),
                  (agent_is_active,":agent"),
                  (agent_is_alive,":agent"),
                  (agent_slot_eq,":agent",slot_agent_is_chosen,1),
                  (assign,":font_color",0xFFFF44),
                (else_try),
                  (assign,":font_color",0xFFFFFF),
                (try_end),
              (try_end),
              
              
              
              (try_begin),
                (eq, ":my_player_no", ":max_kills_player_no"),
                (create_mesh_overlay, reg0, "mesh_white_plane"),
                (overlay_set_color, reg0, 0xFFFFFF),
                (overlay_set_alpha, reg0, 0x35),
                (store_add, ":sub_cur_x", ":cur_x", 0),
                (position_set_x, pos1, ":sub_cur_x"),
                (store_add, ":sub_cur_y", ":cur_y", 0),
                (position_set_y, pos1, ":sub_cur_y"),
                (overlay_set_position, reg0, pos1),
                (position_set_x, pos1, 16000),
                (position_set_y, pos1, 1000),
                (overlay_set_size, reg0, pos1),
              (try_end),
              
              (create_text_overlay, reg0, s1, 0),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (position_set_x, pos1, ":cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              
              (assign,":x_add",188),
              (try_begin),
                (eq,"$g_multiplayer_game_type",multiplayer_game_type_thor),
                (player_get_score, reg0, ":max_kills_player_no"),
                (create_text_overlay, reg0, "str_reg0", tf_right_align),
                (overlay_set_color, reg0, 0xFFAA44),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":sub_cur_x", ":cur_x", 158),
                (position_set_x, pos1, ":sub_cur_x"),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
                (assign,":x_add",198),
              (try_end),
              
              (player_get_kill_count, reg0, ":max_kills_player_no"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", ":x_add"), #173
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              
              (player_get_death_count, reg0, ":max_kills_player_no"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", 238), #223
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              
              (player_get_ping, reg0, ":max_kills_player_no"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", 288), #273
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (val_sub, ":cur_y", 20),
            (else_try),
              (store_add, ":number_of_bots", "$g_multiplayer_num_bots_team_1", "$g_multiplayer_num_bots_team_2"),
              (ge, ":number_of_bots", 1),
              
              (try_begin),
                (gt, ":number_of_bots", 1),
                (assign, reg0, ":number_of_bots"),
                (create_text_overlay, reg0, "str_bots_reg0_agents", 0),
              (else_try),
                (create_text_overlay, reg0, "str_bot_1_agent", 0),
              (try_end),
              
              (overlay_set_color, reg0, 0xD0D0D0),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (position_set_x, pos1, ":cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              
              
              (assign,":x_add",188),
              (try_begin),
                (eq,"$g_multiplayer_game_type",multiplayer_game_type_thor),
                (team_get_score, reg0, 0),
                (create_text_overlay, reg0, "str_reg0", tf_right_align),
                (overlay_set_color, reg0, 0xFFAA44),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":sub_cur_x", ":cur_x", 158),
                (position_set_x, pos1, ":sub_cur_x"),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
                (assign,":x_add",198),
              (try_end),
              
              (team_get_bot_kill_count, reg0, 0),
              (assign, ":bot_kill_count", reg0),
              (team_get_bot_kill_count, reg0, 1),
              (val_add, ":bot_kill_count", reg0),
              (assign, reg0, ":bot_kill_count"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, 0xD0D0D0),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", ":x_add"), #173
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              
              (team_get_bot_death_count, reg0, 0),
              (assign, ":bot_death_count", reg0),
              (team_get_bot_death_count, reg0, 1),
              (val_add, ":bot_death_count", reg0),
              (assign, reg0, ":bot_death_count"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, 0xD0D0D0),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", 238), #223
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (val_sub, ":cur_y", 20),
              
              (assign, ":end_cond", 0), #all players are written, break
            (else_try),
              (assign, ":end_cond", 0), #all players are written, break
            (try_end),
          (try_end),
          
          (assign, ":cur_x", 42),
          
          #white line between playing players and spectators
          (create_mesh_overlay, reg0, "mesh_white_plane"),
          (overlay_set_color, reg0, 0xFFFFFF),
          (overlay_set_alpha, reg0, 0xD0),
          (store_add, ":sub_cur_x", ":cur_x", 0),
          (position_set_x, pos1, ":sub_cur_x"),
          (store_add, ":sub_cur_y", ":cur_y", 10),
          (position_set_y, pos1, ":sub_cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 15250),
          (position_set_y, pos1, 50),
          (overlay_set_size, reg0, pos1),
          
          (try_begin),
            (gt, ":spectator_rows", 0),
            
            (assign, ":cur_x", 75),
            (val_sub, ":cur_y", 50),
            
            #"spectators" text
            (create_text_overlay, reg0, "str_spectators", 0),
            (overlay_set_color, reg0, 0xFFFFFF),
            (position_set_x, pos1, ":cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1000),
            (position_set_y, pos1, 1000),
            (overlay_set_size, reg0, pos1),
            
            (create_text_overlay, reg0, "str_ping", tf_center_justify),
            (overlay_set_color, reg0, 0xFFFFFF),
            (store_add, ":sub_cur_x", ":cur_x", 218), #200
            (position_set_x, pos1, ":sub_cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            
            #white line for spectators list
            (create_mesh_overlay, reg0, "mesh_white_plane"),
            (overlay_set_color, reg0, 0xFFFFFF),
            (overlay_set_alpha, reg0, 0xD0),
            (store_add, ":sub_cur_x", ":cur_x", 0),
            (position_set_x, pos1, ":sub_cur_x"),
            (store_add, ":sub_cur_y", ":cur_y", -10),
            (position_set_y, pos1, ":sub_cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 12000),
            (position_set_y, pos1, 50),
            (overlay_set_size, reg0, pos1),
            
            (val_sub, ":cur_y", 30),
            
            (assign, ":font_color", 0xC0C0C0),
            
            (store_add, ":end_cond", ":num_players", 1),
            (try_for_range, ":player_no", 0, ":end_cond"),
              (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
              (troop_slot_eq, "trp_multiplayer_data", ":slot_index", 1),
              
              (player_get_team_no, ":player_team", ":player_no"),
              (eq, ":player_team", multi_team_spectator), #to not to allow dedicated server to pass below, dedicated servers have -1 for team_no not 2(multi_team_spectator).
              
              (troop_set_slot, "trp_multiplayer_data", ":slot_index", 1),
              
              (try_begin),
                (eq, ":my_player_no", ":player_no"),
                (create_mesh_overlay, reg0, "mesh_white_plane"),
                (overlay_set_color, reg0, 0xFFFFFF),
                (overlay_set_alpha, reg0, 0x35),
                (store_add, ":sub_cur_x", ":cur_x", 0),
                (position_set_x, pos1, ":sub_cur_x"),
                (store_add, ":sub_cur_y", ":cur_y", 0),
                (position_set_y, pos1, ":sub_cur_y"),
                (overlay_set_position, reg0, pos1),
                (position_set_x, pos1, 12000), #16500
                (position_set_y, pos1, 1000),
                (overlay_set_size, reg0, pos1),
              (try_end),
              
              (str_store_player_username, s1, ":player_no"),
              (create_text_overlay, reg0, s1, 0),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (position_set_x, pos1, ":cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              
              (player_get_ping, reg0, ":player_no"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", 215), #200
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (val_sub, ":cur_y", 20),
            (try_end),
          (try_end),
          
          (omit_key_once, key_mouse_scroll_up),
          (omit_key_once, key_mouse_scroll_down),
          
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_mouse_scroll_up),
            (key_clicked, key_mouse_scroll_down),
            (omit_key_once, key_mouse_scroll_up),
            (omit_key_once, key_mouse_scroll_down),
          (try_end),
          (try_begin),
            (eq, "$g_multiplayer_stats_chart_opened_manually", 1),
            (neg|game_key_is_down, gk_leave),
            (assign, "$g_multiplayer_stats_chart_opened_manually", 0),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
          (try_end),
          (try_begin),
            (store_mul, ":update_period_time_limit", "$g_stats_chart_update_period", 1000),
            (gt, ":cur_time", ":update_period_time_limit"),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_stats_chart_deathmatch"),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_escape_menu", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (multiplayer_get_my_player, ":my_player_no"),
          (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
          (position_set_x, pos1, 1000),
          (try_begin),
            (player_is_admin,":my_player_no"),
            (position_set_y, pos1, 1030),
            (overlay_set_size, reg0, pos1),
            (position_set_y, pos1, 50),
          (else_try),
            (position_set_y, pos1, 1000),
            (overlay_set_size, reg0, pos1),
            (position_set_y, pos1, 80),
          (try_end),
          (position_set_x, pos1, 250),
          (overlay_set_position, reg0, pos1),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_escape_menu_container", s0, tf_scrollable_style_2),
          (position_set_x, pos1, 285),
          (position_set_y, pos1, 55),
          (overlay_set_position, "$g_presentation_obj_escape_menu_container", pos1),
          (position_set_x, pos1, 405),
          (position_set_y, pos1, 570),
          (overlay_set_area_size, "$g_presentation_obj_escape_menu_container", pos1),
          (set_container_overlay, "$g_presentation_obj_escape_menu_container"),
          
          (assign, ":cur_y", 520),
          
          (create_text_overlay, reg0, "str_choose_an_option", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          
          (create_button_overlay, "$g_presentation_obj_escape_menu_1", "str_choose_faction", 0),
          (overlay_set_color, "$g_presentation_obj_escape_menu_1", 0xFFFFFF),
          (multiplayer_get_my_team, ":my_team"),
          (assign, "$g_presentation_obj_escape_menu_2", -1),
          (assign, "$g_presentation_obj_escape_menu_3", -1),
          (assign, "$g_presentation_obj_escape_menu_6", -1),
          (assign, "$g_presentation_obj_escape_menu_7", -1),
          (assign, "$g_presentation_obj_escape_menu_8", -1),
          (assign, "$g_presentation_obj_escape_menu_9", -1),
          (assign, "$g_presentation_obj_escape_menu_10", -1),
          (assign, "$g_presentation_obj_escape_menu_11", -1),
          (assign, "$g_presentation_obj_escape_menu_12", -1),
          (assign, "$g_presentation_obj_escape_menu_13", -1),
          (assign, "$g_presentation_obj_escape_menu_14", -1),
          (try_begin),
            (lt, ":my_team", multi_team_spectator),
            (this_or_next|neq, "$g_multiplayer_game_type", multiplayer_game_type_invasion),
            (eq,":my_team",0),
            (multiplayer_get_my_troop, ":my_troop"),
            (try_begin),
              (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_lords_battle),
              (eq, "$g_multiplayer_troop_classes", 1),
              (player_get_team_no, ":my_team_no", ":my_player_no"),
              (this_or_next|neq,"$g_multiplayer_game_type",multiplayer_game_type_raid),
              (eq,":my_team_no",1),
              (create_button_overlay, "$g_presentation_obj_escape_menu_2", "str_choose_troop", 0),
              (overlay_set_color, "$g_presentation_obj_escape_menu_2", 0xFFFFFF),
            (try_end),
            (try_begin),
              (ge, ":my_troop", 0),
              (create_button_overlay, "$g_presentation_obj_escape_menu_3", "str_choose_items", 0),
              (overlay_set_color, "$g_presentation_obj_escape_menu_3", 0xFFFFFF),
            (try_end),
          (try_end),
          (create_button_overlay, "$g_presentation_obj_escape_menu_4", "str_options", 0),
          (overlay_set_color, "$g_presentation_obj_escape_menu_4", 0xFFFFFF),
          (create_button_overlay, "$g_presentation_obj_escape_menu_5", "str_redefine_keys", 0),
          (overlay_set_color, "$g_presentation_obj_escape_menu_5", 0xFFFFFF),
          
          (create_button_overlay, "$g_presentation_obj_escape_menu_13", "@Show game rules", 0),
          (overlay_set_color, "$g_presentation_obj_escape_menu_13", 0xFFFFFF),
          
          (try_begin),
            (this_or_next|eq, "$g_multiplayer_maps_voteable", 1),
            (this_or_next|eq, "$g_multiplayer_factions_voteable", 1),
            (this_or_next|gt, "$g_multiplayer_num_bots_voteable", 0),
            (this_or_next|eq, "$g_multiplayer_kick_voteable", 1),
            (eq, "$g_multiplayer_ban_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_escape_menu_6", "str_submit_a_poll", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_6", 0xFFFFFF),
            (assign, "$g_presentation_obj_escape_menu_6_available", 1),
            (try_begin),
              (ge, ":my_player_no", 0),
              (player_get_slot, ":last_poll_time", ":my_player_no", slot_player_poll_disabled_until_time),
              (store_mission_timer_a, ":mission_timer"),
              (lt, ":mission_timer", ":last_poll_time"),
              (overlay_set_color, "$g_presentation_obj_escape_menu_6", 0x888888),
              (overlay_set_hilight_color, "$g_presentation_obj_escape_menu_6", 0x888888),
              (assign, "$g_presentation_obj_escape_menu_6_available", 0),
            (try_end),
          (try_end),
          
          (try_begin),
            (ge, ":my_player_no", 0),
            (player_is_admin, ":my_player_no"),
            (create_button_overlay, "$g_presentation_obj_escape_menu_7", "str_administrator_panel", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_7", 0xFFFFFF),
            (create_button_overlay, "$g_presentation_obj_escape_menu_8", "str_kick_player", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_8", 0xFFFFFF),
            (create_button_overlay, "$g_presentation_obj_escape_menu_9", "str_ban_player", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_9", 0xFFFFFF),
            (create_button_overlay, "$g_presentation_obj_escape_menu_14", "@Admin tools panel", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_14", 0xFFFFFF),
          (try_end),
          
          (create_button_overlay, "$g_presentation_obj_escape_menu_11", "str_mute_player", 0),
          (overlay_set_color, "$g_presentation_obj_escape_menu_11", 0xFFFFFF),
          
          (try_begin),
            (assign, "$g_presentation_obj_escape_menu_12", -1),
            (assign, ":any_muted", 0),
            (get_max_players, ":num_players"),
            (try_for_range, ":player_no", 0, ":num_players"),
              (player_is_active, ":player_no"),
              (player_get_is_muted, ":is_muted", ":player_no"),
              (eq, ":is_muted", 1),
              (assign, ":any_muted", 1),
            (try_end),
            (eq, ":any_muted", 1),
            (create_button_overlay, "$g_presentation_obj_escape_menu_12", "str_unmute_player", 0),
            (overlay_set_color, "$g_presentation_obj_escape_menu_12", 0xFFFFFF),
          (try_end),
          
          (create_button_overlay, "$g_presentation_obj_escape_menu_10", "str_quit", 0),
          (overlay_set_color, "$g_presentation_obj_escape_menu_10", 0xFFFFFF),
          
          (position_set_x, pos1, 130),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_escape_menu_1", pos1),
          (try_begin),
            (ge, "$g_presentation_obj_escape_menu_2", 0),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_2", pos1),
          (try_end),
          (try_begin),
            (ge, "$g_presentation_obj_escape_menu_3", 0),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_3", pos1),
          (try_end),
          (val_sub, ":cur_y", escape_menu_item_height),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_escape_menu_4", pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_escape_menu_5", pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_escape_menu_13", pos1),
          (try_begin),
            (ge, "$g_presentation_obj_escape_menu_6", 0),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_6", pos1),
          (try_end),
          (try_begin),
            (ge, "$g_presentation_obj_escape_menu_7", 0),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_7", pos1),
          (try_end),
          (try_begin),
            (ge, "$g_presentation_obj_escape_menu_8", 0),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_8", pos1),
          (try_end),
          (try_begin),
            (ge, "$g_presentation_obj_escape_menu_9", 0),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_9", pos1),
          (try_end),
          (try_begin),
            (ge, "$g_presentation_obj_escape_menu_14", 0),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_14", pos1),
          (try_end),
          (val_sub, ":cur_y", escape_menu_item_height),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_escape_menu_11", pos1),
          (try_begin),
            (ge, "$g_presentation_obj_escape_menu_12", 0),
            (val_sub, ":cur_y", escape_menu_item_height),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_escape_menu_12", pos1),
          (try_end),
          (val_sub, ":cur_y", escape_menu_item_height),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, "$g_presentation_obj_escape_menu_10", pos1),
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (try_begin),
            (eq, ":object", "$g_presentation_obj_escape_menu_1"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_team_select"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_2"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_troop_select"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_3"),
            (presentation_set_duration, 0),
            (assign, "$g_presentation_state", 0),
            (start_presentation, "prsnt_multiplayer_item_select"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_4"),
            (presentation_set_duration, 0),
            (change_screen_options),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_5"),
            (presentation_set_duration, 0),
            (change_screen_controls),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_6"),
            (eq, "$g_presentation_obj_escape_menu_6_available", 1),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_multiplayer_poll_menu"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_7"),
            (presentation_set_duration, 0),
            (multiplayer_send_message_to_server, multiplayer_event_open_admin_panel),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_8"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", plat_kick), #admin kick
            (start_presentation, "prsnt_multiplayer_show_players_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_9"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", plat_ban), #admin ban
            (start_presentation, "prsnt_multiplayer_show_players_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_10"),
            (presentation_set_duration, 0),
            (finish_mission, 0),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_11"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", plat_mute), #mute player
            (start_presentation, "prsnt_multiplayer_show_players_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_12"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", plat_unmute), #unmute player
            (start_presentation, "prsnt_multiplayer_show_players_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_13"),
            (presentation_set_duration, 0),
            (multiplayer_send_message_to_server, multiplayer_event_open_game_rules),
          (else_try),
            (eq, ":object", "$g_presentation_obj_escape_menu_14"),
            (presentation_set_duration, 0),
            (try_begin),
              (neg|multiplayer_is_server),
              (try_for_players,":player"),
                (player_is_active,":player"),
                (player_set_slot,":player",slot_player_is_immortal,0),
              (try_end),
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_immortal, -4),#get player data
            (try_end),
            (start_presentation, "prsnt_multiplayer_admin_tools"),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (gt, ":cur_time", 200),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_poll_menu", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
          (position_set_x, pos1, 250),
          (position_set_y, pos1, 80),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, reg0, pos1),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_poll_menu_container", s0, tf_scrollable_style_2),
          (position_set_x, pos1, 285),
          (position_set_y, pos1, 125),
          (overlay_set_position, "$g_presentation_obj_poll_menu_container", pos1),
          (position_set_x, pos1, 405),
          (position_set_y, pos1, 500),
          (overlay_set_area_size, "$g_presentation_obj_poll_menu_container", pos1),
          (set_container_overlay, "$g_presentation_obj_poll_menu_container"),
          
          (assign, "$g_presentation_obj_poll_menu_1", -1),
          (assign, "$g_presentation_obj_poll_menu_4", -1),
          (assign, "$g_presentation_obj_poll_menu_5", -1),
          
          (assign, ":cur_y", 450),
          
          (create_text_overlay, reg0, "str_choose_a_poll_type", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          
          (position_set_x, pos1, 60),
          
          (try_begin),
            (eq, "$g_multiplayer_gametype_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_6", "@Change game type", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_6", 0xFFFFFF),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_6", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
          (try_end),
          (try_begin),
            (eq, "$g_multiplayer_maps_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_1", "str_poll_for_changing_the_map", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_1", 0xFFFFFF),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_1", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
          (try_end),
          (try_begin),
            (eq, "$g_multiplayer_factions_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_4", "str_poll_for_changing_the_map_and_factions", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_4", 0xFFFFFF),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_4", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
          (try_end),
          (try_begin),
            (gt, "$g_multiplayer_num_bots_voteable", 0),
            (create_button_overlay, "$g_presentation_obj_poll_menu_5", "str_poll_for_changing_number_of_bots", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_5", 0xFFFFFF),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_5", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
          (try_end),
          (try_begin),
            (eq, "$g_multiplayer_kick_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_2", "str_poll_for_kicking_a_player", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_2", 0xFFFFFF),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_2", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
          (try_end),
          (try_begin),
            (eq, "$g_multiplayer_ban_voteable", 1),
            (create_button_overlay, "$g_presentation_obj_poll_menu_3", "str_poll_for_banning_a_player", 0),
            (overlay_set_color, "$g_presentation_obj_poll_menu_3", 0xFFFFFF),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, "$g_presentation_obj_poll_menu_3", pos1),
          (try_end),
          
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (try_begin),
            (eq, ":object", "$g_presentation_obj_poll_menu_1"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_maps_list_action_type", 1), #poll map
            (start_presentation, "prsnt_multiplayer_show_maps_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_poll_menu_2"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", plat_pollkick), #poll kick
            (start_presentation, "prsnt_multiplayer_show_players_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_poll_menu_3"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_players_list_action_type", plat_pollban), #poll ban
            (start_presentation, "prsnt_multiplayer_show_players_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_poll_menu_4"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_maps_list_action_type", 2), #poll map and factions
            (start_presentation, "prsnt_multiplayer_show_maps_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_poll_menu_5"),
            (presentation_set_duration, 0),
            (assign, "$g_multiplayer_number_of_bots_list_action_type", 1), #for team 1
            (start_presentation, "prsnt_multiplayer_show_number_of_bots_list"),
          (else_try),
            (eq, ":object", "$g_presentation_obj_poll_menu_6"),
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_show_game_mode_list"),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (gt, ":cur_time", 200),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_show_players_list", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
          (position_set_x, pos1, 250),
          (position_set_y, pos1, 80),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, reg0, pos1),
          
          (try_begin),
            (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_slay),
            #(this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_give_hammer),
            (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_heal),
            (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_swap_spec),
            (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_refill),
            (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_fix_shield),
            (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_immortal),
            (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_mortal),
            (eq, "$g_multiplayer_players_list_action_type", plat_swap_team),
            (create_game_button_overlay, "$g_presentation_credits_obj_1", "@All Players"),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 50),
            (overlay_set_position, "$g_presentation_credits_obj_1", pos1),
          (else_try),
            (assign,"$g_presentation_credits_obj_1",-1),
          (try_end),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_show_players_1", s0, tf_scrollable_style_2),
          (position_set_x, pos1, 285),
          (position_set_y, pos1, 125),
          (overlay_set_position, "$g_presentation_obj_show_players_1", pos1),
          (position_set_x, pos1, 405),
          (position_set_y, pos1, 500),
          (overlay_set_area_size, "$g_presentation_obj_show_players_1", pos1),
          (set_container_overlay, "$g_presentation_obj_show_players_1"),
          
          #(assign, ":cur_y", 450),
          (multiplayer_get_my_player, ":my_player_no"),
          
          (assign, ":cur_y", 10),
          (try_for_players, ":player_no"),
            (player_is_active, ":player_no"),
            
            (assign, ":continue", 0),
            (try_begin),
              (neq, "$g_multiplayer_players_list_action_type", plat_mute),
              (neq, "$g_multiplayer_players_list_action_type", plat_unmute),
              (neq, "$g_multiplayer_players_list_action_type", plat_slay),
              (neq, "$g_multiplayer_players_list_action_type", plat_give_hammer),
              (neq, "$g_multiplayer_players_list_action_type", plat_beacon),
              (neq, "$g_multiplayer_players_list_action_type", plat_heal),
              (neq, "$g_multiplayer_players_list_action_type", plat_swap_spec),
              (neq, "$g_multiplayer_players_list_action_type", plat_swap_team),
              (neq, "$g_multiplayer_players_list_action_type", plat_refill),
              (neq, "$g_multiplayer_players_list_action_type", plat_fix_shield),
              (neq, "$g_multiplayer_players_list_action_type", plat_teleport_me),
              (neq, "$g_multiplayer_players_list_action_type", plat_teleport_him),
              (neq, "$g_multiplayer_players_list_action_type", plat_mortal),
              (neq, "$g_multiplayer_players_list_action_type", plat_immortal),
              (assign, ":continue", 1),
            (else_try),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_slay),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_give_hammer),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_beacon),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_refill),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_fix_shield),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_teleport_me),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_teleport_him),
              (eq, "$g_multiplayer_players_list_action_type", plat_heal),
              (player_get_agent_id,":agent",":player_no"),
              (try_begin),
                (agent_is_active,":agent"),
                (agent_is_alive,":agent"),
                (try_begin),
                  (neq, "$g_multiplayer_players_list_action_type", plat_heal),
                  (assign, ":continue", 1),
                (else_try),
                  (store_agent_hit_points,":hp",":agent"),
                  (lt,":hp",99),
                  (assign, ":continue", 1),
                (try_end),
              (try_end),
            (else_try),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_swap_team),
              (eq, "$g_multiplayer_players_list_action_type", plat_swap_spec),
              (player_get_team_no,":team",":player_no"),
              (is_between,":team",0,2),
              (assign, ":continue", 1),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_mute),
              (neq, ":player_no", ":my_player_no"),
              (player_get_is_muted, ":is_muted", ":player_no"),
              (eq, ":is_muted", 0),
              (assign, ":continue", 1),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_unmute),
              (neq, ":player_no", ":my_player_no"),
              (player_get_is_muted, ":is_muted", ":player_no"),
              (eq, ":is_muted", 1),
              (assign, ":continue", 1),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_mortal),
              (player_slot_eq,":player_no",slot_player_is_immortal,1),
              (assign, ":continue", 1),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_immortal),
              (player_slot_eq,":player_no",slot_player_is_immortal,0),
              (assign, ":continue", 1),
            (try_end),
            (eq, ":continue", 1),
            
            (val_add, ":cur_y", escape_menu_item_height),
          (try_end),
          
          (create_text_overlay, reg0, "str_choose_a_player", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          
          (try_for_players, ":player_no"),
            (player_is_active, ":player_no"),
            (player_set_slot, ":player_no", slot_player_button_index, -1),
            
            (assign, ":continue", 0),
            (try_begin),
              (neq, "$g_multiplayer_players_list_action_type", plat_mute),
              (neq, "$g_multiplayer_players_list_action_type", plat_unmute),
              (neq, "$g_multiplayer_players_list_action_type", plat_slay),
              (neq, "$g_multiplayer_players_list_action_type", plat_give_hammer),
              (neq, "$g_multiplayer_players_list_action_type", plat_beacon),
              (neq, "$g_multiplayer_players_list_action_type", plat_heal),
              (neq, "$g_multiplayer_players_list_action_type", plat_swap_spec),
              (neq, "$g_multiplayer_players_list_action_type", plat_swap_team),
              (neq, "$g_multiplayer_players_list_action_type", plat_refill),
              (neq, "$g_multiplayer_players_list_action_type", plat_fix_shield),
              (neq, "$g_multiplayer_players_list_action_type", plat_teleport_me),
              (neq, "$g_multiplayer_players_list_action_type", plat_teleport_him),
              (neq, "$g_multiplayer_players_list_action_type", plat_mortal),
              (neq, "$g_multiplayer_players_list_action_type", plat_immortal),
              (assign, ":continue", 1),
            (else_try),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_slay),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_give_hammer),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_beacon),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_refill),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_fix_shield),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_teleport_me),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_teleport_him),
              (eq, "$g_multiplayer_players_list_action_type", plat_heal),
              (player_get_agent_id,":agent",":player_no"),
              (try_begin),
                (agent_is_active,":agent"),
                (agent_is_alive,":agent"),
                (try_begin),
                  (neq, "$g_multiplayer_players_list_action_type", plat_heal),
                  (assign, ":continue", 1),
                (else_try),
                  (store_agent_hit_points,":hp",":agent"),
                  (lt,":hp",99),
                  (assign, ":continue", 1),
                (try_end),
              (try_end),
            (else_try),
              (this_or_next|eq, "$g_multiplayer_players_list_action_type", plat_swap_team),
              (eq, "$g_multiplayer_players_list_action_type", plat_swap_spec),
              (player_get_team_no,":team",":player_no"),
              (is_between,":team",0,2),
              (assign, ":continue", 1),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_mute),
              (neq, ":player_no", ":my_player_no"),
              (player_get_is_muted, ":is_muted", ":player_no"),
              (eq, ":is_muted", 0),
              (assign, ":continue", 1),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_unmute),
              (neq, ":player_no", ":my_player_no"),
              (player_get_is_muted, ":is_muted", ":player_no"),
              (eq, ":is_muted", 1),
              (assign, ":continue", 1),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_mortal),
              (player_slot_eq,":player_no",slot_player_is_immortal,1),
              (assign, ":continue", 1),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_immortal),
              (player_slot_eq,":player_no",slot_player_is_immortal,0),
              (assign, ":continue", 1),
            (try_end),
            (eq, ":continue", 1),
            (str_store_player_username, s0, ":player_no"),
            
            (create_button_overlay, ":overlay_id", s0, 0),
            (overlay_set_color, ":overlay_id", 0xFFFFFF),
            (position_set_x, pos1, 130),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, ":overlay_id", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
            (player_set_slot, ":player_no", slot_player_button_index, ":overlay_id"),
          (try_end),
          
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (try_begin),
            (eq,":object","$g_presentation_credits_obj_1"),
            (try_begin),
              (eq, "$g_multiplayer_players_list_action_type", plat_slay), #admin slay
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_slay_player, -2),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_heal), #admin heal
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_heal_player, -2),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_swap_team), #admin swap team
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_swap_player_team, -2),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_swap_spec), #admin swap spec
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_swap_player_spectator, -2),
              # (else_try),
              # (eq, "$g_multiplayer_players_list_action_type", plat_give_hammer), #admin give hammer
              # (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_give_thors_hammer, -2),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_refill),
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_refill_player, -2),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_fix_shield),
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_fix_player_shield, -2),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_mortal),
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_immortal, -3),
            (else_try),
              (eq, "$g_multiplayer_players_list_action_type", plat_immortal),
              (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_immortal, -2),
            (try_end),
            (presentation_set_duration, 0),
          (else_try),
            
            (assign,":continue",1),
            (try_for_players, ":player_no"),
              (eq,":continue",1),
              (player_is_active, ":player_no"),
              (player_slot_eq, ":player_no", slot_player_button_index, ":object"),
              (try_begin),
                (is_between, "$g_multiplayer_players_list_action_type", plat_pollkick, plat_pollban+1), #poll kick or poll ban
                (try_begin),
                  (multiplayer_get_my_player, ":my_player_no"),
                  (ge, ":my_player_no", 0),
                  (multiplayer_send_2_int_to_server, multiplayer_event_start_new_poll, "$g_multiplayer_players_list_action_type", ":player_no"),
                  (store_mission_timer_a, ":mission_timer"),
                  (val_add, ":mission_timer", multiplayer_poll_disable_period),
                  (player_set_slot, ":my_player_no", slot_player_poll_disabled_until_time, ":mission_timer"),
                (try_end),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_kick), #admin kick
                (multiplayer_send_int_to_server, multiplayer_event_admin_kick_player, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_ban), #admin ban
                (multiplayer_send_int_to_server, multiplayer_event_admin_ban_player, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_slay), #admin slay
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_slay_player, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_heal), #admin heal
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_heal_player, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_swap_team), #admin swap team
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_swap_player_team, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_swap_spec), #admin swap spec
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_swap_player_spectator, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_give_hammer), #admin give hammer
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_give_thors_hammer, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_beacon), #admin beacon player
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_beacon_player, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_mute), #mute player
                (player_set_is_muted, ":player_no", 1),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_unmute), #unmute player
                (player_set_is_muted, ":player_no", 0),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_refill),
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_refill_player, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_fix_shield),
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_fix_player_shield, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_teleport_me),
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_teleport_me, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_teleport_him),
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_teleport_him, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_mortal),
                (multiplayer_send_2_int_to_server, multiplayer_event_admin, me_admin_immortal, ":player_no"),
              (else_try),
                (eq, "$g_multiplayer_players_list_action_type", plat_immortal),
                (multiplayer_send_3_int_to_server, multiplayer_event_admin, me_admin_immortal, ":player_no", 1),
              (try_end),
              (assign,":continue",0), #break
              (presentation_set_duration, 0),
            (try_end),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (gt, ":cur_time", 200),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_show_maps_list", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
          (position_set_x, pos1, 250),
          (position_set_y, pos1, 80),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, reg0, pos1),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_show_maps_list_menu_container", s0, tf_scrollable_style_2),
          (position_set_x, pos1, 285),
          (position_set_y, pos1, 125),
          (overlay_set_position, "$g_presentation_obj_show_maps_list_menu_container", pos1),
          (position_set_x, pos1, 405),
          (position_set_y, pos1, 500),
          (overlay_set_area_size, "$g_presentation_obj_show_maps_list_menu_container", pos1),
          (set_container_overlay, "$g_presentation_obj_show_maps_list_menu_container"),
          
          (call_script, "script_multiplayer_fill_map_game_types", "$g_multiplayer_game_type"),
          (assign, ":num_maps", reg0),
          (store_mul, ":cur_y", ":num_maps", escape_menu_item_height),
          (val_add, ":cur_y", 10),
          
          (create_text_overlay, reg0, "str_choose_a_map", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          
          (assign, ":overlay_id", -1),
          (try_for_range, ":i_map", 0, ":num_maps"),
            (store_add, ":map_slot", ":i_map", multi_data_maps_for_game_type_begin),
            (troop_get_slot, ":map_no", "trp_multiplayer_data", ":map_slot"),
            (try_begin),
              (is_between,":map_no",multiplayer_addon_scenes_begin,multiplayer_addon_scenes_end),
              (store_sub, ":string_index", ":map_no", multiplayer_addon_scenes_begin),
              (val_add, ":string_index", multiplayer_addon_scene_names_begin),
            (else_try),
              (store_sub, ":string_index", ":map_no", multiplayer_scenes_begin),
              (val_add, ":string_index", multiplayer_scene_names_begin),
            (try_end),
            (str_store_string, s0, ":string_index"),
            
            (create_button_overlay, ":overlay_id", s0, 0),
            (overlay_set_color, ":overlay_id", 0xFFFFFF),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, ":overlay_id", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
          (try_end),
          (store_add, "$g_show_maps_list_button_list_end_index", ":overlay_id", 1),
          (store_sub, "$g_show_maps_list_button_list_first_index", "$g_show_maps_list_button_list_end_index", ":num_maps"),
          
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (try_for_range, ":i_button", "$g_show_maps_list_button_list_first_index", "$g_show_maps_list_button_list_end_index"),
            (eq, ":object", ":i_button"),
            (call_script, "script_multiplayer_fill_map_game_types", "$g_multiplayer_game_type"),
            (store_sub, ":map_slot", ":object", "$g_show_maps_list_button_list_first_index"),
            (val_add, ":map_slot", multi_data_maps_for_game_type_begin),
            (troop_get_slot, ":scene_id", "trp_multiplayer_data", ":map_slot"),
            (presentation_set_duration, 0),
            (try_begin),
              (eq, "$g_multiplayer_maps_list_action_type", 1), #vote for map
              (try_begin),
                (multiplayer_get_my_player, ":my_player_no"),
                (ge, ":my_player_no", 0),
                (multiplayer_send_2_int_to_server, multiplayer_event_start_new_poll, 0, ":scene_id"),
                (store_mission_timer_a, ":mission_timer"),
                (val_add, ":mission_timer", multiplayer_poll_disable_period),
                (player_set_slot, ":my_player_no", slot_player_poll_disabled_until_time, ":mission_timer"),
              (try_end),
            (else_try), #vote for map and factions
              (assign, "$g_multiplayer_factions_list_action_type", 1), #for team 1
              (assign, "$g_multiplayer_poll_for_map_and_faction_data_map", ":scene_id"),
              (start_presentation, "prsnt_multiplayer_show_factions_list"),
            (try_end),
            (assign, "$g_show_maps_list_button_list_end_index", 0), #break;
          (try_end),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (gt, ":cur_time", 200),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_show_factions_list", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
          (position_set_x, pos1, 250),
          (position_set_y, pos1, 80),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, reg0, pos1),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_show_factions_list_menu_container", s0, tf_scrollable_style_2),
          (position_set_x, pos1, 285),
          (position_set_y, pos1, 125),
          (overlay_set_position, "$g_presentation_obj_show_factions_list_menu_container", pos1),
          (position_set_x, pos1, 405),
          (position_set_y, pos1, 500),
          (overlay_set_area_size, "$g_presentation_obj_show_factions_list_menu_container", pos1),
          (set_container_overlay, "$g_presentation_obj_show_factions_list_menu_container"),
          
          (store_sub, ":num_factions", mp_factions_end, mp_factions_begin),
          (try_begin),
            (eq, "$g_multiplayer_factions_list_action_type", 2),
            (val_sub, ":num_factions", 1),
          (try_end),
          (store_mul, ":cur_y", ":num_factions", escape_menu_item_height),
          (val_add, ":cur_y", 10),
          
          (assign, reg0, "$g_multiplayer_factions_list_action_type"),
          (create_text_overlay, reg0, "str_choose_a_faction_for_team_reg0", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          
          (assign, ":overlay_id", -1),
          (try_for_range, ":i_faction", mp_factions_begin, mp_factions_end),
            (this_or_next|eq, "$g_multiplayer_factions_list_action_type", 1),
            (neq, "$g_multiplayer_poll_for_map_and_faction_data_faction_1", ":i_faction"),
            (str_store_faction_name, s0, ":i_faction"),
            (create_button_overlay, ":overlay_id", s0, 0),
            (overlay_set_color, ":overlay_id", 0xFFFFFF),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, ":overlay_id", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
          (try_end),
          (store_add, "$g_show_factions_list_button_list_end_index", ":overlay_id", 1),
          (store_sub, "$g_show_factions_list_button_list_first_index", "$g_show_factions_list_button_list_end_index", ":num_factions"),
          
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (try_for_range, ":i_button", "$g_show_factions_list_button_list_first_index", "$g_show_factions_list_button_list_end_index"),
            (eq, ":object", ":i_button"),
            (store_sub, ":faction_no", ":object", "$g_show_factions_list_button_list_first_index"),
            (val_add, ":faction_no", mp_factions_begin),
            (presentation_set_duration, 0),
            (try_begin),
              (eq, "$g_multiplayer_factions_list_action_type", 2), #vote for second team
              (try_begin),
                (ge, ":faction_no", "$g_multiplayer_poll_for_map_and_faction_data_faction_1"),
                (val_add, ":faction_no", 1),
              (try_end),
              (try_begin),
                (multiplayer_get_my_player, ":my_player_no"),
                (ge, ":my_player_no", 0),
                (multiplayer_send_4_int_to_server, multiplayer_event_start_new_poll, 3, "$g_multiplayer_poll_for_map_and_faction_data_map", "$g_multiplayer_poll_for_map_and_faction_data_faction_1", ":faction_no"),
                (store_mission_timer_a, ":mission_timer"),
                (val_add, ":mission_timer", multiplayer_poll_disable_period),
                (player_set_slot, ":my_player_no", slot_player_poll_disabled_until_time, ":mission_timer"),
              (try_end),
            (else_try), #vote for first team
              (assign, "$g_multiplayer_factions_list_action_type", 2), #for team 2
              (assign, "$g_multiplayer_poll_for_map_and_faction_data_faction_1", ":faction_no"),
              (start_presentation, "prsnt_multiplayer_show_factions_list"),
            (try_end),
            (assign, "$g_show_factions_list_button_list_end_index", 0), #break;
          (try_end),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (gt, ":cur_time", 200),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_show_number_of_bots_list", prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
          (position_set_x, pos1, 250),
          (position_set_y, pos1, 80),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, reg0, pos1),
          
          (str_clear, s0),
          (create_text_overlay, "$g_presentation_obj_show_number_of_bots_list_menu_container", s0, tf_scrollable_style_2),
          (position_set_x, pos1, 285),
          (position_set_y, pos1, 125),
          (overlay_set_position, "$g_presentation_obj_show_number_of_bots_list_menu_container", pos1),
          (position_set_x, pos1, 405),
          (position_set_y, pos1, 500),
          (overlay_set_area_size, "$g_presentation_obj_show_number_of_bots_list_menu_container", pos1),
          (set_container_overlay, "$g_presentation_obj_show_number_of_bots_list_menu_container"),
          
          (assign, ":num_options", 0),
          (store_add, ":end_cond", "$g_multiplayer_num_bots_voteable", 1),
          (try_for_range, ":i_number", 0, ":end_cond"),
            (assign, ":i_number_mod_5", ":i_number"),
            (val_mod, ":i_number_mod_5", 5),
            (this_or_next|lt, ":i_number", 10),
            (eq, ":i_number_mod_5", 0),
            (val_add, ":num_options", 1),
          (try_end),
          
          (store_mul, ":cur_y", ":num_options", escape_menu_item_height),
          (val_add, ":cur_y", 10),
          
          (assign, reg0, "$g_multiplayer_number_of_bots_list_action_type"),
          (create_text_overlay, reg0, "str_choose_number_of_bots_for_team_reg0", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (val_sub, ":cur_y", escape_menu_item_height),
          
          (assign, ":overlay_id", -1),
          (try_for_range, ":i_number", 0, ":end_cond"),
            (assign, ":i_number_mod_5", ":i_number"),
            (val_mod, ":i_number_mod_5", 5),
            (this_or_next|lt, ":i_number", 10),
            (eq, ":i_number_mod_5", 0),
            (assign, reg0, ":i_number"),
            (str_store_string, s0, "str_reg0"),
            (create_button_overlay, ":overlay_id", s0, 0),
            (overlay_set_color, ":overlay_id", 0xFFFFFF),
            (position_set_x, pos1, 100),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, ":overlay_id", pos1),
            (val_sub, ":cur_y", escape_menu_item_height),
          (try_end),
          (store_add, "$g_show_number_of_bots_list_button_list_end_index", ":overlay_id", 1),
          (store_sub, "$g_show_number_of_bots_list_button_list_first_index", "$g_show_number_of_bots_list_button_list_end_index", ":num_options"),
          
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (try_for_range, ":i_button", "$g_show_number_of_bots_list_button_list_first_index", "$g_show_number_of_bots_list_button_list_end_index"),
            (eq, ":object", ":i_button"),
            (store_sub, ":value_index", ":object", "$g_show_number_of_bots_list_button_list_first_index"),
            (try_begin),
              (lt, ":value_index", 10),
              (assign, ":used_value", ":value_index"),
            (else_try),
              (store_sub, ":used_value", ":value_index", 8),
              (val_mul, ":used_value", 5),
            (try_end),
            (presentation_set_duration, 0),
            (try_begin),
              (eq, "$g_multiplayer_number_of_bots_list_action_type", 2), #vote for second team
              (try_begin),
                (multiplayer_get_my_player, ":my_player_no"),
                (ge, ":my_player_no", 0),
                (multiplayer_send_3_int_to_server, multiplayer_event_start_new_poll, 4, "$g_multiplayer_poll_number_of_bots_team_1", ":used_value"),
                (store_mission_timer_a, ":mission_timer"),
                (val_add, ":mission_timer", multiplayer_poll_disable_period),
                (player_set_slot, ":my_player_no", slot_player_poll_disabled_until_time, ":mission_timer"),
              (try_end),
            (else_try), #vote for first team
              (assign, "$g_multiplayer_number_of_bots_list_action_type", 2), #for team 2
              (assign, "$g_multiplayer_poll_number_of_bots_team_1", ":used_value"),
              (start_presentation, "prsnt_multiplayer_show_number_of_bots_list"),
            (try_end),
            (assign, "$g_show_number_of_bots_list_button_list_end_index", 0), #break;
          (try_end),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (key_clicked, key_pad_start),
            (gt, ":cur_time", 200),
            (presentation_set_duration, 0),
          (try_end),
      ]),
  ]),
  
  ("multiplayer_poll", prsntf_read_only|prsntf_manual_end_only, 0, [
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          (create_mesh_overlay, reg0, "mesh_white_plane"),
          (overlay_set_color, reg0, 0x000000),
          (overlay_set_alpha, reg0, 0x44),
          (position_set_x, pos1, 50),
          (position_set_y, pos1, 50),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 37500),
          (position_set_y, pos1, 4500),
          (overlay_set_size, reg0, pos1),
          
          (try_begin),
            (eq, "$g_multiplayer_poll_to_show", 0),
            
            (try_begin),
              (is_between,"$g_multiplayer_poll_value_to_show",multiplayer_addon_scenes_begin,multiplayer_addon_scenes_end),
              (store_sub, ":string_index", "$g_multiplayer_poll_value_to_show", multiplayer_addon_scenes_begin),
              (val_add, ":string_index", multiplayer_addon_scene_names_begin),
            (else_try),
              (store_sub, ":string_index", "$g_multiplayer_poll_value_to_show", multiplayer_scenes_begin),
              (val_add, ":string_index", multiplayer_scene_names_begin),
            (try_end),
            (str_store_string, s0, ":string_index"),
            (create_text_overlay, reg0, "str_poll_change_map", tf_center_justify),
          (else_try),
            (eq, "$g_multiplayer_poll_to_show", 1),
            (str_store_player_username, s0, "$g_multiplayer_poll_value_to_show"),
            (create_text_overlay, reg0, "str_poll_kick_player", tf_center_justify),
          (else_try),
            (eq, "$g_multiplayer_poll_to_show", 2),
            (str_store_player_username, s0, "$g_multiplayer_poll_value_to_show"),
            (create_text_overlay, reg0, "str_poll_ban_player", tf_center_justify),
          (else_try),
            (eq, "$g_multiplayer_poll_to_show", 3),
            (try_begin),
              (is_between,"$g_multiplayer_poll_value_to_show",multiplayer_addon_scenes_begin,multiplayer_addon_scenes_end),
              (store_sub, ":string_index", "$g_multiplayer_poll_value_to_show", multiplayer_addon_scenes_begin),
              (val_add, ":string_index", multiplayer_addon_scene_names_begin),
            (else_try),
              (store_sub, ":string_index", "$g_multiplayer_poll_value_to_show", multiplayer_scenes_begin),
              (val_add, ":string_index", multiplayer_scene_names_begin),
            (try_end),
            (str_store_string, s0, ":string_index"),
            (str_store_faction_name, s1, "$g_multiplayer_poll_value_2_to_show"),
            (str_store_faction_name, s2, "$g_multiplayer_poll_value_3_to_show"),
            (create_text_overlay, reg0, "str_poll_change_map_with_faction", tf_center_justify|tf_scrollable_style_2),
          (else_try),
            (eq, "$g_multiplayer_poll_to_show", 4),
            (assign, reg0, "$g_multiplayer_poll_value_to_show"),
            (assign, reg1, "$g_multiplayer_poll_value_2_to_show"),
            (str_store_faction_name, s0, "$g_multiplayer_team_1_faction"),
            (str_store_faction_name, s1, "$g_multiplayer_team_2_faction"),
            (create_text_overlay, reg0, "str_poll_change_number_of_bots", tf_center_justify|tf_scrollable_style_2),
          (else_try),
            (eq, "$g_multiplayer_poll_to_show", 5),
            (store_add, ":string", "str_multi_game_type_1", "$g_multiplayer_poll_value_to_show"),
            (str_store_string,s1,":string"),
            (create_text_overlay, reg0, "str_poll_to_change_gametype", tf_center_justify),
          (try_end),
          (overlay_set_color, reg0, 0xFFFFFF),
          (try_begin),
            (neq, "$g_multiplayer_poll_to_show", 3),
            (neq, "$g_multiplayer_poll_to_show", 4),
            (position_set_x, pos1, 400),
            (position_set_y, pos1, 100),
            (overlay_set_position, reg0, pos1),
          (else_try),
            (position_set_x, pos1, 50),
            (position_set_y, pos1, 70),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 60),
            (overlay_set_area_size, reg0, pos1),
          (try_end),
          
          (store_mission_timer_a, ":mission_timer"),
          (store_sub, "$g_multiplayer_poll_last_written_seconds_left", "$g_multiplayer_poll_client_end_time", ":mission_timer"),
          (assign, reg0, "$g_multiplayer_poll_last_written_seconds_left"),
          
          (create_text_overlay, "$g_presentation_obj_poll_1", "str_poll_time_left", tf_right_align|tf_single_line),
          (overlay_set_color, "$g_presentation_obj_poll_1", 0xFFFFFF),
          (position_set_x, pos1, 790),
          (position_set_y, pos1, 60),
          (overlay_set_position, "$g_presentation_obj_poll_1", pos1),
          
          (omit_key_once, key_1),
          (omit_key_once, key_2),
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_run,
        [(store_trigger_param_1, ":cur_time"),
          (try_begin),
            (this_or_next|key_clicked, key_escape),
            (this_or_next|key_clicked, key_pad_start),
            (key_clicked, key_2),
            (gt, ":cur_time", 500),
            (multiplayer_send_int_to_server, multiplayer_event_answer_to_poll, 0),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
          (else_try),
            (key_clicked, key_1),
            (gt, ":cur_time", 500),
            (multiplayer_send_int_to_server, multiplayer_event_answer_to_poll, 1),
            (clear_omitted_keys),
            (presentation_set_duration, 0),
          (try_end),
          (store_mission_timer_a, ":mission_timer"),
          (store_sub, ":time_left", "$g_multiplayer_poll_client_end_time", ":mission_timer"),
          (try_begin),
            (neq, ":time_left", "$g_multiplayer_poll_last_written_seconds_left"),
            (try_begin),
              (lt, ":time_left", 0),
              (clear_omitted_keys),
              (presentation_set_duration, 0),
            (else_try),
              (assign, "$g_multiplayer_poll_last_written_seconds_left", ":time_left"),
              (assign, reg0, "$g_multiplayer_poll_last_written_seconds_left"),
              (overlay_set_text, "$g_presentation_obj_poll_1", "str_poll_time_left"),
            (try_end),
          (try_end),
      ]),
  ]),
  
  ("tutorial_show_mouse_movement",prsntf_read_only|prsntf_manual_end_only,0,[
      (ti_on_presentation_load,
        [
          (try_begin),
            (this_or_next|eq, "$g_tutorial_mouse_dir", -1),
            (eq, "$g_tutorial_mouse_click", -1),
            (presentation_set_duration, 0),
          (else_try),
            (set_fixed_point_multiplier, 1000),
            (assign, "$g_tutorial_displayed_mouse_dir", "$g_tutorial_mouse_dir"),
            (assign, "$g_tutorial_displayed_mouse_click", "$g_tutorial_mouse_click"),
            (store_add, ":arrow_mesh", "$g_tutorial_mouse_dir", "mesh_mouse_arrow_down"),
            (create_mesh_overlay, reg0, ":arrow_mesh"),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 380),
            (position_set_y, pos1, 500),
            (overlay_set_position, reg0, pos1),
            (try_begin),
              (eq, "$g_tutorial_mouse_click", 0),
              (create_mesh_overlay, reg0, "mesh_mouse_left_click"),
            (else_try),
              (create_mesh_overlay, reg0, "mesh_mouse_right_click"),
            (try_end),
            (position_set_x, pos1, 800),
            (position_set_y, pos1, 800),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 540),
            (position_set_y, pos1, 500),
            (overlay_set_position, reg0, pos1),
            (create_mesh_overlay, reg0, "mesh_mouse_arrow_plus"),
            (overlay_set_color, reg0, 0xFFFFFF),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, 470),
            (position_set_y, pos1, 510),
            (overlay_set_position, reg0, pos1),
            (presentation_set_duration, 999999),
          (try_end),
      ]),
      (ti_on_presentation_run,
        [(try_begin),
            (this_or_next|neq, "$g_tutorial_displayed_mouse_dir", "$g_tutorial_mouse_dir"),
            (neq, "$g_tutorial_displayed_mouse_click", "$g_tutorial_mouse_click"),
            (presentation_set_duration, 0),
            (try_begin),
              (ge, "$g_tutorial_mouse_dir", 0),
              (ge, "$g_tutorial_mouse_click", 0),
              (start_presentation, "prsnt_tutorial_show_mouse_movement"),
            (try_end),
          (try_end),
      ]),
  ]),
  
  ("name_kingdom",0,0,[
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          
          ###mesh de fondo
          (create_mesh_overlay, reg0, "mesh_pic_troop_trees"),
          (position_set_x, pos1, -1),
          (position_set_y, pos1, -1),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1002),
          (position_set_y, pos1, 1002),
          (overlay_set_size, reg0, pos1),
          
          (str_store_string, s1, "str_name_kingdom_text"),
          (create_text_overlay, reg1, s1, tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 500),
          (overlay_set_position, reg1, pos1),
          (overlay_set_text, reg1, s1),
          (create_simple_text_box_overlay, "$g_presentation_obj_name_kingdom_1"),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 400),
          (overlay_set_position, "$g_presentation_obj_name_kingdom_1", pos1),
          (try_begin),
            (eq, "$players_kingdom_name_set", 1),
            (str_store_faction_name, s7, "fac_player_supporters_faction"),
            (overlay_set_text, "$g_presentation_obj_name_kingdom_1", s7),
          (else_try),
            (str_store_troop_name, s0, "trp_player"),
            (overlay_set_text, "$g_presentation_obj_name_kingdom_1", "str_default_kingdom_name"),
            (str_store_string, s7, "str_default_kingdom_name"),
          (try_end),
          (overlay_set_color, "$g_presentation_obj_name_kingdom_1", 0xFFFFFF),
          
          (create_text_overlay, reg1, "@The", tf_center_justify),
          (position_set_x, pos1, 360),
          (position_set_y, pos1, 400),
          (overlay_set_position, reg1, pos1),
          
          (create_button_overlay, "$g_presentation_obj_name_kingdom_2", "str_continue", tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 300),
          (overlay_set_position, "$g_presentation_obj_name_kingdom_2", pos1),
          (presentation_set_duration, 999999),
      ]),
      (ti_on_presentation_event_state_change,
        [(store_trigger_param_1, ":object"),
          (try_begin),
            (eq, ":object", "$g_presentation_obj_name_kingdom_1"),
            (str_store_string, s7, s0),
          (else_try),
            (eq, ":object", "$g_presentation_obj_name_kingdom_2"),
            (faction_set_name, "fac_player_supporters_faction", s7),
            (assign, "$players_kingdom_name_set", 1),
            (presentation_set_duration, 0),
            #added v-2637
            (set_trigger_result,1),
            (assign, "$factionorders_type", factionorders_no),
            (start_presentation, "prsnt_faction_screen_main"),
          (try_end),
      ]),
  ]),
  
  ("banner_selection",0,mesh_load_window,[
      (ti_on_presentation_load,
        [(set_fixed_point_multiplier, 1000),
          (str_store_string, s1, "str_banner_selection_text"),
          (create_text_overlay, reg1, s1, tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 600),
          (overlay_set_position, reg1, pos1),
          (overlay_set_text, reg1, s1),
          (create_button_overlay, "$g_presentation_obj_banner_selection_1", "@Next Page", tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 50),
          (overlay_set_position, "$g_presentation_obj_banner_selection_1", pos1),
          
          (assign, ":x_pos", 150),
          (assign, ":y_pos", 575),
          (store_mul, ":begin_mesh", 16, "$g_presentation_page_no"),
          (val_add, ":begin_mesh", banner_meshes_begin),
        (store_add, ":try_end", ":begin_mesh", 16),
      (val_min, ":try_end", banner_meshes_end),
      (store_add, "$g_presentation_banner_start", "$g_presentation_obj_banner_selection_1", 1),
    (try_for_range, ":cur_banner_mesh", ":begin_mesh", ":try_end"),
      (create_image_button_overlay, reg1, ":cur_banner_mesh", ":cur_banner_mesh"),
      (position_set_x, pos1, ":x_pos"),
      (position_set_y, pos1, ":y_pos"),
      (overlay_set_position, reg1, pos1),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 100),
      (overlay_set_size, reg1, pos1),
      (val_add, ":x_pos", 100),
      (ge, ":x_pos", 900),
      (assign, ":x_pos", 150),
      (val_sub, ":y_pos", 250),
    (try_end),
    (presentation_set_duration, 999999),
]),

(ti_on_presentation_event_state_change,
  [(store_trigger_param_1, ":object"),
    (try_begin),
      (eq, ":object", "$g_presentation_obj_banner_selection_1"),
      (val_add, "$g_presentation_page_no", 1),
      (store_sub, ":max_pages", banner_meshes_end, banner_meshes_begin),
      (val_div, ":max_pages", 16),
      (val_add, ":max_pages", 1),
      (val_mod, "$g_presentation_page_no", ":max_pages"),
      (start_presentation, "prsnt_banner_selection"),
    (else_try),
      (store_sub, ":selected_banner", ":object", "$g_presentation_banner_start"),
      (store_mul, ":page_adder", 16, "$g_presentation_page_no"),
      (val_add, ":selected_banner", ":page_adder"),
      (store_add, ":selected_banner_map_icon", ":selected_banner", banner_map_icons_begin),
      (party_set_banner_icon, "p_main_party", ":selected_banner_map_icon"),
      (store_add, ":selected_banner_spr", ":selected_banner", banner_scene_props_begin),
      (troop_set_slot, "trp_player", slot_troop_banner_scene_prop, ":selected_banner_spr"),
      
      #Correcting banners according to the player banner
      #(assign, ":end_cond", active_npcs_end),
      #(try_for_range, ":cur_troop", original_kingdom_heroes_begin, ":end_cond"),
      #  (troop_slot_eq, ":cur_troop", slot_troop_banner_scene_prop, ":selected_banner_spr"),
      #  (str_store_troop_name, s7, ":cur_troop"),
      #  (display_message, "@{!}DEBUGS : {s7}'s banner is changed"),
      #  (troop_set_slot, ":cur_troop", slot_troop_banner_scene_prop, banner_scene_props_end_minus_one),
      #  (assign, ":end_cond", 0),
      #(try_end),
      
      (presentation_set_duration, 0),
      (assign, ":troop_to_change", -1),
      (assign, ":end_cond", active_npcs_end),
      (try_for_range, ":cur_troop", active_npcs_begin, ":end_cond"),
        (troop_slot_eq, ":cur_troop", slot_troop_banner_scene_prop, ":selected_banner_spr"),
        (assign, ":troop_to_change", ":cur_troop"),
        (assign, ":end_cond", 0),
      (try_end),
      
      #find a new banner for the troop with the banner the player has selected
      (assign, ":cur_banner_icon", -1),
      (try_begin),
        (neq, ":troop_to_change", -1),
        (call_script, "script_give_troop_next_banner", ":troop_to_change"),
      (try_end),
      
      (try_for_range, ":cur_center", walled_centers_begin, walled_centers_end),
        (try_begin),
          (party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
          (party_set_banner_icon, ":cur_center", ":selected_banner_map_icon"),
        (else_try),
          (neq, ":troop_to_change", -1),
          (party_slot_eq, ":cur_center", slot_town_lord, ":troop_to_change"),
          (neq, ":cur_banner_icon", -1),
          (party_set_banner_icon, ":cur_center", ":cur_banner_icon"),
        (try_end),
      (try_end),
    (try_end),
]),

(ti_on_presentation_run,
  [(try_begin),
      (this_or_next|key_clicked, key_space),
      (this_or_next|key_clicked, key_enter),
      (this_or_next|key_clicked, key_escape),
      (this_or_next|key_clicked, key_back_space),
      (this_or_next|key_clicked, key_pad_start),
      (this_or_next|key_clicked, key_pad_ltrigger),
      (key_clicked, key_pad_rtrigger),
      (presentation_set_duration, 0),
    (try_end),
    
]),
]),

# ("custom_banner", 0, mesh_load_window,
# [
# (ti_on_presentation_load,
# [
# (set_fixed_point_multiplier, 1000),
# (troop_get_slot, ":flag_type", "trp_player", slot_troop_custom_banner_flag_type),
# (val_max, ":flag_type", 0),
# (val_add, ":flag_type", custom_banner_flag_types_begin),
# (troop_get_slot, ":map_flag_type", "trp_player", slot_troop_custom_banner_map_flag_type),
# (val_max, ":map_flag_type", 0),
# (val_add, ":map_flag_type", custom_banner_flag_map_types_begin),
# ##        (create_mesh_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_1", ":flag_type", "tableau_custom_banner_square", "trp_player"),
# (troop_get_slot, ":bg_color_1", "trp_player", slot_troop_custom_banner_bg_color_1),
# (troop_get_slot, ":bg_color_2", "trp_player", slot_troop_custom_banner_bg_color_2),

# (create_text_overlay, reg1, "str_color_no_1", 0),
# (position_set_x, pos1, 40),
# (position_set_y, pos1, 550),
# (overlay_set_position, reg1, pos1),
# (create_text_overlay, reg1, "str_color_no_2", 0),
# (position_set_x, pos1, 40),
# (position_set_y, pos1, 500),
# (overlay_set_position, reg1, pos1),

# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_22", "mesh_color_picker", "tableau_color_picker", ":bg_color_1"),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_23", "mesh_color_picker", "tableau_color_picker", ":bg_color_2"),
# (position_set_x, pos1, 200),
# (position_set_y, pos1, 565),
# (overlay_set_position, "$g_presentation_obj_custom_banner_22", pos1),
# (position_set_y, pos1, 515),
# (overlay_set_position, "$g_presentation_obj_custom_banner_23", pos1),
# (position_set_x, pos1, 250),
# (position_set_y, pos1, 250),
# (overlay_set_size, "$g_presentation_obj_custom_banner_22", pos1),
# (overlay_set_size, "$g_presentation_obj_custom_banner_23", pos1),

# (create_button_overlay, "$g_presentation_obj_custom_banner_2", "str_change", tf_center_justify),
# (create_button_overlay, "$g_presentation_obj_custom_banner_3", "str_change", tf_center_justify),
# (create_button_overlay, "$g_presentation_obj_custom_banner_4", "str_change_background", tf_center_justify),
# (create_button_overlay, "$g_presentation_obj_custom_banner_5", "str_change", tf_center_justify),
# (create_button_overlay, "$g_presentation_obj_custom_banner_19", "str_change", tf_center_justify),
# (create_button_overlay, "$g_presentation_obj_custom_banner_20", "str_accept", tf_center_justify),
# (troop_get_slot, ":num_charges", "trp_player", slot_troop_custom_banner_num_charges),
# (create_button_overlay, "$g_presentation_obj_custom_banner_16", "str_randomize", tf_center_justify),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_17", ":flag_type", "tableau_custom_banner_default", "trp_player"),
# (try_begin),
# (eq, ":map_flag_type", "mesh_custom_map_banner_01"),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_18", ":map_flag_type", "tableau_custom_banner_square", "trp_player"),
# (else_try),
# (eq, ":map_flag_type", "mesh_custom_map_banner_02"),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_18", ":map_flag_type", "tableau_custom_banner_short", "trp_player"),
# (else_try),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_18", ":map_flag_type", "tableau_custom_banner_tall", "trp_player"),
# (try_end),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_1", -1, "tableau_custom_banner_square_no_mesh", "trp_player"),
# (create_text_overlay, reg1, "str_sample_banner", tf_center_justify),
# (position_set_x, pos1, 825),
# (position_set_y, pos1, 650),
# (overlay_set_position, reg1, pos1),
# (create_text_overlay, reg1, "str_sample_map_banner", tf_center_justify),
# (position_set_y, pos1, 500),
# (overlay_set_position, reg1, pos1),

# (position_set_x, pos1, 800),
# (position_set_y, pos1, 640),
# (overlay_set_position, "$g_presentation_obj_custom_banner_17", pos1),
# (position_set_x, pos1, 780),
# (position_set_y, pos1, 315),
# (overlay_set_position, "$g_presentation_obj_custom_banner_18", pos1),
# (position_set_x, pos1, 50),
# (position_set_y, pos1, 50),
# (overlay_set_size, "$g_presentation_obj_custom_banner_17", pos1),
# (position_set_x, pos1, 50),
# (position_set_y, pos1, 50),
# (overlay_set_size, "$g_presentation_obj_custom_banner_18", pos1),


# (create_text_overlay, reg1, "str_number_of_charges", 0),
# (position_set_x, pos1, 40),
# (position_set_y, pos1, 350),
# (overlay_set_position, reg1, pos1),

# (assign, reg1, ":num_charges"),
# (create_text_overlay, reg2, "str_reg1", tf_center_justify),
# (position_set_x, pos1, 350),
# (position_set_y, pos1, 350),
# (overlay_set_position, reg2, pos1),
# (try_begin),
# (lt, ":num_charges", 4),
# (create_button_overlay, "$g_presentation_obj_custom_banner_15", "str_plus", tf_center_justify),
# (position_set_x, pos1, 385),
# (position_set_y, pos1, 350),
# (overlay_set_position, "$g_presentation_obj_custom_banner_15", pos1),
# (else_try),
# (assign, "$g_presentation_obj_custom_banner_15", -1),
# (try_end),
# (try_begin),
# (gt, ":num_charges", 0),
# (create_button_overlay, "$g_presentation_obj_custom_banner_21", "str_minus", tf_center_justify),
# (position_set_x, pos1, 370),
# (position_set_y, pos1, 350),
# (overlay_set_position, "$g_presentation_obj_custom_banner_21", pos1),
# (else_try),
# (assign, "$g_presentation_obj_custom_banner_21", -1),
# (try_end),

# (try_begin),
# (ge, ":num_charges", 1),
# (create_text_overlay, reg1, "str_charge", tf_center_justify),
# (position_set_x, pos1, 300),
# (position_set_y, pos1, 300),
# (overlay_set_position, reg1, pos1),
# (create_text_overlay, reg1, "str_color", tf_center_justify),
# (position_set_x, pos1, 550),
# (position_set_y, pos1, 300),
# (overlay_set_position, reg1, pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_14", "str_change_charge_position", tf_center_justify),
# (position_set_y, pos1, 350),
# (position_set_x, pos1, 550),
# (overlay_set_position, "$g_presentation_obj_custom_banner_14", pos1),

# (create_text_overlay, reg1, "str_charge_no_1", 0),
# (position_set_x, pos1, 40),
# (position_set_y, pos1, 240),
# (overlay_set_position, reg1, pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_6", "str_change", 0),
# (position_set_x, pos1, 310),
# (overlay_set_position, "$g_presentation_obj_custom_banner_6", pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_7", "str_change", 0),
# (position_set_x, pos1, 560),
# (overlay_set_position, "$g_presentation_obj_custom_banner_7", pos1),
# (troop_get_slot, ":cur_charge", "trp_player", slot_troop_custom_banner_charge_type_1),
# (val_mod, ":cur_charge", 256),
# (val_add, ":cur_charge", custom_banner_charges_begin),
# (create_image_button_overlay, "$g_presentation_obj_custom_banner_24", ":cur_charge", ":cur_charge"),
# (position_set_x, pos1, 260),
# (position_set_y, pos1, 255),
# (overlay_set_position, "$g_presentation_obj_custom_banner_24", pos1),
# (position_set_x, pos1, 50),
# (position_set_y, pos1, 50),
# (overlay_set_size, "$g_presentation_obj_custom_banner_24", pos1),
# (troop_get_slot, ":cur_charge_color", "trp_player", slot_troop_custom_banner_charge_color_1),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_28", "mesh_color_picker", "tableau_color_picker", ":cur_charge_color"),
# (position_set_x, pos1, 530),
# (position_set_y, pos1, 255),
# (overlay_set_position, "$g_presentation_obj_custom_banner_28", pos1),
# (position_set_x, pos1, 250),
# (position_set_y, pos1, 250),
# (overlay_set_size, "$g_presentation_obj_custom_banner_28", pos1),

# (create_button_overlay, "$g_presentation_obj_custom_banner_32", "str_flip_horizontal", 0),
# (position_set_x, pos1, 700),
# (position_set_y, pos1, 240),
# (overlay_set_position, "$g_presentation_obj_custom_banner_32", pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_33", "str_flip_vertical", 0),
# (position_set_x, pos1, 800),
# (overlay_set_position, "$g_presentation_obj_custom_banner_33", pos1),
# (try_end),
# (try_begin),
# (ge, ":num_charges", 2),
# (create_text_overlay, reg1, "str_charge_no_2", 0),
# (position_set_x, pos1, 40),
# (position_set_y, pos1, 180),
# (overlay_set_position, reg1, pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_8", "str_change", 0),
# (position_set_x, pos1, 310),
# (overlay_set_position, "$g_presentation_obj_custom_banner_8", pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_9", "str_change", 0),
# (position_set_x, pos1, 560),
# (overlay_set_position, "$g_presentation_obj_custom_banner_9", pos1),
# (troop_get_slot, ":cur_charge", "trp_player", slot_troop_custom_banner_charge_type_2),
# (val_mod, ":cur_charge", 256),
# (val_add, ":cur_charge", custom_banner_charges_begin),
# (create_image_button_overlay, "$g_presentation_obj_custom_banner_25", ":cur_charge", ":cur_charge"),
# (position_set_x, pos1, 260),
# (position_set_y, pos1, 195),
# (overlay_set_position, "$g_presentation_obj_custom_banner_25", pos1),
# (position_set_x, pos1, 50),
# (position_set_y, pos1, 50),
# (overlay_set_size, "$g_presentation_obj_custom_banner_25", pos1),
# (troop_get_slot, ":cur_charge_color", "trp_player", slot_troop_custom_banner_charge_color_2),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_29", "mesh_color_picker", "tableau_color_picker", ":cur_charge_color"),
# (position_set_x, pos1, 530),
# (position_set_y, pos1, 195),
# (overlay_set_position, "$g_presentation_obj_custom_banner_29", pos1),
# (position_set_x, pos1, 250),
# (position_set_y, pos1, 250),
# (overlay_set_size, "$g_presentation_obj_custom_banner_29", pos1),

# (create_button_overlay, "$g_presentation_obj_custom_banner_34", "str_flip_horizontal", 0),
# (position_set_x, pos1, 700),
# (position_set_y, pos1, 180),
# (overlay_set_position, "$g_presentation_obj_custom_banner_34", pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_35", "str_flip_vertical", 0),
# (position_set_x, pos1, 800),
# (overlay_set_position, "$g_presentation_obj_custom_banner_35", pos1),
# (try_end),
# (try_begin),
# (ge, ":num_charges", 3),
# (create_text_overlay, reg1, "str_charge_no_3", 0),
# (position_set_x, pos1, 40),
# (position_set_y, pos1, 120),
# (overlay_set_position, reg1, pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_10", "str_change", 0),
# (position_set_x, pos1, 310),
# (overlay_set_position, "$g_presentation_obj_custom_banner_10", pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_11", "str_change", 0),
# (position_set_x, pos1, 560),
# (overlay_set_position, "$g_presentation_obj_custom_banner_11", pos1),
# (troop_get_slot, ":cur_charge", "trp_player", slot_troop_custom_banner_charge_type_3),
# (val_mod, ":cur_charge", 256),
# (val_add, ":cur_charge", custom_banner_charges_begin),
# (create_image_button_overlay, "$g_presentation_obj_custom_banner_26", ":cur_charge", ":cur_charge"),
# (position_set_x, pos1, 260),
# (position_set_y, pos1, 135),
# (overlay_set_position, "$g_presentation_obj_custom_banner_26", pos1),
# (position_set_x, pos1, 50),
# (position_set_y, pos1, 50),
# (overlay_set_size, "$g_presentation_obj_custom_banner_26", pos1),
# (troop_get_slot, ":cur_charge_color", "trp_player", slot_troop_custom_banner_charge_color_3),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_30", "mesh_color_picker", "tableau_color_picker", ":cur_charge_color"),
# (position_set_x, pos1, 530),
# (position_set_y, pos1, 135),
# (overlay_set_position, "$g_presentation_obj_custom_banner_30", pos1),
# (position_set_x, pos1, 250),
# (position_set_y, pos1, 250),
# (overlay_set_size, "$g_presentation_obj_custom_banner_30", pos1),

# (create_button_overlay, "$g_presentation_obj_custom_banner_36", "str_flip_horizontal", 0),
# (position_set_x, pos1, 700),
# (position_set_y, pos1, 120),
# (overlay_set_position, "$g_presentation_obj_custom_banner_36", pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_37", "str_flip_vertical", 0),
# (position_set_x, pos1, 800),
# (overlay_set_position, "$g_presentation_obj_custom_banner_37", pos1),
# (try_end),
# (try_begin),
# (ge, ":num_charges", 4),
# (create_text_overlay, reg1, "str_charge_no_4", 0),
# (position_set_x, pos1, 40),
# (position_set_y, pos1, 60),
# (overlay_set_position, reg1, pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_12", "str_change", 0),
# (position_set_x, pos1, 310),
# (overlay_set_position, "$g_presentation_obj_custom_banner_12", pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_13", "str_change", 0),
# (position_set_x, pos1, 560),
# (overlay_set_position, "$g_presentation_obj_custom_banner_13", pos1),
# (troop_get_slot, ":cur_charge", "trp_player", slot_troop_custom_banner_charge_type_4),
# (val_mod, ":cur_charge", 256),
# (val_add, ":cur_charge", custom_banner_charges_begin),
# (create_image_button_overlay, "$g_presentation_obj_custom_banner_27", ":cur_charge", ":cur_charge"),
# (position_set_x, pos1, 260),
# (position_set_y, pos1, 75),
# (overlay_set_position, "$g_presentation_obj_custom_banner_27", pos1),
# (position_set_x, pos1, 50),
# (position_set_y, pos1, 50),
# (overlay_set_size, "$g_presentation_obj_custom_banner_27", pos1),
# (troop_get_slot, ":cur_charge_color", "trp_player", slot_troop_custom_banner_charge_color_4),
# (create_image_button_overlay_with_tableau_material, "$g_presentation_obj_custom_banner_31", "mesh_color_picker", "tableau_color_picker", ":cur_charge_color"),
# (position_set_x, pos1, 530),
# (position_set_y, pos1, 75),
# (overlay_set_position, "$g_presentation_obj_custom_banner_31", pos1),
# (position_set_x, pos1, 250),
# (position_set_y, pos1, 250),
# (overlay_set_size, "$g_presentation_obj_custom_banner_31", pos1),

# (create_button_overlay, "$g_presentation_obj_custom_banner_38", "str_flip_horizontal", 0),
# (position_set_x, pos1, 700),
# (position_set_y, pos1, 60),
# (overlay_set_position, "$g_presentation_obj_custom_banner_38", pos1),
# (create_button_overlay, "$g_presentation_obj_custom_banner_39", "str_flip_vertical", 0),
# (position_set_x, pos1, 800),
# (overlay_set_position, "$g_presentation_obj_custom_banner_39", pos1),
# (try_end),

# (position_set_x, pos1, 350),
# (position_set_y, pos1, 400),
# (overlay_set_position, "$g_presentation_obj_custom_banner_1", pos1),
# (position_set_x, pos1, 275),
# (position_set_y, pos1, 550),
# (overlay_set_position, "$g_presentation_obj_custom_banner_2", pos1),
# (position_set_y, pos1, 500),
# (overlay_set_position, "$g_presentation_obj_custom_banner_3", pos1),
# (position_set_x, pos1, 175),
# (position_set_y, pos1, 600),
# (overlay_set_position, "$g_presentation_obj_custom_banner_4", pos1),
# (position_set_x, pos1, 880),
# (position_set_y, pos1, 575),
# (overlay_set_position, "$g_presentation_obj_custom_banner_5", pos1),
# (position_set_y, pos1, 400),
# (overlay_set_position, "$g_presentation_obj_custom_banner_19", pos1),
# (position_set_y, pos1, 650),
# (position_set_x, pos1, 175),
# (overlay_set_position, "$g_presentation_obj_custom_banner_16", pos1),
# (position_set_y, pos1, 150),
# (position_set_x, pos1, 850),
# (overlay_set_position, "$g_presentation_obj_custom_banner_20", pos1),
# (presentation_set_duration, 999999),
# ]),
# (ti_on_presentation_event_state_change,
# [
# (store_trigger_param_1, ":object"),
# (troop_get_slot, ":num_charges", "trp_player", slot_troop_custom_banner_num_charges),
# (try_begin),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_2"),
# (eq, ":object", "$g_presentation_obj_custom_banner_22"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_bg_color_1),
# (start_presentation, "prsnt_color_selection"),
# (else_try),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_3"),
# (eq, ":object", "$g_presentation_obj_custom_banner_23"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_bg_color_2),
# (start_presentation, "prsnt_color_selection"),
# (else_try),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_4"),
# (eq, ":object", "$g_presentation_obj_custom_banner_1"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (start_presentation, "prsnt_banner_background_selection"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_5"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (start_presentation, "prsnt_banner_flag_type_selection"),
# (else_try),
# (ge, ":num_charges", 1),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_6"),
# (eq, ":object", "$g_presentation_obj_custom_banner_24"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_charge_type_1),
# (start_presentation, "prsnt_banner_charge_selection"),
# (else_try),
# (ge, ":num_charges", 1),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_7"),
# (eq, ":object", "$g_presentation_obj_custom_banner_28"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_charge_color_1),
# (start_presentation, "prsnt_color_selection"),
# (else_try),
# (ge, ":num_charges", 2),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_8"),
# (eq, ":object", "$g_presentation_obj_custom_banner_25"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_charge_type_2),
# (start_presentation, "prsnt_banner_charge_selection"),
# (else_try),
# (ge, ":num_charges", 2),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_9"),
# (eq, ":object", "$g_presentation_obj_custom_banner_29"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_charge_color_2),
# (start_presentation, "prsnt_color_selection"),
# (else_try),
# (ge, ":num_charges", 3),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_10"),
# (eq, ":object", "$g_presentation_obj_custom_banner_26"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_charge_type_3),
# (start_presentation, "prsnt_banner_charge_selection"),
# (else_try),
# (ge, ":num_charges", 3),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_11"),
# (eq, ":object", "$g_presentation_obj_custom_banner_30"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_charge_color_3),
# (start_presentation, "prsnt_color_selection"),
# (else_try),
# (ge, ":num_charges", 4),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_12"),
# (eq, ":object", "$g_presentation_obj_custom_banner_27"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_charge_type_4),
# (start_presentation, "prsnt_banner_charge_selection"),
# (else_try),
# (ge, ":num_charges", 4),
# (this_or_next|eq, ":object", "$g_presentation_obj_custom_banner_13"),
# (eq, ":object", "$g_presentation_obj_custom_banner_31"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (assign, "$g_presentation_output_slot", slot_troop_custom_banner_charge_color_4),
# (start_presentation, "prsnt_color_selection"),
# (else_try),
# (ge, ":num_charges", 1),
# (eq, ":object", "$g_presentation_obj_custom_banner_14"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (start_presentation, "prsnt_banner_charge_positioning"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_15"),
# (troop_get_slot, ":num_charges", "trp_player", slot_troop_custom_banner_num_charges),
# (val_add, ":num_charges", 1),
# (val_clamp, ":num_charges", 0, 5),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_num_charges, ":num_charges"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_21"),
# (troop_get_slot, ":num_charges", "trp_player", slot_troop_custom_banner_num_charges),
# (val_sub, ":num_charges", 1),
# (val_clamp, ":num_charges", 0, 5),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_num_charges, ":num_charges"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_16"),
# (call_script, "script_get_random_custom_banner", "trp_player"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_17"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (start_presentation, "prsnt_banner_flag_type_selection"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_18"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (start_presentation, "prsnt_banner_flag_map_type_selection"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_19"),
# (assign, "$g_presentation_next_presentation", "prsnt_custom_banner"),
# (start_presentation, "prsnt_banner_flag_map_type_selection"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_32"),
# (troop_get_slot, ":charge_type", "trp_player", slot_troop_custom_banner_charge_type_1),
# (store_mod, ":charge_type_base", ":charge_type", 256),
# (val_div, ":charge_type", 256),
# (store_mod, ":flag", ":charge_type", 2),
# (val_div, ":charge_type", 2), #remove flag
# (val_add, ":flag", 1),
# (val_mod, ":flag", 2), #switch flag
# (val_mul, ":charge_type", 2),
# (val_add, ":charge_type", ":flag"),
# (val_mul, ":charge_type", 256),
# (val_add, ":charge_type", ":charge_type_base"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_1, ":charge_type"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_34"),
# (troop_get_slot, ":charge_type", "trp_player", slot_troop_custom_banner_charge_type_2),
# (store_mod, ":charge_type_base", ":charge_type", 256),
# (val_div, ":charge_type", 256),
# (store_mod, ":flag", ":charge_type", 2),
# (val_div, ":charge_type", 2), #remove flag
# (val_add, ":flag", 1),
# (val_mod, ":flag", 2), #switch flag
# (val_mul, ":charge_type", 2),
# (val_add, ":charge_type", ":flag"),
# (val_mul, ":charge_type", 256),
# (val_add, ":charge_type", ":charge_type_base"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_2, ":charge_type"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_36"),
# (troop_get_slot, ":charge_type", "trp_player", slot_troop_custom_banner_charge_type_3),
# (store_mod, ":charge_type_base", ":charge_type", 256),
# (val_div, ":charge_type", 256),
# (store_mod, ":flag", ":charge_type", 2),
# (val_div, ":charge_type", 2), #remove flag
# (val_add, ":flag", 1),
# (val_mod, ":flag", 2), #switch flag
# (val_mul, ":charge_type", 2),
# (val_add, ":charge_type", ":flag"),
# (val_mul, ":charge_type", 256),
# (val_add, ":charge_type", ":charge_type_base"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_3, ":charge_type"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_38"),
# (troop_get_slot, ":charge_type", "trp_player", slot_troop_custom_banner_charge_type_4),
# (store_mod, ":charge_type_base", ":charge_type", 256),
# (val_div, ":charge_type", 256),
# (store_mod, ":flag", ":charge_type", 2),
# (val_div, ":charge_type", 2), #remove flag
# (val_add, ":flag", 1),
# (val_mod, ":flag", 2), #switch flag
# (val_mul, ":charge_type", 2),
# (val_add, ":charge_type", ":flag"),
# (val_mul, ":charge_type", 256),
# (val_add, ":charge_type", ":charge_type_base"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_4, ":charge_type"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_33"),
# (troop_get_slot, ":charge_type", "trp_player", slot_troop_custom_banner_charge_type_1),
# (store_div, ":flag", ":charge_type", 512),
# (val_add, ":flag", 1),
# (val_mod, ":flag", 2), #switch flag
# (val_mul, ":flag", 512),
# (val_mod, ":charge_type", 512), #remove flag
# (val_add, ":charge_type", ":flag"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_1, ":charge_type"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_35"),
# (troop_get_slot, ":charge_type", "trp_player", slot_troop_custom_banner_charge_type_2),
# (store_div, ":flag", ":charge_type", 512),
# (val_add, ":flag", 1),
# (val_mod, ":flag", 2), #switch flag
# (val_mul, ":flag", 512),
# (val_mod, ":charge_type", 512), #remove flag
# (val_add, ":charge_type", ":flag"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_2, ":charge_type"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_37"),
# (troop_get_slot, ":charge_type", "trp_player", slot_troop_custom_banner_charge_type_3),
# (store_div, ":flag", ":charge_type", 512),
# (val_add, ":flag", 1),
# (val_mod, ":flag", 2), #switch flag
# (val_mul, ":flag", 512),
# (val_mod, ":charge_type", 512), #remove flag
# (val_add, ":charge_type", ":flag"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_3, ":charge_type"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_39"),
# (troop_get_slot, ":charge_type", "trp_player", slot_troop_custom_banner_charge_type_4),
# (store_div, ":flag", ":charge_type", 512),
# (val_add, ":flag", 1),
# (val_mod, ":flag", 2), #switch flag
# (val_mul, ":flag", 512),
# (val_mod, ":charge_type", 512), #remove flag
# (val_add, ":charge_type", ":flag"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_charge_type_4, ":charge_type"),
# (start_presentation, "prsnt_custom_banner"),
# (else_try),
# (eq, ":object", "$g_presentation_obj_custom_banner_20"),
# (troop_get_slot, ":flag_icon", "trp_player", slot_troop_custom_banner_map_flag_type),
# (try_begin),
# (ge, ":flag_icon", 0),
# (val_add, ":flag_icon", custom_banner_map_icons_begin),
# (party_set_banner_icon, "p_main_party", ":flag_icon"),
# (try_end),
# (presentation_set_duration, 0),
# (try_end),
# ]),
# ##     (ti_on_presentation_run,
# ##      [(try_begin),
# ##         (this_or_next|key_clicked, key_space),
# ##         (this_or_next|key_clicked, key_enter),
# ##         (this_or_next|key_clicked, key_escape),
# ##         (key_clicked, key_back_space),
# ##         (presentation_set_duration, 0),
# ##       (try_end),
# ##       ]),
# ]),

# ("banner_charge_positioning", 0, mesh_load_window,
# [
# (ti_on_presentation_load,
# [
# (set_fixed_point_multiplier, 1000),
# (create_text_overlay, reg1, "str_choose_position", tf_center_justify),
# (position_set_x, pos1, 500),
# (position_set_y, pos1, 600),
# (overlay_set_position, reg1, pos1),
# (assign, ":pos_x", 125),
# (assign, ":pos_y", 400),
# (call_script, "script_get_troop_custom_banner_num_positionings", "trp_player"),
# (assign, ":num_positionings", reg0),
# (store_mul, ":x_needed", ":num_positionings", 125),
# (val_sub, ":x_needed", 25),
# (store_div, ":pos_x", ":x_needed", 2),
# (store_sub, ":pos_x", 500, ":pos_x"),
# (try_for_range, ":cur_positioning", 0, ":num_positionings"),
# (create_image_button_overlay_with_tableau_material, reg1, -1, "tableau_positioning_selection", ":cur_positioning"),
# (position_set_x, pos1, ":pos_x"),
# (position_set_y, pos1, ":pos_y"),
# (val_add, ":pos_x", 125),
# (overlay_set_position, reg1, pos1),
# (troop_set_slot, "trp_temp_array_a", ":cur_positioning", reg1),
# (try_end),
# (presentation_set_duration, 999999),
# ]),
# (ti_on_presentation_event_state_change,
# [
# (store_trigger_param_1, ":object"),
# (call_script, "script_get_troop_custom_banner_num_positionings", "trp_player"),
# (assign, ":num_positionings", reg0),
# (try_for_range, ":trp_slot_index", 0, ":num_positionings"),
# (troop_slot_eq, "trp_temp_array_a", ":trp_slot_index", ":object"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_positioning, ":trp_slot_index"),
# (assign, ":num_positionings", 0),
# (try_end),
# (try_begin),
# (gt, "$g_presentation_next_presentation", 0),
# (start_presentation, "$g_presentation_next_presentation"),
# (else_try),
# (presentation_set_duration, 0),
# (try_end),
# ]),
# ]),

# ("banner_charge_selection", 0, mesh_load_window,
# [
# (ti_on_presentation_load,
# [
# (set_fixed_point_multiplier, 1000),
# (create_text_overlay, reg1, "str_choose_charge", tf_center_justify),

# (position_set_x, pos1, 500),
# (position_set_y, pos1, 650),
# (overlay_set_position, reg1, pos1),
# (assign, ":pos_x", 100),
# (assign, ":pos_y", 600),
# (try_for_range, ":cur_charge", custom_banner_charges_begin, custom_banner_charges_end),
# (create_image_button_overlay, reg1, ":cur_charge", ":cur_charge"),
# (position_set_x, pos1, ":pos_x"),
# (position_set_y, pos1, ":pos_y"),
# (val_add, ":pos_x", 100),
# (try_begin),
# (gt, ":pos_x", 900),
# (assign, ":pos_x", 100),
# (val_sub, ":pos_y", 100),
# (try_end),
# (overlay_set_position, reg1, pos1),
# (position_set_x, pos1, 80),
# (position_set_y, pos1, 80),
# (overlay_set_size, reg1, pos1),
# (store_sub, ":slot_index", ":cur_charge", custom_banner_charges_begin),
# (troop_set_slot, "trp_temp_array_a", ":slot_index", reg1),
# (try_end),
# (presentation_set_duration, 999999),
# ]),
# (ti_on_presentation_event_state_change,
# [
# (store_trigger_param_1, ":object"),
# (assign, ":end_cond", custom_banner_charges_end),
# (val_sub, ":end_cond", custom_banner_charges_begin),
# (try_for_range, ":trp_slot_index", 0, ":end_cond"),
# (troop_slot_eq, "trp_temp_array_a", ":trp_slot_index", ":object"),
# (troop_set_slot, "trp_player", "$g_presentation_output_slot", ":trp_slot_index"),
# (assign, ":end_cond", 0),
# (try_end),
# (try_begin),
# (gt, "$g_presentation_next_presentation", 0),
# (start_presentation, "$g_presentation_next_presentation"),
# (else_try),
# (presentation_set_duration, 0),
# (try_end),
# ]),
# ]),

# ("banner_background_selection", 0, mesh_load_window,
# [
# (ti_on_presentation_load,
# [
# (set_fixed_point_multiplier, 1000),
# (create_text_overlay, reg1, "str_choose_background", tf_center_justify),
# (position_set_x, pos1, 500),
# (position_set_y, pos1, 600),
# (overlay_set_position, reg1, pos1),
# (assign, ":pos_x", 75),
# (assign, ":pos_y", 450),
# (try_for_range, ":cur_banner", custom_banner_backgrounds_begin, custom_banner_backgrounds_end),
# (store_sub, ":slot_index", ":cur_banner", custom_banner_backgrounds_begin),
# (create_image_button_overlay_with_tableau_material, reg1, -1, "tableau_background_selection", ":slot_index"),
# (position_set_x, pos1, ":pos_x"),
# (position_set_y, pos1, ":pos_y"),
# (val_add, ":pos_x", 125),
# (try_begin),
# (gt, ":pos_x", 900),
# (assign, ":pos_x", 75),
# (val_sub, ":pos_y", 125),
# (try_end),
# (overlay_set_position, reg1, pos1),
# (troop_set_slot, "trp_temp_array_a", ":slot_index", reg1),
# (try_end),
# (presentation_set_duration, 999999),
# ]),
# (ti_on_presentation_event_state_change,
# [
# (store_trigger_param_1, ":object"),
# (assign, ":end_cond", custom_banner_backgrounds_end),
# (val_sub, ":end_cond", custom_banner_backgrounds_begin),
# (try_for_range, ":trp_slot_index", 0, ":end_cond"),
# (troop_slot_eq, "trp_temp_array_a", ":trp_slot_index", ":object"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_bg_type, ":trp_slot_index"),
# (assign, ":end_cond", 0),
# (try_end),
# (try_begin),
# (gt, "$g_presentation_next_presentation", 0),
# (start_presentation, "$g_presentation_next_presentation"),
# (else_try),
# (presentation_set_duration, 0),
# (try_end),
# ]),
# ]),

# ("banner_flag_type_selection", 0, mesh_load_window,
# [
# (ti_on_presentation_load,
# [
# (set_fixed_point_multiplier, 1000),
# (create_text_overlay, reg1, "str_choose_flag_type", tf_center_justify),
# (position_set_x, pos1, 500),
# (position_set_y, pos1, 600),
# (overlay_set_position, reg1, pos1),

# (assign, ":pos_x", 435),
# (assign, ":pos_y", 450),
# (try_for_range, ":cur_flag", custom_banner_flag_types_begin, custom_banner_flag_types_end),
# (store_sub, ":slot_index", ":cur_flag", custom_banner_flag_types_begin),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_flag_type, ":slot_index"),
# (create_image_button_overlay_with_tableau_material, reg1, ":cur_flag", "tableau_custom_banner_default", "trp_player"),
# (position_set_x, pos1, ":pos_x"),
# (position_set_y, pos1, ":pos_y"),
# (val_add, ":pos_x", 130),
# (overlay_set_position, reg1, pos1),
# (position_set_x, pos1, 100),
# (position_set_y, pos1, 100),
# (overlay_set_size, reg1, pos1),
# (troop_set_slot, "trp_temp_array_a", ":slot_index", reg1),
# (try_end),
# (presentation_set_duration, 999999),
# ]),
# (ti_on_presentation_event_state_change,
# [
# (store_trigger_param_1, ":object"),
# (assign, ":end_cond", custom_banner_flag_types_end),
# (val_sub, ":end_cond", custom_banner_flag_types_begin),
# (try_for_range, ":trp_slot_index", 0, ":end_cond"),
# (troop_slot_eq, "trp_temp_array_a", ":trp_slot_index", ":object"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_flag_type, ":trp_slot_index"),
# (assign, ":end_cond", 0),
# (try_end),
# (try_begin),
# (gt, "$g_presentation_next_presentation", 0),
# (start_presentation, "$g_presentation_next_presentation"),
# (else_try),
# (presentation_set_duration, 0),
# (try_end),
# ]),
# ]),

# ("banner_flag_map_type_selection", 0, mesh_load_window,
# [
# (ti_on_presentation_load,
# [
# (set_fixed_point_multiplier, 1000),
# (create_text_overlay, reg1, "str_choose_map_flag_type", tf_center_justify),
# (position_set_x, pos1, 500),
# (position_set_y, pos1, 600),
# (overlay_set_position, reg1, pos1),
# (troop_get_slot, ":bg_type", "trp_player", slot_troop_custom_banner_bg_type),
# (val_add, ":bg_type", custom_banner_backgrounds_begin),
# (assign, ":pos_x", 250),
# (assign, ":pos_y", 150),
# (try_for_range, ":cur_flag", custom_banner_flag_map_types_begin, custom_banner_flag_map_types_end),
# (store_sub, ":slot_index", ":cur_flag", custom_banner_flag_map_types_begin),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_map_flag_type, ":slot_index"),
# (try_begin),
# (eq, ":cur_flag", "mesh_custom_map_banner_01"),
# (create_image_button_overlay_with_tableau_material, reg1, ":cur_flag", "tableau_custom_banner_square", "trp_player"),
# (else_try),
# (eq, ":cur_flag", "mesh_custom_map_banner_02"),
# (create_image_button_overlay_with_tableau_material, reg1, ":cur_flag", "tableau_custom_banner_short", "trp_player"),
# (else_try),
# (create_image_button_overlay_with_tableau_material, reg1, ":cur_flag", "tableau_custom_banner_tall", "trp_player"),
# (try_end),
# (position_set_x, pos1, ":pos_x"),
# (position_set_y, pos1, ":pos_y"),
# (val_add, ":pos_x", 200),
# (overlay_set_position, reg1, pos1),
# (position_set_x, pos1, 100),
# (position_set_y, pos1, 100),
# (overlay_set_size, reg1, pos1),
# (troop_set_slot, "trp_temp_array_a", ":slot_index", reg1),
# (try_end),
# (presentation_set_duration, 999999),
# ]),
# (ti_on_presentation_event_state_change,
# [
# (store_trigger_param_1, ":object"),
# (assign, ":end_cond", custom_banner_flag_map_types_end),
# (val_sub, ":end_cond", custom_banner_flag_map_types_begin),
# (try_for_range, ":trp_slot_index", 0, ":end_cond"),
# (troop_slot_eq, "trp_temp_array_a", ":trp_slot_index", ":object"),
# (troop_set_slot, "trp_player", slot_troop_custom_banner_map_flag_type, ":trp_slot_index"),
# (assign, ":end_cond", 0),
# (try_end),
# (try_begin),
# (gt, "$g_presentation_next_presentation", 0),
# (start_presentation, "$g_presentation_next_presentation"),
# (else_try),
# (presentation_set_duration, 0),
# (try_end),
# ]),
# ]),

# ("color_selection", 0, mesh_load_window,
# [
# (ti_on_presentation_load,
# [
# (set_fixed_point_multiplier, 1000),
# (create_text_overlay, reg1, "str_choose_color", tf_center_justify),
# (position_set_x, pos1, 500),
# (position_set_y, pos1, 600),
# (overlay_set_position, reg1, pos1),

# (assign, ":pos_x", 125),
# (assign, ":pos_y", 450),
# (try_for_range, ":i_color", 0, 42),
# (call_script, "script_get_custom_banner_color_from_index", ":i_color"),
# (assign, ":cur_color", reg0),
# (create_image_button_overlay_with_tableau_material, reg1, "mesh_color_picker", "tableau_color_picker", ":cur_color"),
# (position_set_x, pos1, ":pos_x"),
# (position_set_y, pos1, ":pos_y"),
# (val_add, ":pos_x", 50),
# (try_begin),
# (store_mod, ":mod_i_color", ":i_color", 7),
# (eq, ":mod_i_color", 6),
# (assign, ":pos_x", 125),
# (val_sub, ":pos_y", 50),
# (try_end),
# (overlay_set_position, reg1, pos1),
# (position_set_x, pos1, 500),
# (position_set_y, pos1, 500),
# (overlay_set_size, reg1, pos1),
# (store_mul, ":trp_slot_index", ":i_color", 2),
# (store_add, ":trp_slot_color", ":trp_slot_index", 1),
# (troop_set_slot, "trp_temp_array_a", ":trp_slot_index", reg1),
# (troop_set_slot, "trp_temp_array_a", ":trp_slot_color", ":cur_color"),
# (try_end),
# (presentation_set_duration, 999999),
# ]),
# (ti_on_presentation_event_state_change,
# [
# (store_trigger_param_1, ":object"),
# (assign, ":end_cond", 64),
# (try_for_range, ":i_color", 0, ":end_cond"),
# (store_mul, ":trp_slot_index", ":i_color", 2),
# (troop_slot_eq, "trp_temp_array_a", ":trp_slot_index", ":object"),
# (store_add, ":trp_slot_color", ":trp_slot_index", 1),
# (troop_get_slot, ":output_color", "trp_temp_array_a", ":trp_slot_color"),
# (troop_set_slot, "trp_player", "$g_presentation_output_slot", ":output_color"),
# (assign, ":end_cond", 0),
# (try_end),
# (try_begin),
# (gt, "$g_presentation_next_presentation", 0),
# (start_presentation, "$g_presentation_next_presentation"),
# (else_try),
# (presentation_set_duration, 0),
# (try_end),
# ]),
# ]),

("marshal_selection", 0, mesh_load_window,
[
(ti_on_presentation_load,
  [
    (assign, "$g_presentation_obj_marshal_selection_1", -1),
    (assign, "$g_presentation_obj_marshal_selection_2", -1),
    (assign, "$g_presentation_obj_marshal_selection_3", -1),
    (set_fixed_point_multiplier, 1000),
    (assign, "$g_presentation_next_presentation", -1),
    
    (store_add, ":total_renown", "$g_presentation_marshal_selection_max_renown_1", "$g_presentation_marshal_selection_max_renown_2"),
    (faction_get_slot, ":king", "$players_kingdom", slot_faction_leader),
    
    (str_store_troop_name, s1, "$g_presentation_marshal_selection_max_renown_1_troop"),
    (create_text_overlay, reg1, "@Candidate #1: {s1}", tf_center_justify),
      (position_set_x, pos1, 200),
      (position_set_y, pos1, 600),
      (overlay_set_position, reg1, pos1),
      (str_store_troop_name, s1, "$g_presentation_marshal_selection_max_renown_2_troop"),
      (create_text_overlay, reg1, "@Candidate #2: {s1}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg1, pos1),
        (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", "$g_presentation_marshal_selection_max_renown_1_troop"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 100),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", "$g_presentation_marshal_selection_max_renown_2_troop"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        
        (assign, ":lord_index", "$g_presentation_input"),
        (val_add, "$g_presentation_input", 1),
        
        (try_begin),
          (lt, ":lord_index", 0),
          (str_store_troop_name, s1, "$g_presentation_marshal_selection_max_renown_1_troop"),
          (str_store_troop_name, s2, "$g_presentation_marshal_selection_max_renown_2_troop"),
          (str_store_troop_name, s3, ":king"),
          (str_store_faction_name, s4, "$players_kingdom"),
          (create_text_overlay, reg1, "@{s3} of the {s4} wishes to select a new marshal and invites his vassals for a counsel. {s1} and {s2} are the likely candidates.", tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 200),
          (overlay_set_position, reg1, pos1),
          
          (create_button_overlay, "$g_presentation_obj_marshal_selection_1", "str_continue", tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 100),
          (overlay_set_position, "$g_presentation_obj_marshal_selection_1", pos1),
          (assign, "$g_presentation_next_presentation", "prsnt_marshal_selection"),
        (else_try),
          (assign, ":cur_index", ":lord_index"),
          (try_for_range_backwards, ":loop_var", "trp_kingdom_heroes_including_player_begin", active_npcs_end),
            (ge, ":cur_index", 0),
            (assign, ":cur_troop", ":loop_var"),
            (assign, ":continue", 0),
            (try_begin),
              (eq, ":loop_var", "trp_kingdom_heroes_including_player_begin"),
              (assign, ":cur_troop", "trp_player"),
              (try_begin),
                (eq, "$g_player_is_captive", 0),
                (assign, ":continue", 1),
              (try_end),
            (else_try),
              (store_troop_faction, ":cur_troop_faction", ":cur_troop"),
              (eq, "$players_kingdom", ":cur_troop_faction"),
              #(troop_slot_eq, ":cur_troop", slot_troop_is_prisoner, 0),
              (neg|troop_slot_ge, ":cur_troop", slot_troop_prisoner_of_party, 0),
              (troop_slot_ge, ":cur_troop", slot_troop_leaded_party, 1),
              (troop_slot_eq, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
              (neg|faction_slot_eq, ":cur_troop_faction", slot_faction_leader, ":cur_troop"),
              (assign, ":continue", 1),
            (try_end),
            (eq, ":continue", 1),
            
            (neq, "$g_presentation_marshal_selection_max_renown_1_troop", ":cur_troop"),
            (neq, "$g_presentation_marshal_selection_max_renown_2_troop", ":cur_troop"),
            
            (val_sub, ":cur_index", 1),
            (lt, ":cur_index", 0),
            
            (assign, "$g_presentation_next_presentation", "prsnt_marshal_selection"),
            
            (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", ":cur_troop"),
            (position_set_x, pos1, 300),
            (position_set_y, pos1, 300),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 440),
            (position_set_y, pos1, 400),
            (overlay_set_position, reg1, pos1),
            
            (try_begin),
              (eq, ":cur_troop", "trp_player"),
              (create_text_overlay, reg1, "@Whom do you wish to support?", tf_center_justify),
              (position_set_x, pos1, 500),
              (position_set_y, pos1, 200),
              (overlay_set_position, reg1, pos1),
              (str_store_troop_name, s1, "$g_presentation_marshal_selection_max_renown_1_troop"),
              (create_button_overlay, "$g_presentation_obj_marshal_selection_2", "@{!}{s1}", tf_center_justify),
              (position_set_x, pos1, 300),
              (position_set_y, pos1, 100),
              (overlay_set_position, "$g_presentation_obj_marshal_selection_2", pos1),
              (str_store_troop_name, s1, "$g_presentation_marshal_selection_max_renown_2_troop"),
              (create_button_overlay, "$g_presentation_obj_marshal_selection_3", "@{!}{s1}", tf_center_justify),
              (position_set_x, pos1, 700),
              (position_set_y, pos1, 100),
              (overlay_set_position, "$g_presentation_obj_marshal_selection_3", pos1),
            (else_try),
              (str_store_troop_name, s1, ":cur_troop"),
              (store_random_in_range, ":random_renown", 0, ":total_renown"),
              (val_sub, ":random_renown", "$g_presentation_marshal_selection_max_renown_1"),
              (try_begin),
                (lt, ":random_renown", 0),
                (val_add, "$g_presentation_marshal_selection_1_vote", 1),
                (str_store_troop_name, s2, "$g_presentation_marshal_selection_max_renown_1_troop"),
              (else_try),
                (val_add, "$g_presentation_marshal_selection_2_vote", 1),
                (str_store_troop_name, s2, "$g_presentation_marshal_selection_max_renown_2_troop"),
              (try_end),
              (create_text_overlay, reg1, "@{s1} gives his support to {s2}.", tf_center_justify),
              (position_set_x, pos1, 500),
              (position_set_y, pos1, 200),
              (overlay_set_position, reg1, pos1),
              
              (create_button_overlay, "$g_presentation_obj_marshal_selection_1", "str_continue", tf_center_justify),
              (position_set_x, pos1, 500),
              (position_set_y, pos1, 100),
              (overlay_set_position, "$g_presentation_obj_marshal_selection_1", pos1),
            (try_end),
          (try_end),
        (try_end),
        
        (assign, reg0, "$g_presentation_marshal_selection_1_vote"),
        (create_text_overlay, reg1, "@Number of Supporters: {reg0}", tf_center_justify),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, "$g_presentation_marshal_selection_2_vote"),
        (create_text_overlay, reg1, "@Number of Supporters: {reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        
        (try_begin),
          (lt, "$g_presentation_next_presentation", 0),
          (try_begin),
            (gt, "$g_presentation_marshal_selection_2_vote", "$g_presentation_marshal_selection_1_vote"),
            (assign, ":local_temp", "$g_presentation_marshal_selection_max_renown_1_troop"),
            (assign, "$g_presentation_marshal_selection_max_renown_1_troop", "$g_presentation_marshal_selection_max_renown_2_troop"),
            (assign, "$g_presentation_marshal_selection_max_renown_2_troop", ":local_temp"),
          (try_end),
          #Winner is set to g_presentation_marshal_selection_max_renown_1_troop
          (str_store_troop_name, s1, "$g_presentation_marshal_selection_max_renown_1_troop"),
          (str_store_troop_name, s2, ":king"),
          (str_store_faction_name, s3, "$players_kingdom"),
          (create_text_overlay, reg1, "@{s2} has heard his vassals' counsel. He selects {s1} as the marshal of the {s3}.", tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 200),
          (overlay_set_position, reg1, pos1),
          (create_button_overlay, "$g_presentation_obj_marshal_selection_1", "str_continue", tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 100),
          (overlay_set_position, "$g_presentation_obj_marshal_selection_1", pos1),
        (try_end),
        
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_marshal_selection_2"),
          (val_add, "$g_presentation_marshal_selection_1_vote", 1),
          (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshal_selection_max_renown_1_troop", 2),
          (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshal_selection_max_renown_2_troop", -2),
        (else_try),
          (eq, ":object", "$g_presentation_obj_marshal_selection_3"),
          (val_add, "$g_presentation_marshal_selection_2_vote", 1),
          (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshal_selection_max_renown_1_troop", -2),
          (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshal_selection_max_renown_2_troop", 2),
        (try_end),
        (try_begin),
          (this_or_next|eq, ":object", "$g_presentation_obj_marshal_selection_1"),
          (this_or_next|eq, ":object", "$g_presentation_obj_marshal_selection_2"),
          (eq, ":object", "$g_presentation_obj_marshal_selection_3"),
          (try_begin),
            (ge, "$g_presentation_next_presentation", 0),
            (start_presentation, "$g_presentation_next_presentation"),
          (else_try),
            (try_begin),
              (neg|faction_slot_eq, "$players_kingdom", slot_faction_marshal, "$g_presentation_marshal_selection_max_renown_1_troop"),
              (call_script, "script_check_and_finish_active_army_quests_for_faction", "$players_kingdom"),
            (try_end),
            
            (faction_get_slot, ":old_marshal", "$players_kingdom", slot_faction_marshal),
            (try_begin),
              (ge, ":old_marshal", 0),
              (party_is_active, ":old_marshal"),
              (party_set_marshal, ":old_marshal", 0),
            (try_end),
            
            (faction_set_slot, "$players_kingdom", slot_faction_marshal, "$g_presentation_marshal_selection_max_renown_1_troop"),
            (try_begin),
              (eq, "$g_presentation_marshal_selection_max_renown_1_troop", "trp_player"),
              (call_script, "script_change_player_relation_with_troop", "$g_presentation_marshal_selection_max_renown_2_troop", -3),
            (try_end),
            (assign, "$g_recalculate_ais", 1),
            (assign, "$g_presentation_marshal_selection_ended", 1),
            (presentation_set_duration, 0),
          (try_end),
        (try_end),
    ]),
]),

("battle",0,0,[
    (ti_on_presentation_load,
      [(set_fixed_point_multiplier, 1000),
        (assign, "$g_formation_group0_selected", 0),
        (assign, "$g_formation_group1_selected", 0),
        (assign, "$g_formation_group2_selected", 0),
        (assign, "$g_formation_group3_selected", 0),
        (assign, "$g_formation_group4_selected", 0),
        (assign, "$g_formation_group5_selected", 0),
        (assign, "$g_formation_group6_selected", 0),
        (assign, "$g_formation_group7_selected", 0),
        (assign, "$g_formation_group8_selected", 0),
        (assign, "$g_presentation_obj_battle_but0", -1),
        (assign, "$g_presentation_obj_battle_but1", -1),
        (assign, "$g_presentation_obj_battle_but2", -1),
        (assign, "$g_presentation_obj_battle_but3", -1),
        (assign, "$g_presentation_obj_battle_but4", -1),
        (assign, "$g_presentation_obj_battle_but5", -1),
        (assign, "$g_presentation_obj_battle_but6", -1),
        (assign, "$g_presentation_obj_battle_but7", -1),
        (assign, "$g_presentation_obj_battle_but8", -1),
        (str_clear, s7),
        (close_order_menu),
        (assign, "$native_opening_menu", 0),
        
        (try_for_agents, ":agent_no"),
          (agent_set_slot, ":agent_no", slot_agent_map_overlay_id, 0),
        (try_end),
        
        #tactical cam
        (create_text_overlay, reg1, "@Strategy Camera: press the Enter key.'", tf_center_justify), #arriba centrado
        # (overlay_set_color, reg1, 0x996633), #saddle brown, se ve bien
        # (overlay_set_color, reg1, 0xB7AA9C), #sandstone, demasiado grisaceo
        #(overlay_set_color, reg1, 0xA28A56), #tan
        #(overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
        #(overlay_set_color, reg1, 0xD5D3B6), #Fawn se ve poco
        #  (overlay_set_color, reg1, 0x9ACD32), #Yellow green se ve regular
        #(overlay_set_color, reg1, 0xFFDD21), #Primrose Yellow se ve bien
        ##        (overlay_set_color, reg1, 0xD5C7B6), #Beige se ve poco
        ##        (overlay_set_color, reg1, 0x0x777777), #Traffic Grey se ve bien
        (overlay_set_color, reg1, 0xFFFFFF), #White se ve bien
        #(overlay_set_color, reg1, 0x000000), #Black se ve bien
        (position_set_x, pos1, 810),
        (position_set_y, pos1, 240),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        
        ###
        
        (get_player_agent_no, ":player_agent"),
        (agent_get_troop_id, ":player_troop_id", ":player_agent"),
        
        (position_set_y, pos1, 700),
        (create_text_overlay, reg1, "@Orders", tf_center_justify|tf_single_line|tf_with_outline),
        # (overlay_set_color, reg1, 0xFFAAAAAA),
        (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
        (position_set_x, pos1, 270),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "@Mount", tf_center_justify|tf_single_line|tf_with_outline),
        # (overlay_set_color, reg1, 0xFFAAAAAA),
        (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
        (position_set_x, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "@Attack Order", tf_center_justify|tf_single_line|tf_with_outline),
        #   (overlay_set_color, reg1, 0xFFAAAAAA),
        (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
        (position_set_x, pos1, 550),
        (overlay_set_position, reg1, pos1),
        
        (assign, "$group0_has_troops", 0),
        (assign, "$group1_has_troops", 0),
        (assign, "$group2_has_troops", 0),
        (assign, "$group3_has_troops", 0),
        (assign, "$group4_has_troops", 0),
        (assign, "$group5_has_troops", 0),
        (assign, "$group6_has_troops", 0),
        (assign, "$group7_has_troops", 0),
        (assign, "$group8_has_troops", 0),
        (party_get_num_companion_stacks, ":num_stacks", "p_main_party"),
        (assign, "$num_classes", 0),
        (try_for_range, ":troop_iterator", 0, ":num_stacks"),
          (party_stack_get_troop_id, ":cur_troop_id", "p_main_party", ":troop_iterator"),
          (troop_get_class, ":troop_class", ":cur_troop_id"),
          (neq, ":player_troop_id", ":cur_troop_id"),
          (try_begin),
            (eq, ":troop_class", 0),
            (try_begin),
              (neq, "$group0_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group0_has_troops", 1),
          (else_try),
            (eq, ":troop_class", 1),
            (try_begin),
              (neq, "$group1_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group1_has_troops", 1),
          (else_try),
            (eq, ":troop_class", 2),
            (try_begin),
              (neq, "$group2_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group2_has_troops", 1),
          (else_try),
            (eq, ":troop_class", 3),
            (try_begin),
              (neq, "$group3_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group3_has_troops", 1),
          (else_try),
            (eq, ":troop_class", 4),
            (try_begin),
              (neq, "$group4_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group4_has_troops", 1),
          (else_try),
            (eq, ":troop_class", 5),
            (try_begin),
              (neq, "$group5_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group5_has_troops", 1),
          (else_try),
            (eq, ":troop_class", 6),
            (try_begin),
              (neq, "$group6_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group6_has_troops", 1),
          (else_try),
            (eq, ":troop_class", 7),
            (try_begin),
              (neq, "$group7_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group7_has_troops", 1),
          (else_try),
            (eq, ":troop_class", 8),
            (try_begin),
              (neq, "$group8_has_troops", 1),
              (val_add, "$num_classes", 1),
            (try_end),
            (assign, "$group8_has_troops", 1),
          (try_end),
        (try_end),
        
        (assign, ":stat_position_x", 0),
        (assign, ":stat_position_y", 653),
        (assign, ":stat_position_check_x", 20),
        (assign, ":stat_position_check_y", 662),
        (assign, ":stat_position_name_x", 50),
        (assign, ":stat_position_name_y", 660),
        (try_begin),
          (eq, "$group0_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but0", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but0", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but0", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but0", 0),
          # (overlay_set_color, "$g_presentation_obj_battle_but0", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but0", 0xA28A56),
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check0", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check0", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name0", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name0", pos3),
          
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but0_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but0_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but0_weapon_usage", s7, tf_center_justify),
        (try_end),
        (try_begin),
          (eq, "$group1_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but1", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but1", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but1", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but1", 0),
          # (overlay_set_color, "$g_presentation_obj_battle_but1", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but1", 0xA28A56),
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check1", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check1", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name1", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name1", pos3),
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but1_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but1_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but1_weapon_usage", s7, tf_center_justify),
        (try_end),
        (try_begin),
          (eq, "$group2_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but2", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but2", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but2", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but2", 0),
          # (overlay_set_color, "$g_presentation_obj_battle_but2", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but2", 0xA28A56),
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check2", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check2", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name2", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name2", pos3),
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but2_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but2_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but2_weapon_usage", s7, tf_center_justify),
        (try_end),
        (try_begin),
          (eq, "$group3_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but3", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but3", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but3", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but3", 0),
          #   (overlay_set_color, "$g_presentation_obj_battle_but3", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but3", 0xA28A56),
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check3", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check3", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name3", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name3", pos3),
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but3_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but3_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but3_weapon_usage", s7, tf_center_justify),
        (try_end),
        (try_begin),
          (eq, "$group4_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but4", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but4", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but4", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but4", 0),
          # (overlay_set_color, "$g_presentation_obj_battle_but4", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but4", 0xA28A56),
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check4", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check4", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name4", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name4", pos3),
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but4_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but4_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but4_weapon_usage", s7, tf_center_justify),
        (try_end),
        (try_begin),
          (eq, "$group5_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but5", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but5", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but5", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but5", 0),
          #  (overlay_set_color, "$g_presentation_obj_battle_but5", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but5", 0xA28A56),
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check5", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check5", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name5", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name5", pos3),
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but5_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but5_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but5_weapon_usage", s7, tf_center_justify),
        (try_end),
        (try_begin),
          (eq, "$group6_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but6", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but6", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but6", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but6", 0),
          #   (overlay_set_color, "$g_presentation_obj_battle_but6", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but6", 0xA28A56),
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check6", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check6", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name6", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name6", pos3),
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but6_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but6_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but6_weapon_usage", s7, tf_center_justify),
        (try_end),
        (try_begin),
          (eq, "$group7_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but7", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but7", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but7", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but7", 0),
          # (overlay_set_color, "$g_presentation_obj_battle_but7", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but7", 0xA28A56),
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check7", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check7", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name7", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name7", pos3),
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but7_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but7_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but7_weapon_usage", s7, tf_center_justify),
        (try_end),
        (try_begin),
          (eq, "$group8_has_troops", 1),
          (create_image_button_overlay, "$g_presentation_obj_battle_but8", "mesh_white_plane", "mesh_white_plane"),
          (position_set_x, pos1, ":stat_position_x"),
          (position_set_y, pos1, ":stat_position_y"),
          (overlay_set_position, "$g_presentation_obj_battle_but8", pos1),
          (val_add, ":stat_position_y", -40),
          
          (position_set_x, pos1, 32500),
          (position_set_y, pos1, 2000),
          (overlay_set_size, "$g_presentation_obj_battle_but8", pos1),
          (overlay_set_alpha, "$g_presentation_obj_battle_but8", 0),
          #   (overlay_set_color, "$g_presentation_obj_battle_but8", 0xFFFF00),
          (overlay_set_color, "$g_presentation_obj_battle_but8", 0xA28A56), #tan
          #    (overlay_set_color, "$g_presentation_obj_battle_but8", 0xFFFF00), #yellow background
          
          (create_check_box_overlay, "$g_presentation_obj_battle_check8", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos2, ":stat_position_check_x"),
          (position_set_y, pos2, ":stat_position_check_y"),
          (overlay_set_position, "$g_presentation_obj_battle_check8", pos2),
          (val_add, ":stat_position_check_y", -40),
          
          (create_text_overlay, "$g_presentation_obj_battle_name8", s7, 0),
          (position_set_x, pos3, ":stat_position_name_x"),
          (position_set_y, pos3, ":stat_position_name_y"),
          (overlay_set_position, "$g_presentation_obj_battle_name8", pos3),
          (val_add, ":stat_position_name_y", -40),
          
          (create_text_overlay, "$g_presentation_but8_movement", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but8_riding", s7, tf_center_justify),
          (create_text_overlay, "$g_presentation_but8_weapon_usage", s7, tf_center_justify),
        (try_end),
        
        (get_player_agent_no, ":player_agent"),
        (agent_get_team, ":player_team", ":player_agent"),
        
        (call_script, "script_update_order_panel", ":player_team"),
        
        #(create_button_overlay, "$g_presentation_obj_battle_10", "@Hold This Position", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_11", "@Follow Me", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_12", "@Charge", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_13", "@Advance", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_14", "@Fall Back", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_15", "@Stand Closer", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_16", "@Spread Out", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_17", "@Stand Ground", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_18", "@Mount", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_19", "@Dismount", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_20", "@Use Any Weapon", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_21", "@Use Blunt Weapons", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_28", "@Hold Your Fire", tf_center_justify),
        #(create_button_overlay, "$g_presentation_obj_battle_29", "@Fire At Will", tf_center_justify),
        
        (assign, ":y_position_for_order_buttons", 640),
        (assign, ":addition_y_position", "$num_classes"),
        (val_mul, ":addition_y_position", -40),
        (val_add, ":y_position_for_order_buttons", ":addition_y_position"),
        
        (create_listbox_overlay, "$g_presentation_obj_battle_10", "str_space", 0),
        (create_listbox_overlay, "$g_presentation_obj_battle_11", "str_space", 0),
        (create_listbox_overlay, "$g_presentation_obj_battle_12", "str_space", 0),
        (create_listbox_overlay, "$g_presentation_obj_battle_13", "str_space", 0),
        ###color
        (overlay_set_color, "$g_presentation_obj_battle_10", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_11", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_12", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_13", 0xFFFFFF),
        ####
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Retreat"),
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Stand Ground"),
        ##(overlay_add_item, "$g_presentation_obj_battle_10", "@Spread Out"),
        ##(overlay_add_item, "$g_presentation_obj_battle_10", "@Stand Closer"),
        ##(overlay_add_item, "$g_presentation_obj_battle_10", "@Fall Back"),
        ##(overlay_add_item, "$g_presentation_obj_battle_10", "@Advance"),
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Charge"),
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Follow Me"),
        (overlay_add_item, "$g_presentation_obj_battle_10", "@Hold This Position"),
        
        (create_button_overlay, "$g_presentation_obj_battle_14", "@Spread Out", tf_center_justify|tf_single_line|tf_with_outline),
        (overlay_set_color, "$g_presentation_obj_battle_14", 0xFFFFFFFF),
        (create_button_overlay, "$g_presentation_obj_battle_15", "@Stand Closer", tf_center_justify|tf_single_line|tf_with_outline),
        (overlay_set_color, "$g_presentation_obj_battle_15", 0xFFFFFFFF),
        (create_button_overlay, "$g_presentation_obj_battle_16", "@Fall Back", tf_center_justify|tf_single_line|tf_with_outline),
        (overlay_set_color, "$g_presentation_obj_battle_16", 0xFFFFFFFF),
        (create_button_overlay, "$g_presentation_obj_battle_17", "@Advance", tf_center_justify|tf_single_line|tf_with_outline),
        (overlay_set_color, "$g_presentation_obj_battle_17", 0xFFFFFFFF),
        
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_battle_10", pos1),
        
        (val_add, ":y_position_for_order_buttons", -51),
        (position_set_x, pos1, 205),
        (position_set_y, pos1, ":y_position_for_order_buttons"),
        (val_add, ":y_position_for_order_buttons", 51),
        (overlay_set_position, "$g_presentation_obj_battle_10", pos1),
        # (overlay_set_color, "$g_presentation_obj_battle_10", 0xA28A56), #tan
        
        (overlay_set_alpha, "$g_presentation_obj_battle_10", 0x60),
        (overlay_set_val, "$g_presentation_obj_battle_10", "$g_latest_order_1"),
        
        (val_add, ":y_position_for_order_buttons", -40), #new
        (position_set_x, pos1, 130), #new
        (position_set_y, pos1, ":y_position_for_order_buttons"), #new
        (val_add, ":y_position_for_order_buttons", 40), #new
        (overlay_set_position, "$g_presentation_obj_battle_14", pos1), #new
        #(overlay_set_alpha, "$g_presentation_obj_battle_14", 0x60), #new
        
        (val_add, ":y_position_for_order_buttons", -20), #new
        (position_set_x, pos1, 130), #new
        (position_set_y, pos1, ":y_position_for_order_buttons"), #new
        (val_add, ":y_position_for_order_buttons", 20), #new
        (overlay_set_position, "$g_presentation_obj_battle_15", pos1), #new
        #(overlay_set_alpha, "$g_presentation_obj_battle_15", 0x60), #new
        
        (val_add, ":y_position_for_order_buttons", -0), #new
        (position_set_x, pos1, 130), #new
        (position_set_y, pos1, ":y_position_for_order_buttons"), #new
        (val_add, ":y_position_for_order_buttons", 0), #new
        (overlay_set_position, "$g_presentation_obj_battle_16", pos1), #new
        #(overlay_set_alpha, "$g_presentation_obj_battle_16", 0x60), #new
        
        (val_add, ":y_position_for_order_buttons", 20), #new
        (position_set_x, pos1, 130), #new
        (position_set_y, pos1, ":y_position_for_order_buttons"), #new
        (val_add, ":y_position_for_order_buttons", -20), #new
        (overlay_set_position, "$g_presentation_obj_battle_17", pos1), #new
        #(overlay_set_alpha, "$g_presentation_obj_battle_17", 0x60), #new
        
        
        
        (overlay_add_item, "$g_presentation_obj_battle_11", "@Dismount"),
        (overlay_add_item, "$g_presentation_obj_battle_11", "@Mount"),
        
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_battle_11", pos1),
        
        (position_set_x, pos1, 350),
        (position_set_y, pos1, ":y_position_for_order_buttons"),
        (overlay_set_position, "$g_presentation_obj_battle_11", pos1),
        
        (overlay_set_alpha, "$g_presentation_obj_battle_11", 0x60),
        #  (overlay_set_color, "$g_presentation_obj_battle_11", 0xA28A56), #tan
        (overlay_set_val, "$g_presentation_obj_battle_11", "$g_latest_order_2"),
        
        
        
        (overlay_add_item, "$g_presentation_obj_battle_12", "@Fire At Will"),
        (overlay_add_item, "$g_presentation_obj_battle_12", "@Hold Your Fire"),
        
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_battle_12", pos1),
        
        (position_set_x, pos1, 495),
        (position_set_y, pos1, ":y_position_for_order_buttons"),
        (overlay_set_position, "$g_presentation_obj_battle_12", pos1),
        
        (overlay_set_alpha, "$g_presentation_obj_battle_12", 0x60),
        #  (overlay_set_color, "$g_presentation_obj_battle_12", 0xA28A56), #tan
        (overlay_set_val, "$g_presentation_obj_battle_12", "$g_latest_order_3"),
        
        
        
        (overlay_add_item, "$g_presentation_obj_battle_13", "@Use Blunt Weapons"),
        (overlay_add_item, "$g_presentation_obj_battle_13", "@Use Any Weapon"),
        
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_size, "$g_presentation_obj_battle_13", pos1),
        
        (val_add, ":y_position_for_order_buttons", -35),
        (position_set_x, pos1, 495),
        (position_set_y, pos1, ":y_position_for_order_buttons"),
        (val_add, ":y_position_for_order_buttons", 35),
        (overlay_set_position, "$g_presentation_obj_battle_13", pos1),
        
        (overlay_set_alpha, "$g_presentation_obj_battle_13", 0x60),
        #   (overlay_set_color, "$g_presentation_obj_battle_13", 0xA28A56), #tan
        (overlay_set_val, "$g_presentation_obj_battle_13", "$g_latest_order_4"),
        
        
        
        (create_text_overlay, "$g_presentation_obj_battle_22", "str_us_", 0),
        (create_text_overlay, "$g_presentation_obj_battle_23", "str_allies_", 0),
        (create_text_overlay, "$g_presentation_obj_battle_24", "str_enemies_", 0),
        (create_text_overlay, "$g_presentation_obj_battle_25", "@Ready", tf_center_justify),
        (create_text_overlay, "$g_presentation_obj_battle_26", "@Wounded", tf_center_justify),
        (create_text_overlay, "$g_presentation_obj_battle_28", "str_routed", tf_center_justify),
        (create_text_overlay, "$g_presentation_obj_battle_27", "@Dead", tf_center_justify),
        ##colores
        (overlay_set_color, "$g_presentation_obj_battle_22", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_23", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_24", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_25", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_26", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_27", 0xFFFFFF),
        (overlay_set_color, "$g_presentation_obj_battle_28", 0xFFFFFF),
        #####
        (create_text_overlay, "$g_battle_us_ready", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_us_wounded", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_us_routed", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_us_dead", s7, tf_center_justify),
        
        (create_text_overlay, "$g_battle_enemies_ready", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_enemies_wounded", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_enemies_routed", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_enemies_dead", s7, tf_center_justify),
        
        (create_text_overlay, "$g_battle_allies_ready", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_allies_wounded", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_allies_routed", s7, tf_center_justify),
        (create_text_overlay, "$g_battle_allies_dead", s7, tf_center_justify),
        
        #colores
        (overlay_set_color, "$g_battle_us_ready", 0x000000), #black
        #  (overlay_set_color, "$g_battle_us_ready", 0x006400), #verde oscuro se ve bien
        (overlay_set_color, "$g_battle_us_wounded", 0xE12126), #Atomic Red muy leible
        (overlay_set_color, "$g_battle_us_routed", 0xE12126), #Atomic Red muy leible
        (overlay_set_color, "$g_battle_us_dead", 0xE12126), #Atomic Red muy leible
        
        (overlay_set_color, "$g_battle_enemies_ready", 0x000000), #black
        (overlay_set_color, "$g_battle_enemies_wounded", 0xE12126), #Atomic Red muy leible
        (overlay_set_color, "$g_battle_enemies_routed", 0xE12126), #Atomic Red muy leible
        (overlay_set_color, "$g_battle_enemies_dead", 0xE12126), #Atomic Red muy leible
        
        (overlay_set_color, "$g_battle_allies_ready", 0x000000), #black
        (overlay_set_color, "$g_battle_allies_wounded", 0xE12126), #Atomic Red muy leible
        (overlay_set_color, "$g_battle_allies_routed", 0xE12126), #Atomic Red muy leible
        (overlay_set_color, "$g_battle_allies_dead", 0xE12126), #Atomic Red muy leible
        ###
        ###fondo
        ##     (create_mesh_overlay, reg0, "mesh_white_plane"),
        ##        (overlay_set_color, reg0, 0),
        ##      (position_set_x, pos1, -1),
        ##      (position_set_y, pos1, -1),
        ##      (overlay_set_position, reg0, pos1),
        ##      (position_set_x, pos1, 1002),
        ##      (position_set_y, pos1, 1002),
        ##      (overlay_set_size, reg0, pos1),
        ##        (overlay_set_alpha, reg0, 0x44),
        ##        (overlay_set_color, reg0, 0xFFFFFF),#fondo blanco
        ###
        (create_image_button_overlay, "$g_battle_report_plane", "mesh_white_plane", "mesh_white_plane"),
        (overlay_set_color, "$g_battle_report_plane", 0),
        (position_set_x, pos1, 15500),
        (position_set_y, pos1, 6000),
        (overlay_set_size, "$g_battle_report_plane", pos1),
        (position_set_x, pos1, 672),
        (position_set_y, pos1, 275),
        (overlay_set_position, "$g_battle_report_plane", pos1),
        (overlay_set_alpha, "$g_battle_report_plane", 0x54),
        # (overlay_set_color, "$g_battle_report_plane", 0x1166BB),#fondo azulado
        (overlay_set_color, "$g_battle_report_plane", 0xA28A56), #tan
        
        
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        
        (overlay_set_size, "$g_presentation_obj_battle_14", pos1), #new
        (overlay_set_size, "$g_presentation_obj_battle_15", pos1), #new
        (overlay_set_size, "$g_presentation_obj_battle_16", pos1), #new
        (overlay_set_size, "$g_presentation_obj_battle_17", pos1), #new
        
        (overlay_set_size, "$g_presentation_obj_battle_22", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_23", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_24", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_25", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_26", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_27", pos1),
        (overlay_set_size, "$g_presentation_obj_battle_28", pos1),
        (overlay_set_size, "$g_battle_us_ready", pos1),
        (overlay_set_size, "$g_battle_us_wounded", pos1),
        (overlay_set_size, "$g_battle_us_routed", pos1),
        (overlay_set_size, "$g_battle_us_dead", pos1),
        (overlay_set_size, "$g_battle_enemies_ready", pos1),
        (overlay_set_size, "$g_battle_enemies_wounded", pos1),
        (overlay_set_size, "$g_battle_enemies_routed", pos1),
        (overlay_set_size, "$g_battle_enemies_dead", pos1),
        (overlay_set_size, "$g_battle_allies_ready", pos1),
        (overlay_set_size, "$g_battle_allies_wounded", pos1),
        (overlay_set_size, "$g_battle_allies_routed", pos1),
        (overlay_set_size, "$g_battle_allies_dead", pos1),
        
        (assign, ":stat_position_x", 675),
        (assign, ":stat_position_y", 280),
        
        (val_add, ":stat_position_x", 70),
        (val_add, ":stat_position_y", 90),
        (position_set_x, pos1, ":stat_position_x"),
        (position_set_y, pos1, ":stat_position_y"),
        (overlay_set_position, "$g_presentation_obj_battle_25", pos1),
        (val_add, ":stat_position_x", 70),
        (position_set_x, pos1, ":stat_position_x"),
        (overlay_set_position, "$g_presentation_obj_battle_26", pos1),
        (val_add, ":stat_position_x", 70),
        (position_set_x, pos1, ":stat_position_x"),
        (overlay_set_position, "$g_presentation_obj_battle_28", pos1),
        (val_add, ":stat_position_x", 70),
        (position_set_x, pos1, ":stat_position_x"),
        (overlay_set_position, "$g_presentation_obj_battle_27", pos1),
        
        (val_add, ":stat_position_x", -280),
        (val_add, ":stat_position_y", -30),
        (position_set_x, pos1, ":stat_position_x"),
        (position_set_y, pos1, ":stat_position_y"),
        (overlay_set_position, "$g_presentation_obj_battle_22", pos1),
        (val_add, ":stat_position_y", -30),
        (position_set_y, pos1, ":stat_position_y"),
        (overlay_set_position, "$g_presentation_obj_battle_23", pos1),
        (val_add, ":stat_position_y", -30),
        (position_set_y, pos1, ":stat_position_y"),
        (overlay_set_position, "$g_presentation_obj_battle_24", pos1),
        
        (get_scene_boundaries, pos2, pos3),
        (position_transform_position_to_local, pos4, pos2, pos3),
        (set_fixed_point_multiplier, 1000),
        (position_get_x, ":map_width", pos4),
        (position_get_y, ":map_height", pos4),
        (set_fixed_point_multiplier, 1000),
        (store_div, ":map_ratio", ":map_height", 100),
        (store_div, ":map_ratio", ":map_width", ":map_ratio"),
        (try_begin),
          (gt, ":map_ratio", 100),
          (assign, "$g_battle_map_width", 300),
          (store_div, "$g_battle_map_scale", ":map_width", "$g_battle_map_width"),
          (store_div, "$g_battle_map_height", ":map_height", "$g_battle_map_scale"),
        (else_try),
          (assign, "$g_battle_map_height", 300),
          (store_div, "$g_battle_map_scale", ":map_height", "$g_battle_map_height"),
          (store_div, "$g_battle_map_width", ":map_width", "$g_battle_map_scale"),
        (try_end),
        
        (create_image_button_overlay, "$g_battle_map_plane", "mesh_white_plane", "mesh_white_plane"),
        (overlay_set_color, "$g_battle_map_plane", 0),
        (store_add, ":map_bordered_width", "$g_battle_map_width", 20),
        (store_add, ":map_bordered_height", "$g_battle_map_height", 20),
        (store_mul, ":map_scale_x", ":map_bordered_width", 50),
        (store_mul, ":map_scale_y", ":map_bordered_height", 50),
        (position_set_x, pos1, ":map_scale_x"),
        (position_set_y, pos1, ":map_scale_y"),
        (overlay_set_size, "$g_battle_map_plane", pos1),
        (store_sub, ":map_pos_x", 990, ":map_bordered_width"),
        (store_sub, ":map_pos_y", 740, ":map_bordered_height"),
        (position_set_x, pos1, ":map_pos_x"),
        (position_set_y, pos1, ":map_pos_y"),
        (overlay_set_position, "$g_battle_map_plane", pos1),
        (overlay_set_alpha, "$g_battle_map_plane", 0x44),
        
        (create_mesh_overlay, "$g_battle_map_infantry_order_flag", "mesh_flag_infantry"),
        (create_mesh_overlay, "$g_battle_map_archers_order_flag", "mesh_flag_archers"),
        (create_mesh_overlay, "$g_battle_map_cavalry_order_flag", "mesh_flag_cavalry"),
        (overlay_set_alpha, "$g_battle_map_infantry_order_flag", 0),
        (overlay_set_alpha, "$g_battle_map_archers_order_flag", 0),
        (overlay_set_alpha, "$g_battle_map_cavalry_order_flag", 0),
        (create_mesh_overlay, "$g_battle_map_spears_order_flag", "mesh_flag_spears"),
        (create_mesh_overlay, "$g_battle_map_skirmishers_order_flag", "mesh_flag_skirmishers"),
        (create_mesh_overlay, "$g_battle_map_horsemen_order_flag", "mesh_flag_horsemen"),
        (overlay_set_alpha, "$g_battle_map_spears_order_flag", 0),
        (overlay_set_alpha, "$g_battle_map_skirmishers_order_flag", 0),
        (overlay_set_alpha, "$g_battle_map_horsemen_order_flag", 0),
        (create_mesh_overlay, "$g_battle_map_d7_order_flag", "mesh_flag_d7"),
        (create_mesh_overlay, "$g_battle_map_d8_order_flag", "mesh_flag_d8"),
        (create_mesh_overlay, "$g_battle_map_d9_order_flag", "mesh_flag_d9"),
        (overlay_set_alpha, "$g_battle_map_d7_order_flag", 0),
        (overlay_set_alpha, "$g_battle_map_d8_order_flag", 0),
        (overlay_set_alpha, "$g_battle_map_d9_order_flag", 0),
        
        (call_script, "script_update_order_panel_checked_classes"),
        (call_script, "script_update_order_panel_statistics_and_map"),
        
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        (get_player_agent_no, ":player_agent"),
        (agent_get_team, ":player_team", ":player_agent"),
        
        (assign, ":update_listeners", 0),
        (try_begin),
          (eq, "$group0_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check0"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group0_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
        (else_try),
          (eq, "$group1_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check1"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group1_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
        (else_try),
          (eq, "$group2_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check2"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group2_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
        (else_try),
          (eq, "$group3_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check3"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group3_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
        (else_try),
          (eq, "$group4_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check4"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group4_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
        (else_try),
          (eq, "$group5_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check5"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group5_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
        (else_try),
          (eq, "$group6_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check6"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group6_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
        (else_try),
          (eq, "$group7_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check7"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group7_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
        (else_try),
          (eq, "$group8_has_troops", 1),
          (eq, ":object", "$g_presentation_obj_battle_check8"),
          (assign, ":update_listeners", 1),
          (assign, "$g_formation_group8_selected", ":value"),
          (try_begin),
            (eq, ":value", 1),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0x44),
          (else_try),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but0"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group0_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check0", 1),
          
          (try_begin),
            (eq, "$group1_has_troops", 1),
            (assign, "$g_formation_group1_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group2_has_troops", 1),
            (assign, "$g_formation_group2_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group3_has_troops", 1),
            (assign, "$g_formation_group3_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group4_has_troops", 1),
            (assign, "$g_formation_group4_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group5_has_troops", 1),
            (assign, "$g_formation_group5_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group6_has_troops", 1),
            (assign, "$g_formation_group6_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group7_has_troops", 1),
            (assign, "$g_formation_group7_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group8_has_troops", 1),
            (assign, "$g_formation_group8_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but1"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group1_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check1", 1),
          
          (try_begin),
            (eq, "$group0_has_troops", 1),
            (assign, "$g_formation_group0_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group2_has_troops", 1),
            (assign, "$g_formation_group2_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group3_has_troops", 1),
            (assign, "$g_formation_group3_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group4_has_troops", 1),
            (assign, "$g_formation_group4_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group5_has_troops", 1),
            (assign, "$g_formation_group5_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group6_has_troops", 1),
            (assign, "$g_formation_group6_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group7_has_troops", 1),
            (assign, "$g_formation_group7_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group8_has_troops", 1),
            (assign, "$g_formation_group8_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but2"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group2_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check2", 1),
          
          (try_begin),
            (eq, "$group0_has_troops", 1),
            (assign, "$g_formation_group0_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group1_has_troops", 1),
            (assign, "$g_formation_group1_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group3_has_troops", 1),
            (assign, "$g_formation_group3_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group4_has_troops", 1),
            (assign, "$g_formation_group4_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group5_has_troops", 1),
            (assign, "$g_formation_group5_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group6_has_troops", 1),
            (assign, "$g_formation_group6_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group7_has_troops", 1),
            (assign, "$g_formation_group7_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group8_has_troops", 1),
            (assign, "$g_formation_group8_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but3"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group3_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check3", 1),
          
          (try_begin),
            (eq, "$group0_has_troops", 1),
            (assign, "$g_formation_group0_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group1_has_troops", 1),
            (assign, "$g_formation_group1_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group2_has_troops", 1),
            (assign, "$g_formation_group2_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group4_has_troops", 1),
            (assign, "$g_formation_group4_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group5_has_troops", 1),
            (assign, "$g_formation_group5_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group6_has_troops", 1),
            (assign, "$g_formation_group6_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group7_has_troops", 1),
            (assign, "$g_formation_group7_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group8_has_troops", 1),
            (assign, "$g_formation_group8_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but4"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group4_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check4", 1),
          
          (try_begin),
            (eq, "$group0_has_troops", 1),
            (assign, "$g_formation_group0_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group1_has_troops", 1),
            (assign, "$g_formation_group1_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group2_has_troops", 1),
            (assign, "$g_formation_group2_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group3_has_troops", 1),
            (assign, "$g_formation_group3_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group5_has_troops", 1),
            (assign, "$g_formation_group5_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group6_has_troops", 1),
            (assign, "$g_formation_group6_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group7_has_troops", 1),
            (assign, "$g_formation_group7_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group8_has_troops", 1),
            (assign, "$g_formation_group8_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but5"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group5_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check5", 1),
          
          (try_begin),
            (eq, "$group0_has_troops", 1),
            (assign, "$g_formation_group0_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group1_has_troops", 1),
            (assign, "$g_formation_group1_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group2_has_troops", 1),
            (assign, "$g_formation_group2_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group3_has_troops", 1),
            (assign, "$g_formation_group3_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group4_has_troops", 1),
            (assign, "$g_formation_group4_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group6_has_troops", 1),
            (assign, "$g_formation_group6_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group7_has_troops", 1),
            (assign, "$g_formation_group7_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group8_has_troops", 1),
            (assign, "$g_formation_group8_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but6"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group6_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check6", 1),
          
          (try_begin),
            (eq, "$group0_has_troops", 1),
            (assign, "$g_formation_group0_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group1_has_troops", 1),
            (assign, "$g_formation_group1_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group2_has_troops", 1),
            (assign, "$g_formation_group2_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group3_has_troops", 1),
            (assign, "$g_formation_group3_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group4_has_troops", 1),
            (assign, "$g_formation_group4_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group5_has_troops", 1),
            (assign, "$g_formation_group5_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group7_has_troops", 1),
            (assign, "$g_formation_group7_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group8_has_troops", 1),
            (assign, "$g_formation_group8_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but7"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group7_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check7", 1),
          
          (try_begin),
            (eq, "$group0_has_troops", 1),
            (assign, "$g_formation_group0_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group1_has_troops", 1),
            (assign, "$g_formation_group1_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group2_has_troops", 1),
            (assign, "$g_formation_group2_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group3_has_troops", 1),
            (assign, "$g_formation_group3_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group4_has_troops", 1),
            (assign, "$g_formation_group4_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group5_has_troops", 1),
            (assign, "$g_formation_group5_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group6_has_troops", 1),
            (assign, "$g_formation_group6_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group8_has_troops", 1),
            (assign, "$g_formation_group8_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check8", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but8"),
          (assign, ":update_listeners", 1),
          
          (assign, "$g_formation_group8_selected", 1),
          (overlay_animate_to_alpha, "$g_presentation_obj_battle_but8", 250, 0x44),
          (overlay_set_val, "$g_presentation_obj_battle_check8", 1),
          
          (try_begin),
            (eq, "$group0_has_troops", 1),
            (assign, "$g_formation_group0_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check0", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but0", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group1_has_troops", 1),
            (assign, "$g_formation_group1_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check1", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but1", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group2_has_troops", 1),
            (assign, "$g_formation_group2_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check2", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but2", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group3_has_troops", 1),
            (assign, "$g_formation_group3_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check3", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but3", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group4_has_troops", 1),
            (assign, "$g_formation_group4_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check4", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but4", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group5_has_troops", 1),
            (assign, "$g_formation_group5_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check5", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but5", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group6_has_troops", 1),
            (assign, "$g_formation_group6_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check6", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but6", 250, 0),
          (try_end),
          (try_begin),
            (eq, "$group7_has_troops", 1),
            (assign, "$g_formation_group7_selected", 0),
            (overlay_set_val, "$g_presentation_obj_battle_check7", 0),
            (overlay_animate_to_alpha, "$g_presentation_obj_battle_but7", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_14"),
          (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_spread_out),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_15"),
          (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_stand_closer),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_16"),
          (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_fall_back),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_17"),
          (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_advance),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_10"),
          (try_begin),
            (eq, ":value", 4),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_hold),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_1", 4),
          (else_try),
            (eq, ":value", 3),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_follow),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_1", 3),
          (else_try),
            (eq, ":value", 2),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_charge),
            (call_script, "script_update_order_panel", ":player_team"),
            ##          (else_try),
            ##            (eq, ":value", 4),
            ##            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_advance),
            ##            (call_script, "script_update_order_panel", ":player_team"),
            ##          (else_try),
            ##            (eq, ":value", 3),
            ##            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_fall_back),
            ##            (call_script, "script_update_order_panel", ":player_team"),
            ##          (else_try),
            ##            (eq, ":value", 2),
            ##            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_stand_closer),
            ##            (call_script, "script_update_order_panel", ":player_team"),
            ##          (else_try),
            ##            (eq, ":value", 1),
            ##            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_spread_out),
            ##            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_1", 2),
          (else_try),
            (eq, ":value", 1),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_stand_ground),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_1", 1),
          (else_try),
            (eq, ":value", 0),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_retreat),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_1", 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_11"),
          (try_begin),
            (eq, ":value", 1),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_mount),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_2", 1),
          (else_try),
            (eq, ":value", 0),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_dismount),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_2", 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_12"),
          (try_begin),
            (eq, ":value", 1),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_hold_fire),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_3", 1),
          (else_try),
            (eq, ":value", 0),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_fire_at_will),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_3", 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_13"),
          (try_begin),
            (eq, ":value", 1),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_use_any_weapon),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_4", 1),
          (else_try),
            (eq, ":value", 0),
            (call_script, "script_team_give_order_from_order_panel", ":player_agent", mordr_use_blunt_weapons),
            (call_script, "script_update_order_panel", ":player_team"),
            (assign, "$g_latest_order_4", 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_battle_map_plane"),
          (get_scene_boundaries, pos2, pos3),
          (mouse_get_position, pos1),
          (set_fixed_point_multiplier, 1000),
          (position_get_x, ":mouse_x", pos1),
          (position_get_y, ":mouse_y", pos1),
          (store_sub, ":map_x", 980, "$g_battle_map_width"),
          (store_sub, ":map_y", 730, "$g_battle_map_height"),
          (val_sub, ":mouse_x", ":map_x"),
          (val_sub, ":mouse_y", ":map_y"),
          (val_clamp, ":mouse_x", 0, "$g_battle_map_width"),
          (val_clamp, ":mouse_y", 0, "$g_battle_map_height"),
          (val_mul, ":mouse_x", "$g_battle_map_scale"),
          (val_mul, ":mouse_y", "$g_battle_map_scale"),
          (set_fixed_point_multiplier, 1000),
          (position_set_x, pos1, ":mouse_x"),
          (position_set_y, pos1, ":mouse_y"),
          (position_transform_position_to_parent, pos3, pos2, pos1),
          (try_begin),
            (eq, "$g_formation_group0_selected", 1),
            (team_give_order, ":player_team", 0, mordr_hold),
            (team_set_order_position, ":player_team", 0, pos3),
          (try_end),
          (try_begin),
            (eq, "$g_formation_group1_selected", 1),
            (team_give_order, ":player_team", 1, mordr_hold),
            (team_set_order_position, ":player_team", 1, pos3),
          (try_end),
          (try_begin),
            (eq, "$g_formation_group2_selected", 1),
            (team_give_order, ":player_team", 2, mordr_hold),
            (team_set_order_position, ":player_team", 2, pos3),
          (try_end),
          (try_begin),
            (eq, "$g_formation_group3_selected", 1),
            (team_give_order, ":player_team", 3, mordr_hold),
            (team_set_order_position, ":player_team", 3, pos3),
          (try_end),
          (try_begin),
            (eq, "$g_formation_group4_selected", 1),
            (team_give_order, ":player_team", 4, mordr_hold),
            (team_set_order_position, ":player_team", 4, pos3),
          (try_end),
          (try_begin),
            (eq, "$g_formation_group5_selected", 1),
            (team_give_order, ":player_team", 5, mordr_hold),
            (team_set_order_position, ":player_team", 5, pos3),
          (try_end),
          (try_begin),
            (eq, "$g_formation_group6_selected", 1),
            (team_give_order, ":player_team", 6, mordr_hold),
            (team_set_order_position, ":player_team", 6, pos3),
          (try_end),
          (try_begin),
            (eq, "$g_formation_group7_selected", 1),
            (team_give_order, ":player_team", 7, mordr_hold),
            (team_set_order_position, ":player_team", 7, pos3),
          (try_end),
          (try_begin),
            (eq, "$g_formation_group8_selected", 1),
            (team_give_order, ":player_team", 8, mordr_hold),
            (team_set_order_position, ":player_team", 8, pos3),
          (try_end),
          # formations by motomataru chief
          # TODO: script off and use HOLD OVER THERE functionality from formations_mission_templates to attack enemies or set up selected divisions in army formation
          (assign, ":fixed_point_multiplier", 1),
          (convert_to_fixed_point, ":fixed_point_multiplier"),
          (set_fixed_point_multiplier, 100),
          (call_script, "script_division_reset_places"),
          (call_script, "script_process_place_divisions"),
          (set_fixed_point_multiplier, ":fixed_point_multiplier"),
          # end formations
          (call_script, "script_update_order_flags_on_map"),
          (call_script, "script_update_order_panel", ":player_team"),
        (try_end),
        
        (try_begin),
          (eq, ":update_listeners", 1),
          (team_set_order_listener, ":player_team", -1),
          (try_begin),
            (this_or_next|eq, "$g_formation_group0_selected", 1),
            (eq, "$group0_has_troops", 0),
            (this_or_next|eq, "$g_formation_group1_selected", 1),
            (eq, "$group1_has_troops", 0),
            (this_or_next|eq, "$g_formation_group2_selected", 1),
            (eq, "$group2_has_troops", 0),
            (this_or_next|eq, "$g_formation_group3_selected", 1),
            (eq, "$group3_has_troops", 0),
            (this_or_next|eq, "$g_formation_group4_selected", 1),
            (eq, "$group4_has_troops", 0),
            (this_or_next|eq, "$g_formation_group5_selected", 1),
            (eq, "$group5_has_troops", 0),
            (this_or_next|eq, "$g_formation_group6_selected", 1),
            (eq, "$group6_has_troops", 0),
            (this_or_next|eq, "$g_formation_group7_selected", 1),
            (eq, "$group7_has_troops", 0),
            (this_or_next|eq, "$g_formation_group8_selected", 1),
            (eq, "$group8_has_troops", 0),
            (team_set_order_listener, ":player_team", grc_everyone),
          (else_try),
            (assign, ":to_add", 0),
            
            (try_begin),
              (eq, "$g_formation_group0_selected", 1),
              (team_set_order_listener, ":player_team", 0, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
            (try_begin),
              (eq, "$g_formation_group1_selected", 1),
              (team_set_order_listener, ":player_team", 1, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
            (try_begin),
              (eq, "$g_formation_group2_selected", 1),
              (team_set_order_listener, ":player_team", 2, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
            (try_begin),
              (eq, "$g_formation_group3_selected", 1),
              (team_set_order_listener, ":player_team", 3, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
            (try_begin),
              (eq, "$g_formation_group4_selected", 1),
              (team_set_order_listener, ":player_team", 4, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
            (try_begin),
              (eq, "$g_formation_group5_selected", 1),
              (team_set_order_listener, ":player_team", 5, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
            (try_begin),
              (eq, "$g_formation_group6_selected", 1),
              (team_set_order_listener, ":player_team", 6, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
            (try_begin),
              (eq, "$g_formation_group7_selected", 1),
              (team_set_order_listener, ":player_team", 7, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
            (try_begin),
              (eq, "$g_formation_group8_selected", 1),
              (team_set_order_listener, ":player_team", 8, ":to_add"),
              (assign, ":to_add", 1),
            (try_end),
          (try_end),
        (try_end),
    ]),
    (ti_on_presentation_mouse_enter_leave,
      [(store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":enter_leave"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_battle_but0"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but0_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but0_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but0_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name0", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but0_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but0_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but0_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name0", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but1"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but1_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but1_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but1_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name1", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but1_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but1_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but1_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name1", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but2"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but2_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but2_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but2_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name2", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but2_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but2_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but2_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name2", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but3"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but3_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but3_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but3_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name3", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but3_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but3_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but3_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name3", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but4"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but4_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but4_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but4_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name4", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but4_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but4_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but4_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name4", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but5"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but5_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but5_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but5_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name5", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but5_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but5_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but5_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name5", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but6"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but6_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but6_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but6_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name6", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but6_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but6_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but6_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name6", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but7"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but7_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but7_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but7_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name7", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but7_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but7_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but7_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name7", 250, 0),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_battle_but8"),
          (try_begin),
            (eq, ":enter_leave", 0),
            (overlay_animate_to_color, "$g_presentation_but8_movement", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but8_riding", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_but8_weapon_usage", 250, 0xFFFFFF),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name8", 250, 0xFFFFFF),
          (else_try),
            (overlay_animate_to_color, "$g_presentation_but8_movement", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but8_riding", 250, 0),
            (overlay_animate_to_color, "$g_presentation_but8_weapon_usage", 250, 0),
            (overlay_animate_to_color, "$g_presentation_obj_battle_name8", 250, 0),
          (try_end),
        (try_end),
    ]),
    # (ti_on_presentation_run,
    # [(store_trigger_param_1, ":cur_time"),
    # (try_begin),
    # (this_or_next|game_key_clicked, gk_group0_hear),  wiped out anyway by battle menu presentation
    # (this_or_next|game_key_clicked, gk_group1_hear),
    # (this_or_next|game_key_clicked, gk_group2_hear),
    # (this_or_next|game_key_clicked, gk_group3_hear),
    # (this_or_next|game_key_clicked, gk_group4_hear),
    # (this_or_next|game_key_clicked, gk_group5_hear),
    # (this_or_next|game_key_clicked, gk_group6_hear),
    # (this_or_next|game_key_clicked, gk_group7_hear),
    # (this_or_next|game_key_clicked, gk_group8_hear),
    # (this_or_next|game_key_clicked, gk_everyone_hear),
    # (game_key_clicked, gk_reverse_order_group),
    # (call_script, "script_update_order_panel_checked_classes"),
    # (try_end),
    # (try_begin),
    # (this_or_next|game_key_clicked, gk_order_1),  wiped out anyway by battle menu presentation
    # (this_or_next|game_key_clicked, gk_order_2),
    # (this_or_next|game_key_clicked, gk_order_3),
    # (this_or_next|game_key_clicked, gk_order_4),
    # (this_or_next|game_key_clicked, gk_order_5),
    # (game_key_clicked, gk_order_6),
    # (get_player_agent_no, ":player_agent"),
    # (agent_get_team, ":player_team", ":player_agent"),
    # (call_script, "script_update_order_panel", ":player_team"),
    # (try_end),
    # (try_begin),
    # (gt, ":cur_time", 200),
    # (game_key_clicked, gk_view_orders),
    # (try_for_agents, ":cur_agent"),  done on load
    # (agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0),
    # (try_end),
    # (presentation_set_duration, 0), done in mt now
    # (try_end),
    # ]),
]),


# ("sliders",0,0,[
    # (ti_on_presentation_load,
      # [(set_fixed_point_multiplier, 1000),
        # (create_slider_overlay, "$g_presentation_obj_sliders_1", 0, 100),
        # (create_slider_overlay, "$g_presentation_obj_sliders_2", 0, 100),
        # (create_slider_overlay, "$g_presentation_obj_sliders_3", 0, 100),
        # (create_slider_overlay, "$g_presentation_obj_sliders_4", 0, 100),
        # (assign, reg1, 25),
        # (str_store_string, s1, "str_reg1"),
        # (create_text_overlay, "$g_presentation_obj_sliders_5", s1),
        # (create_text_overlay, "$g_presentation_obj_sliders_6", s1),
        # (create_text_overlay, "$g_presentation_obj_sliders_7", s1),
        # (create_text_overlay, "$g_presentation_obj_sliders_8", s1),
        # (assign, "$g_presentation_obj_sliders_1_val", 25),
        # (overlay_set_val, "$g_presentation_obj_sliders_1", 25),
        # (assign, "$g_presentation_obj_sliders_2_val", 25),
        # (overlay_set_val, "$g_presentation_obj_sliders_2", 25),
        # (assign, "$g_presentation_obj_sliders_3_val", 25),
        # (overlay_set_val, "$g_presentation_obj_sliders_3", 25),
        # (assign, "$g_presentation_obj_sliders_4_val", 25),
        # (overlay_set_val, "$g_presentation_obj_sliders_4", 25),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, 200),
        # (overlay_set_position, "$g_presentation_obj_sliders_1", pos1),
        # (position_set_y, pos1, 300),
        # (overlay_set_position, "$g_presentation_obj_sliders_2", pos1),
        # (position_set_y, pos1, 400),
        # (overlay_set_position, "$g_presentation_obj_sliders_3", pos1),
        # (position_set_y, pos1, 500),
        # (overlay_set_position, "$g_presentation_obj_sliders_4", pos1),
        # (position_set_x, pos1, 800),
        # (position_set_y, pos1, 200),
        # (overlay_set_position, "$g_presentation_obj_sliders_5", pos1),
        # (position_set_y, pos1, 300),
        # (overlay_set_position, "$g_presentation_obj_sliders_6", pos1),
        # (position_set_y, pos1, 400),
        # (overlay_set_position, "$g_presentation_obj_sliders_7", pos1),
        # (position_set_y, pos1, 500),
        # (overlay_set_position, "$g_presentation_obj_sliders_8", pos1),
        # (position_set_x, pos1, 500),
        # (overlay_set_size, "$g_presentation_obj_sliders_3", pos1),
    # ]),
    # (ti_on_presentation_run,
      # [
    # ]),
    # (ti_on_presentation_event_state_change,
      # [(store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        # (assign, ":val_changed", 0),
        # (try_begin),
          # (eq, ":object", "$g_presentation_obj_sliders_1"),
          # (try_begin),
            # (neq, "$g_presentation_obj_sliders_1_val", ":value"),
            # (assign, "$g_presentation_obj_sliders_1_val", ":value"),
            # (assign, ":val_changed", 1),
          # (try_end),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_sliders_2"),
          # (try_begin),
            # (neq, "$g_presentation_obj_sliders_2_val", ":value"),
            # (assign, "$g_presentation_obj_sliders_2_val", ":value"),
            # (assign, ":val_changed", 1),
          # (try_end),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_sliders_3"),
          # (try_begin),
            # (neq, "$g_presentation_obj_sliders_3_val", ":value"),
            # (assign, "$g_presentation_obj_sliders_3_val", ":value"),
            # (assign, ":val_changed", 1),
          # (try_end),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_sliders_4"),
          # (try_begin),
            # (neq, "$g_presentation_obj_sliders_4_val", ":value"),
            # (assign, "$g_presentation_obj_sliders_4_val", ":value"),
            # (assign, ":val_changed", 1),
          # (try_end),
        # os1, 390),
        # _begin),
          # (eq, ":val_changed", 1),
          # (assign, ":sum_values", 0),
          # (val_add, ":sum_values", "$g_presentation_obj_sliders_1_val"),
          # (val_add, ":sum_values", "$g_presentation_obj_sliders_2_val"),
          # (val_add, ":sum_values", "$g_presentation_obj_sliders_3_val"),
          # (val_add, ":sum_values", "$g_presentation_obj_sliders_4_val"),
          # (store_sub, ":difference", 100, ":sum_values"),
          # (assign, ":obj_1_new_val", "$g_presentation_obj_sliders_1_val"),
          # (assign, ":obj_2_new_val", "$g_presentation_obj_sliders_2_val"),
          # (assign, ":obj_3_new_val", "$g_presentation_obj_sliders_3_val"),
          # (assign, ":obj_4_new_val", "$g_presentation_obj_sliders_4_val"),
          # (assign, ":adder", 1),
          # (assign, ":between_1", 0),
          # (assign, ":between_2", 100),
          # (try_begin),
            # (lt, ":difference", 0),
            # (val_mul, ":difference", -1),
            # (assign, ":adder", -1),
            # (assign, ":between_1", 1),
            # (assign, ":between_2", 101),
          # (try_end),
          # (store_sub, ":sum_non_changed_values", ":sum_values", ":value"),
          # (val_add, ":sum_non_changed_values", 30),
          # (try_for_range, ":unused", 0, ":difference"),
            # (store_random_in_range, ":random_no", 0, ":sum_non_changed_values"),
            # (try_begin),
              # (neq, ":object", "$g_presentation_obj_sliders_1"),
              # (val_sub, ":random_no", "$g_presentation_obj_sliders_1_val"),
              # (val_sub, ":random_no", 10),
              # (lt, ":random_no", 0),
              # (is_between, ":obj_1_new_val", ":between_1", ":between_2"),
              # (val_add, ":obj_1_new_val", ":adder"),
            # (else_try),
              # (neq, ":object", "$g_presentation_obj_sliders_2"),
              # (val_sub, ":random_no", "$g_presentation_obj_sliders_2_val"),
              # (val_sub, ":random_no", 10),
              # (lt, ":random_no", 0),
              # (is_between, ":obj_2_new_val", ":between_1", ":between_2"),
              # (val_add, ":obj_2_new_val", ":adder"),
            # (else_try),
              # (neq, ":object", "$g_presentation_obj_sliders_3"),
              # (val_sub, ":random_no", "$g_presentation_obj_sliders_3_val"),
              # (val_sub, ":random_no", 10),
              # (lt, ":random_no", 0),
              # (is_between, ":obj_3_new_val", ":between_1", ":between_2"),
              # (val_add, ":obj_3_new_val", ":adder"),
            # (else_try),
              # (is_between, ":obj_4_new_val", ":between_1", ":between_2"),
              # (val_add, ":obj_4_new_val", ":adder"),
            # (else_try),
              # (val_add, ":difference", 1),
            # (try_end),
          # (try_end),
          # (assign, "$g_presentation_obj_sliders_1_val", ":obj_1_new_val"),
          # (assign, "$g_presentation_obj_sliders_2_val", ":obj_2_new_val"),
          # (assign, "$g_presentation_obj_sliders_3_val", ":obj_3_new_val"),
          # (assign, "$g_presentation_obj_sliders_4_val", ":obj_4_new_val"),
        # (try_end),
        # (overlay_set_val, "$g_presentation_obj_sliders_1", "$g_presentation_obj_sliders_1_val"),
        # (overlay_set_val, "$g_presentation_obj_sliders_2", "$g_presentation_obj_sliders_2_val"),
        # (overlay_set_val, "$g_presentation_obj_sliders_3", "$g_presentation_obj_sliders_3_val"),
        # (overlay_set_val, "$g_presentation_obj_sliders_4", "$g_presentation_obj_sliders_4_val"),
        # (assign, reg1, "$g_presentation_obj_sliders_1_val"),
        # (str_store_string, s1, "str_reg1"),
        # (overlay_set_text, "$g_presentation_obj_sliders_5", s1),
        # (assign, reg1, "$g_presentation_obj_sliders_2_val"),
        # (str_store_string, s1, "str_reg1"),
        # (overlay_set_text, "$g_presentation_obj_sliders_6", s1),
        # (assign, reg1, "$g_presentation_obj_sliders_3_val"),
        # (str_store_string, s1, "str_reg1"),
        # (overlay_set_text, "$g_presentation_obj_sliders_7", s1),
        # (assign, reg1, "$g_presentation_obj_sliders_4_val"),
        # (str_store_string, s1, "str_reg1"),
        # (overlay_set_text, "$g_presentation_obj_sliders_8", s1),
    # ]),
# ]),

("arena_training", prsntf_read_only|prsntf_manual_end_only, 0, [
    (ti_on_presentation_load,
      [(presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (get_player_agent_no, ":player_agent"),
        (agent_get_kill_count, reg1, ":player_agent", 1),
        (str_store_string, s1, "@Number of men knocked down: {reg1}"),
        (create_text_overlay, "$g_presentation_obj_arena_training_1", s1),
        (overlay_set_color, "$g_presentation_obj_arena_training_1", 0xFFFFFF),
        (position_set_x, pos1, 10),
        (position_set_y, pos1, 700),
        (overlay_set_position, "$g_presentation_obj_arena_training_1", pos1),
        (assign, reg1, 0),
        (str_store_string, s1, "@Number of men left: {reg1}"),
        (create_text_overlay, "$g_presentation_obj_arena_training_2", s1),
        (overlay_set_color, "$g_presentation_obj_arena_training_2", 0xFFFFFF),
        (position_set_x, pos1, 10),
        (position_set_y, pos1, 670),
        (overlay_set_position, "$g_presentation_obj_arena_training_2", pos1),
    ]),
    (ti_on_presentation_run,
      [(get_player_agent_no, ":player_agent"),
        (agent_get_kill_count, reg1, ":player_agent", 1),
        (str_store_string, s1, "@Opponents Beaten: {reg1}"),
        (overlay_set_text, "$g_presentation_obj_arena_training_1", s1),
        (assign, ":num_left", "$g_arena_training_max_opponents"),
        (try_for_agents, ":agent_no"),
          (agent_is_human, ":agent_no"),
          (neg|agent_is_alive, ":agent_no"),
          (neq, ":agent_no", ":player_agent"),
          (val_sub, ":num_left", 1),
        (try_end),
        (assign, reg1, ":num_left"),
        (str_store_string, s1, "@Opponents Remaining: {reg1}"),
        (overlay_set_text, "$g_presentation_obj_arena_training_2", s1),
    ]),
]),

("retirement", 0, mesh_load_window,
  [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (create_button_overlay, "$g_presentation_obj_retirement_1", "@Remain in retirement.", tf_center_justify),
        (create_button_overlay, "$g_presentation_obj_retirement_2", "@Go back to adventuring.", tf_center_justify),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 80),
        (overlay_set_position, "$g_presentation_obj_retirement_1", pos1),
        (position_set_y, pos1, 40),
        (overlay_set_position, "$g_presentation_obj_retirement_2", pos1),
        (assign, ":total_effect", 0),
        #wealth
        (store_troop_gold, ":wealth", "trp_player"),
        (store_div, ":wealth_effect", ":wealth", 200),
        (val_add, ":total_effect", ":wealth_effect"),
        #ruled centers and friendly/enemy centers
        (assign, ":num_towns", 0),
        (assign, ":num_castles", 0),
        (assign, ":num_villages", 0),
        (assign, ":num_friendly_towns", 0),
        (assign, ":num_friendly_villages", 0),
        (assign, ":num_enemy_towns", 0),
        (assign, ":num_enemy_villages", 0),
        (try_for_range, ":center_no", centers_begin, centers_end),
          (party_get_slot, ":type", ":center_no", slot_party_type),
          (try_begin),
            (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
            (try_begin),
              (eq, ":type", spt_town),
              (val_add, ":num_towns", 1),
            (else_try),
              (eq, ":type", spt_castle),
              (val_add, ":num_castles", 1),
            (else_try),
              (val_add, ":num_villages", 1),
            (try_end),
          (try_end),
          (party_get_slot, ":relation", ":center_no", slot_center_player_relation),
          (try_begin),
            (ge, ":relation", 40),
            (try_begin),
              (eq, ":type", spt_town),
              (val_add, ":num_friendly_towns", 1),
            (else_try),
              (eq, ":type", spt_village),
              (val_add, ":num_friendly_villages", 1),
            (try_end),
          (else_try),
            (le, ":relation", -40),
            (try_begin),
              (eq, ":type", spt_town),
              (val_add, ":num_enemy_towns", 1),
            (else_try),
              (eq, ":type", spt_village),
              (val_add, ":num_enemy_villages", 1),
            (try_end),
          (try_end),
        (try_end),
        (store_mul, ":num_towns_effect", ":num_towns", 100),
        (store_mul, ":num_castles_effect", ":num_castles", 50),
        (store_mul, ":num_villages_effect", ":num_villages", 20),
        (store_add, ":num_centers", ":num_towns", ":num_castles"),
        (val_add, ":num_centers", ":num_villages"),
        (store_add, ":ruled_centers_effect", ":num_towns_effect", ":num_castles_effect"),
        (val_add, ":ruled_centers_effect", ":num_villages_effect"),
        (val_add, ":total_effect", ":ruled_centers_effect"),
        (store_mul, ":num_friendly_towns_effect", ":num_friendly_towns", 20),
        (store_mul, ":num_friendly_villages_effect", ":num_friendly_villages", 4),
        (store_add, ":num_friendly_centers", ":num_friendly_towns", ":num_friendly_villages"),
        (store_add, ":friendly_centers_effect", ":num_friendly_towns_effect", ":num_friendly_villages_effect"),
        (val_add, ":total_effect", ":friendly_centers_effect"),
        (store_mul, ":num_enemy_towns_effect", ":num_enemy_towns", -40),
        (store_mul, ":num_enemy_villages_effect", ":num_enemy_villages", -8),
        (store_add, ":num_enemy_centers", ":num_enemy_towns", ":num_enemy_villages"),
        (store_add, ":enemy_centers_effect", ":num_enemy_towns_effect", ":num_enemy_villages_effect"),
        (val_add, ":total_effect", ":enemy_centers_effect"),
        #inventory
        (assign, ":total_item_value", 0),
        (troop_get_inventory_capacity, ":capacity", "trp_player"),
        (try_for_range, ":i_inv", 0, ":capacity"),
          (troop_get_inventory_slot, ":item", "trp_player", ":i_inv"),
          (ge, ":item", 0),
          (store_item_value, ":item_value", ":item"),
          (val_add, ":total_item_value", ":item_value"),
        (try_end),
        (store_div, ":total_item_value_effect", ":total_item_value", 200),
        (val_add, ":total_effect", ":total_item_value_effect"),
        #renown
        (troop_get_slot, ":renown", "trp_player", slot_troop_renown),
        (store_div, ":renown_effect", ":renown", 1),
        (val_add, ":total_effect", ":renown_effect"),
        #enemies and friends
        (assign, ":num_enemies", 0),
        (assign, ":num_friends", 0),
        (try_for_range, ":troop_no", heroes_begin, heroes_end),
          (this_or_next|troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
          (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_lady),
          (call_script, "script_troop_get_player_relation", ":troop_no"),
          (assign, ":relation", reg0),
          #(troop_get_slot, ":relation", ":troop_no", slot_troop_player_relation),
          (try_begin),
            (ge, ":relation", 40),
            (val_add, ":num_friends", 1),
          (else_try),
            (le, ":relation", -40),
            (val_add, ":num_enemies", 1),
          (try_end),
        (try_end),
        (store_mul, ":num_friends_effect", ":num_friends", 10),
        (val_add, ":total_effect", ":num_friends_effect"),
        (store_mul, ":num_enemies_effect", ":num_enemies", -10),
        (val_add, ":total_effect", ":num_enemies_effect"),
        #current day
        (store_current_day, ":cur_day"),
        (store_div, ":cur_day_effect", ":cur_day", -1),
        (val_add, ":total_effect", ":cur_day_effect"),
        #g_total_victories
        (store_mul, ":total_victories_effect", "$g_total_victories", 2),
        (val_add, ":total_effect", ":total_victories_effect"),
        #g_total_defeats
        (store_mul, ":total_defeats_effect", "$g_total_defeats", -3),
        (val_add, ":total_effect", ":total_defeats_effect"),
        #g_total_quests_completed
        (store_mul, ":total_quests_completed_effect", "$g_total_quests_completed", 4),
        (val_add, ":total_effect", ":total_quests_completed_effect"),
        #xp
        (troop_get_xp, ":xp", "trp_player"),
        (store_div, ":xp_effect", ":xp", 5000),
        (val_add, ":total_effect", ":xp_effect"),
        #companions joined / departed
        (assign, ":num_companions_joined", 0),
        (assign, ":num_companions_departed", 0),
        (try_for_range, ":troop_no", companions_begin, companions_end),
          (try_begin),
            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_player_companion),
            (val_add, ":num_companions_joined", 1),
          (else_try),
            (troop_slot_ge, ":troop_no", slot_troop_playerparty_history, 1),
            (val_add, ":num_companions_departed", 1),
          (try_end),
        (try_end),
        (store_div, ":num_companions_joined_effect", ":num_companions_joined", 2),
        (val_add, ":total_effect", ":num_companions_joined_effect"),
        (store_div, ":num_companions_departed_effect", ":num_companions_departed", -4),
        (val_add, ":total_effect", ":num_companions_departed_effect"),
        #difficulty
        (get_average_game_difficulty, ":difficulty"),
        (assign, ":difficulty_effect", ":total_effect"),
        (val_mul, ":total_effect", ":difficulty"),
        (val_div, ":total_effect", 75),
        (val_mul, ":total_effect", ":difficulty"),
        (val_div, ":total_effect", 75),
        (store_sub, ":difficulty_effect", ":total_effect", ":difficulty_effect"),
        
        (assign, reg5, ":cur_day"),
        (store_character_level, reg4, "trp_player"),
        (create_text_overlay, reg1, "@You have retired at level {reg4} after {reg5} days of adventuring.", tf_center_justify),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 950),
        (position_set_y, pos1, 950),
        (overlay_set_size, reg1, pos1),
        ##        (overlay_set_color, reg1, 0),
        (create_text_overlay, reg2, "@Effect on Score", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg2, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 670),
        (overlay_set_position, reg2, pos1),
        (assign, reg0, ":num_centers"),
        (create_text_overlay, reg1, "@Settlements owned by you: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":ruled_centers_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":num_friendly_centers"),
        (create_text_overlay, reg1, "@Friendly Settlements: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 630),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":friendly_centers_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 630),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":num_enemy_centers"),
        (create_text_overlay, reg1, "@Hostile Settlements: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 610),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":enemy_centers_effect"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 610),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (lt, reg0, 0),
          (overlay_set_color, reg1, 0xFF0000),
        (try_end),
        
        (assign, reg0, ":num_friends"),
        (create_text_overlay, reg1, "@Friendly Lords: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 590),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":num_friends_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 590),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":num_enemies"),
        (create_text_overlay, reg1, "@Enemy Lords: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 570),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":num_enemies_effect"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 570),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (lt, reg0, 0),
          (overlay_set_color, reg1, 0xFF0000),
        (try_end),
        
        (assign, reg0, "$g_total_victories"),
        (create_text_overlay, reg1, "@Victories: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":total_victories_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, "$g_total_defeats"),
        (create_text_overlay, reg1, "@Defeats: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 530),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":total_defeats_effect"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 530),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (lt, reg0, 0),
          (overlay_set_color, reg1, 0xFF0000),
        (try_end),
        
        (assign, reg0, "$g_total_quests_completed"),
        (create_text_overlay, reg1, "@Quests Completed: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 510),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":total_quests_completed_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 510),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":num_companions_joined"),
        (create_text_overlay, reg1, "@Companions Found: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 490),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":num_companions_joined_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 490),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":num_companions_departed"),
        (create_text_overlay, reg1, "@Companions Lost/Departed: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 470),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":num_companions_departed_effect"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 470),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (lt, reg0, 0),
          (overlay_set_color, reg1, 0xFF0000),
        (try_end),
        
        (assign, reg0, ":wealth"),
        (create_text_overlay, reg1, "@Wealth: {reg0} peningas", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 450),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":wealth_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 450),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":total_item_value"),
        (create_text_overlay, reg1, "@Inventory: {reg0} peningas", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 430),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":total_item_value_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 430),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":renown"),
        (create_text_overlay, reg1, "@Renown: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":renown_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":xp"),
        (create_text_overlay, reg1, "@Experience: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":xp_effect"),
        (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (try_end),
        
        (assign, reg0, ":cur_day"),
        (create_text_overlay, reg1, "@Days Passed: {reg0}", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":cur_day_effect"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (lt, reg0, 0),
          (overlay_set_color, reg1, 0xFF0000),
        (try_end),
        
        (assign, reg0, ":difficulty"),
        (create_text_overlay, reg1, "@Difficulty: {reg0}%", 0),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":difficulty_effect"),
        (assign, reg3, reg0),
        (val_max, reg3, 0),
        (create_text_overlay, reg1, "@{!}{reg3?+:}{reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (else_try),
          (lt, reg0, 0),
          (overlay_set_color, reg1, 0xFF0000),
        (try_end),
        
        (assign, reg0, ":total_effect"),
        (create_text_overlay, reg1, "@TOTAL SCORE: {reg0}", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 320),
        (overlay_set_position, reg1, pos1),
        
        (assign, ":total_villages", 0),
        (assign, ":total_castles", 0),
        (assign, ":total_towns", 0),
        (assign, ":total_village_rels", 0),
        (assign, ":total_castle_rels", 0),
        (assign, ":total_town_rels", 0),
        (try_for_range, ":cur_center_no", centers_begin, centers_end),
          (try_begin),
            (party_slot_eq, ":cur_center_no", slot_town_lord, "trp_player"),
            (try_begin),
              (party_slot_eq, ":cur_center_no", slot_party_type, spt_town),
              (val_add, ":total_towns", 1),
            (else_try),
              (party_slot_eq, ":cur_center_no", slot_party_type, spt_castle),
              (val_add, ":total_castles", 1),
            (else_try),
              (val_add, ":total_villages", 1),
            (try_end),
          (else_try),
            (party_get_slot, ":center_relation", ":cur_center_no", slot_center_player_relation),
            (gt, ":center_relation", 0),
            (try_begin),
              (party_slot_eq, ":cur_center_no", slot_party_type, spt_town),
              (val_add, ":total_town_rels", ":center_relation"),
            (else_try),
              (party_slot_eq, ":cur_center_no", slot_party_type, spt_castle),
              (val_add, ":total_castle_rels", ":center_relation"),
            (else_try),
              (val_add, ":total_village_rels", ":center_relation"),
            (try_end),
          (try_end),
        (try_end),
        (try_begin),
          (gt, ":total_towns", 0),
          (store_random_in_range, ":random_town", 0, ":total_towns"),
          (try_for_range, ":cur_center_no", towns_begin, towns_end),
            (party_slot_eq, ":cur_center_no", slot_town_lord, "trp_player"),
            (val_sub, ":random_town", 1),
            (lt, ":random_town", 0),
            (str_store_party_name, s9, ":cur_center_no"),
          (try_end),
        (else_try),
          (gt, ":total_town_rels", 0),
          (store_random_in_range, ":random_town_rel", 0, ":total_town_rels"),
          (try_for_range, ":cur_center_no", towns_begin, towns_end),
            (party_get_slot, ":center_relation", ":cur_center_no", slot_center_player_relation),
            (gt, ":center_relation", 0),
            (val_sub, ":random_town_rel", ":center_relation"),
            (lt, ":random_town_rel", 0),
            (str_store_party_name, s9, ":cur_center_no"),
          (try_end),
        (else_try),
          (store_random_in_range, ":random_town", towns_begin, towns_end),
          (str_store_party_name, s9, ":random_town"),
        (try_end),
        (try_begin),
          (gt, ":total_castles", 0),
          (store_random_in_range, ":random_castle", 0, ":total_castles"),
          (try_for_range, ":cur_center_no", castles_begin, castles_end),
            (party_slot_eq, ":cur_center_no", slot_town_lord, "trp_player"),
            (val_sub, ":random_castle", 1),
            (lt, ":random_castle", 0),
            (str_store_party_name, s8, ":cur_center_no"),
          (try_end),
        (else_try),
          (gt, ":total_castle_rels", 0),
          (store_random_in_range, ":random_castle_rel", 0, ":total_castle_rels"),
          (try_for_range, ":cur_center_no", castles_begin, castles_end),
            (party_get_slot, ":center_relation", ":cur_center_no", slot_center_player_relation),
            (gt, ":center_relation", 0),
            (val_sub, ":random_castle_rel", ":center_relation"),
            (lt, ":random_castle_rel", 0),
            (str_store_party_name, s8, ":cur_center_no"),
          (try_end),
        (else_try),
          (store_random_in_range, ":random_castle", castles_begin, castles_end),
          (str_store_party_name, s8, ":random_castle"),
        (try_end),
        (try_begin),
          (gt, ":total_villages", 0),
          (store_random_in_range, ":random_village", 0, ":total_villages"),
          (try_for_range, ":cur_center_no", villages_begin, villages_end),
            (party_slot_eq, ":cur_center_no", slot_town_lord, "trp_player"),
            (val_sub, ":random_village", 1),
            (lt, ":random_village", 0),
            (str_store_party_name, s7, ":cur_center_no"),
          (try_end),
        (else_try),
          (gt, ":total_village_rels", 0),
          (store_random_in_range, ":random_village_rel", 0, ":total_village_rels"),
          (try_for_range, ":cur_center_no", villages_begin, villages_end),
            (party_get_slot, ":center_relation", ":cur_center_no", slot_center_player_relation),
            (gt, ":center_relation", 0),
            (val_sub, ":random_village_rel", ":center_relation"),
            (lt, ":random_village_rel", 0),
            (str_store_party_name, s7, ":cur_center_no"),
          (try_end),
        (else_try),
          (store_random_in_range, ":random_village", villages_begin, villages_end),
          (str_store_party_name, s7, ":random_village"),
        (try_end),
        
        (try_begin),
          (lt, ":total_effect", 100),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 0),
          (str_store_string, s0, "str_retirement_text_1"),
        (else_try),
          (lt, ":total_effect", 200),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 1),
          (str_store_string, s0, "str_retirement_text_2"),
        (else_try),
          (lt, ":total_effect", 400),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 2),
          (str_store_string, s0, "str_retirement_text_3"),
        (else_try),
          (lt, ":total_effect", 700),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 3),
          (str_store_string, s0, "str_retirement_text_4"),
        (else_try),
          (lt, ":total_effect", 1200),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 4),
          (str_store_string, s0, "str_retirement_text_5"),
        (else_try),
          (lt, ":total_effect", 1850),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 5),
          (str_store_string, s0, "str_retirement_text_6"),
        (else_try),
          (lt, ":total_effect", 2500),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 6),
          (str_store_string, s0, "str_retirement_text_7"),
        (else_try),
          (lt, ":total_effect", 3500),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 7),
          (str_store_string, s0, "str_retirement_text_8"),
        (else_try),
          (lt, ":total_effect", 5000),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 8),
          (str_store_string, s0, "str_retirement_text_9"),
        (else_try),
          (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_retirement_troop", 9),
          (str_store_string, s0, "str_retirement_text_10"),
        (try_end),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        
        (create_text_overlay, reg1, s0, tf_double_space|tf_scrollable),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 360),
        (position_set_y, pos1, 190),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
    ]),
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_retirement_1"),
          (jump_to_menu, "mnu_end_game"),
          (start_presentation, "prsnt_game_credits"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_retirement_2"),
          (presentation_set_duration, 0),
          (change_screen_return),
        (try_end),
    ]),
]),

("budget_report", 0, mesh_load_window,
  [(ti_on_presentation_load,
      [(presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        #FOR THE DEBUG LOG
        (assign, ":num_total_garrison_troops", 0),
        (assign, ":net_profit", 0),
        (assign, ":accumulated_total", 0),
        (assign, ":offer_value", 0),
        (assign, ":tax_lost", 0),
        (assign, ":total_wage", 0),
        (assign, ":player_debt_to_party_members", 0),
        (assign, ":minister_salary", 0),
        (assign, ":lords_payment_final", 0),
        
        (create_mesh_overlay, reg1, "mesh_pic_payment"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg1, pos1),
        
        ##     (create_mesh_overlay, reg1, "mesh_pic_payment"),
        ##      (position_set_x, pos1, 800),
        ##      (position_set_y, pos1, 800),
        ##      (overlay_set_size, reg1, pos1),
        ##      (position_set_x, pos1, 170),
        ##      (position_set_y, pos1, 0),
        ##      (overlay_set_position, reg1, pos1),
        
        (create_text_overlay, reg1, "str_weekly_budget", tf_center_justify),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 260),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_bugdet_report_container", s0, tf_scrollable_style_2),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 100),
        (overlay_set_position, "$g_presentation_obj_bugdet_report_container", pos1),
        (position_set_x, pos1, 505),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, "$g_presentation_obj_bugdet_report_container", pos1),
        (set_container_overlay, "$g_presentation_obj_bugdet_report_container"),
        
        (options_get_campaign_ai, ":reduce_campaign_ai"), #moto chief
        (try_begin),
          (eq, ":reduce_campaign_ai", 0), #hard
          (assign, ":num_centers_needed_for_efficiency_loss", 2),
          (assign, ":tax_efficiency_loss_ratio_per_center", 10), #chief change
        (else_try),
          (eq, ":reduce_campaign_ai", 1), #medium
          (assign, ":num_centers_needed_for_efficiency_loss", 4),
          (assign, ":tax_efficiency_loss_ratio_per_center", 8),#chief change
        (else_try),
          (eq, ":reduce_campaign_ai", 2), #easy
          (assign, ":num_centers_needed_for_efficiency_loss", 6),
          (assign, ":tax_efficiency_loss_ratio_per_center", 6),#chief change
        (try_end),
        
        ###chief cambia kingdom screen
        (try_begin),
          (gt, "$g_player_minister", 0),
          (troop_get_slot, ":relation", "$g_player_minister", slot_troop_player_relation),
          (ge, ":relation", 50), #high relation = less tax loss
          (val_add, ":num_centers_needed_for_efficiency_loss", 2),
          (val_sub, ":tax_efficiency_loss_ratio_per_center", 2), #chief change Half
        (try_end),
        (try_begin),
          (eq, "$control_tax", 1), #tax control
          (val_add, ":num_centers_needed_for_efficiency_loss", 6),
          (val_div, ":tax_efficiency_loss_ratio_per_center", 2), #chief change Half
        (try_end),
        
        ######
        
        (assign, ":num_lines", 0),
        (assign, ":num_owned_center_values_for_tax_efficiency", 0),
        (assign, ":all_centers_accumulated_total", 0),
        (assign, ":all_centers_accumulated_taxes_and_rents", 0),
        (try_for_range, ":center_no", centers_begin, centers_end),
          (try_begin),
            (party_slot_ge, ":center_no", slot_center_player_enterprise, 1),
            (val_add, ":num_lines", 1),
          (try_end),
          
          (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
          (val_add, ":num_lines", 1),
          (val_add, ":num_owned_center_values_for_tax_efficiency", 1),
          (try_begin),
            (is_between, ":center_no", towns_begin, towns_end),
            (val_add, ":num_lines", 1),
            (val_add, ":num_owned_center_values_for_tax_efficiency", 1),
          (try_end),
        (try_end),
        (try_begin),
          (gt, "$players_kingdom", 0),
          (neq, "$players_kingdom", "fac_player_supporters_faction"),
          (neq, "$players_kingdom", "fac_player_faction"),
          (eq, "$player_has_homage", 0),
          (val_add, ":num_lines", 1),
        (try_end),
        (try_begin),
          (gt, ":num_owned_center_values_for_tax_efficiency", ":num_centers_needed_for_efficiency_loss"),
          #gt accumulated total is ignored
          (val_add, ":num_lines", 1),
        (try_end),
        (try_for_parties, ":party_no"),
          (assign, ":garrison_troop", 0),
          (try_begin),
            (this_or_next|party_slot_eq, ":party_no", slot_party_type, spt_town),
            (party_slot_eq, ":party_no", slot_party_type, spt_castle),
            (party_slot_eq, ":party_no", slot_town_lord, "trp_player"),
            (assign, ":garrison_troop", 1),
          (else_try),
            (this_or_next|party_slot_eq, ":party_no", slot_party_type, spt_town),
            (party_slot_eq, ":party_no", slot_party_type, spt_castle),
            (neg|party_slot_ge, ":party_no", slot_town_lord, 1), #unassigned
            (store_faction_of_party, ":center_faction", ":party_no"),
            (eq, ":center_faction", "fac_player_supporters_faction"),
            (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
            (assign, ":garrison_troop", 1),
          (try_end),
          
          (this_or_next|eq, ":party_no", "p_main_party"),
          (eq, ":garrison_troop", 1),
          (val_add, ":num_lines", 1), #include empty towns/castles
        (try_end),
        (try_begin),
          (gt, "$g_player_debt_to_party_members", 0),
          (val_add, ":num_lines", 2), #include new debt line
        (try_end),
        (try_begin),
          (this_or_next|gt, "$g_player_minister", 0), #spouse and minister cost money chief
          (troop_slot_ge, "trp_player", slot_troop_spouse, 0),
          (val_add, ":num_lines", 1), # salary
        (try_end),
        (val_add, ":num_lines", 10), #chief change of 3 to 10 to fix VC-2163
        (store_mul, ":cur_y", 27, ":num_lines"),
        (assign, ":net_change", 0), #this is the amount added
        (try_for_range, ":center_no", centers_begin, centers_end),
          #Enterprise
          (try_begin),
            (party_get_slot, ":enterprise_output", ":center_no", slot_center_player_enterprise),
            (gt, ":enterprise_output", 1),
            (neg|party_slot_ge, ":center_no", slot_center_player_enterprise_days_until_complete, 1),
            
            (str_store_party_name, s0, ":center_no"),
            
            (call_script, "script_process_player_enterprise", ":enterprise_output", ":center_no"),
            (assign, ":net_profit", reg0),
            (assign, ":price_of_single_output", reg4),
            (assign, ":price_of_single_input", reg5),
            (assign, ":price_of_secondary_input", reg10),
            
            (store_sub, ":town_order", ":center_no", towns_begin),
            (store_add, ":craftsman_troop", ":town_order", "trp_town_1_master_craftsman"),
            
            (item_get_slot, ":outputs_added_to_market", ":enterprise_output", slot_item_output_per_run),
            (assign, ":outputs_added_to_warehouse", 0),
            
            #Enterprise impact of outputs
            (try_begin),
              #output placed in inventory: deduct selling price and add one good
              (party_slot_eq, ":center_no", slot_center_player_enterprise_production_order, 1),
              
              #Count empty slots
              (assign, ":empty_slots", 0),
              (troop_get_inventory_capacity, ":total_capacity", ":craftsman_troop"),
              (try_for_range, ":capacity_iterator", 0, ":total_capacity"),
                (troop_get_inventory_slot, ":slot", ":craftsman_troop", ":capacity_iterator"),
                (lt, ":slot", 1),
                (val_add, ":empty_slots", 1),
              (try_end),
              
              (assign, ":outputs_added_to_warehouse", ":outputs_added_to_market"),
              (val_min, ":outputs_added_to_warehouse",  ":empty_slots"),
              (gt, ":outputs_added_to_warehouse", 0),
              
              (store_mul, ":cancelled_sales", ":price_of_single_output", ":outputs_added_to_warehouse"),
              (val_sub, ":net_profit", ":cancelled_sales"),
              (val_sub, ":outputs_added_to_market", ":outputs_added_to_warehouse"),
            (try_end),
            
            #If the transaction is for real, and not just a budget check
            (try_begin),
              (eq, "$g_apply_budget_report_to_gold", 1),
              (troop_add_items, ":craftsman_troop", ":enterprise_output", ":outputs_added_to_warehouse"),
              
              #Affect prices by outputs added to market
              (store_sub, ":item_slot_no", ":enterprise_output", trade_goods_begin),
              (val_add, ":item_slot_no", slot_town_trade_good_prices_begin),
              (party_get_slot, ":current_index", ":center_no", ":item_slot_no"),
              (store_mul, ":impact_on_price", ":outputs_added_to_market", 15),
              (val_sub, ":current_index", ":impact_on_price"),
              (party_set_slot, ":center_no", ":item_slot_no",":current_index"),
              
              (gt, "$cheat_mode", 0),
              (str_store_troop_name, s3, ":craftsman_troop"),
              (assign, reg3, ":outputs_added_to_warehouse"),
              (display_message, "@{!}DEBUG -- Adding {reg3} items to {s3}"),
            (try_end),
            
            #Enterprise impact of outputs
            (item_get_slot, ":inputs_taken_from_market", ":enterprise_output", slot_item_input_number),
            (try_begin),
              (item_slot_ge, ":enterprise_output", slot_item_secondary_raw_material, 1),
              (assign, ":2ary_inputs_taken_from_market", ":inputs_taken_from_market"),
            (else_try),
              (assign, ":2ary_inputs_taken_from_market", 0),
            (try_end),
            
            (assign, ":inputs_taken_from_warehouse", 0),
            (assign, ":2ary_inputs_taken_from_warehouse", 0),
            
            (try_begin),
              #input present in inventory: reimburse for input cost and remove one good
              (troop_get_inventory_capacity, ":total_capacity", ":craftsman_troop"),
              (try_for_range, ":capacity_iterator", 0, ":total_capacity"),
                (troop_get_inventory_slot, ":item_in_slot", ":craftsman_troop", ":capacity_iterator"),
                
                (lt, ":inputs_taken_from_warehouse", ":inputs_taken_from_market"),
                (item_slot_eq, ":enterprise_output", slot_item_primary_raw_material, ":item_in_slot"),
                #(troop_inventory_slot_get_item_amount, ":item_ammo", ":craftsman_troop", ":capacity_iterator"),
                #(troop_inventory_slot_get_item_max_amount, ":item_max_ammo", ":craftsman_troop", ":capacity_iterator"),
                #(eq, ":item_ammo", ":item_max_ammo"),
                
                (val_add, ":inputs_taken_from_warehouse", 1),
              (else_try),
                (lt, ":2ary_inputs_taken_from_warehouse", ":2ary_inputs_taken_from_market"),
                (item_slot_eq, ":enterprise_output", slot_item_secondary_raw_material, ":item_in_slot"),
                #(troop_inventory_slot_get_item_amount, ":item_ammo", ":craftsman_troop", ":capacity_iterator"),
                #(troop_inventory_slot_get_item_max_amount, ":item_max_ammo", ":craftsman_troop", ":capacity_iterator"),
                #(eq, ":item_ammo", ":item_max_ammo"),
                
                (val_add, ":2ary_inputs_taken_from_warehouse", 1),
              (try_end),
              
              (try_begin),
                (gt, ":inputs_taken_from_warehouse", 0),
                (val_sub, ":inputs_taken_from_market", ":inputs_taken_from_warehouse"),
                (store_mul, ":savings_from_warehoused_inputs",	":price_of_single_input", ":inputs_taken_from_warehouse"),
                (val_add, ":net_profit", ":savings_from_warehoused_inputs"),
              (try_end),
              (try_begin),
                (gt, ":2ary_inputs_taken_from_warehouse", 0),
                (val_sub, ":2ary_inputs_taken_from_market", ":2ary_inputs_taken_from_warehouse"),
                (assign, ":savings_from_warehoused_inputs",	":price_of_secondary_input"),
                (val_add, ":net_profit", ":savings_from_warehoused_inputs"),
              (try_end),
            (try_end),
            
            #If the transaction is for real, and not just a budget check
            (try_begin),
              (eq, "$g_apply_budget_report_to_gold", 1),
              (item_get_slot, ":raw_material", ":enterprise_output", slot_item_primary_raw_material),
              (troop_remove_items, ":craftsman_troop", ":raw_material", ":inputs_taken_from_warehouse"),
              (item_get_slot, ":secondary_raw_material", ":enterprise_output", slot_item_secondary_raw_material),
              (troop_remove_items, ":craftsman_troop", ":secondary_raw_material", ":2ary_inputs_taken_from_warehouse"),
              
              #Affect prices by intputs added to market
              (store_sub, ":item_slot_no", ":raw_material", trade_goods_begin),
              (val_add, ":item_slot_no", slot_town_trade_good_prices_begin),
              (party_get_slot, ":current_index", ":center_no", ":item_slot_no"),
              (store_mul, ":impact_on_price", ":outputs_added_to_market", 15),
              (val_add, ":current_index", ":impact_on_price"),
              (party_set_slot, ":center_no", ":item_slot_no",":current_index"),
              
              (try_begin),
                (gt, ":2ary_inputs_taken_from_market", 0),
                (store_sub, ":item_slot_no", ":secondary_raw_material", trade_goods_begin),
                (val_add, ":item_slot_no", slot_town_trade_good_prices_begin),
                (party_get_slot, ":current_index", ":center_no", ":item_slot_no"),
                (val_add, ":current_index", 15),
                (party_set_slot, ":center_no", ":item_slot_no",":current_index"),
              (try_end),
            (try_end),
            
            (call_script, "script_get_enterprise_name", ":enterprise_output"),
            (str_store_string, s5, reg0),
            
            (create_text_overlay, reg1, "str_enterprise_s5_at_s0", 0),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 25),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg1, pos1),
            
            (assign, reg0, ":net_profit"),
            
            #Enterprise revenue strings
            (try_begin),
              (store_faction_of_party, ":faction_no", ":center_no"),
              (store_relation, ":relation", ":faction_no", "$players_kingdom"),
              (lt, ":relation", 0),
              (assign, reg0, 0),
              (assign, ":net_profit", 0),
              
              (create_text_overlay, reg1, "str_under_sequestration", tf_right_align|tf_single_line),
              (overlay_set_color, reg1, 0xFF0000),
            (else_try),
              (ge, reg0, 0),
              (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
              (overlay_set_color, reg1, 0x00AA00),
            (else_try),
              (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
              (overlay_set_color, reg1, 0xFF0000),
            (try_end),
            
            (val_add, ":all_centers_accumulated_total", ":net_profit"),
            (val_add, ":net_change", ":net_profit"),
            
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg1, pos1),
            (val_sub, ":cur_y", 27),
          (try_end),
          
          #Enterprise ends, taxes begin
          (this_or_next|party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
          (party_slot_ge, ":center_no", slot_center_racket, 1),
          (party_get_slot, ":accumulated_rents", ":center_no", slot_center_accumulated_rents),
          (party_get_slot, ":accumulated_tariffs", ":center_no", slot_center_accumulated_tariffs),
          (try_begin),
            (party_slot_ge, ":center_no", slot_center_racket, 1),
            (val_div, ":accumulated_rents", 2),
            (assign, ":accumulated_tariffs", 0),
          (try_end),
          (store_add, ":accumulated_total", ":accumulated_rents", ":accumulated_tariffs"),
          (val_add, ":all_centers_accumulated_total", ":accumulated_total"),
          (val_add, ":all_centers_accumulated_taxes_and_rents", ":accumulated_total"),
          (val_add, ":net_change", ":accumulated_total"),
          (str_store_party_name, s0, ":center_no"),
          (create_text_overlay, reg1, "str_rents_from_s0", 0),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, ":accumulated_rents", 0),
            (assign, reg0, ":accumulated_rents"),
            (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
            (overlay_set_color, reg1, 0x00AA00),
          (else_try),
            (this_or_next|party_slot_ge, ":center_no", slot_party_looted_left_days, 1),
            (party_slot_eq, ":center_no", slot_village_state, svs_looted),
            (create_text_overlay, reg1, "str_none", tf_right_align|tf_single_line),
          (else_try),
            (create_text_overlay, reg1, "@Unpaid", tf_right_align|tf_single_line),
          (try_end),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
          
          (try_begin),
            (is_between, ":center_no", towns_begin, towns_end),
            (create_text_overlay, reg1, "str_tariffs_from_s0", 0),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 25),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg1, pos1),
            (try_begin),
              (gt, ":accumulated_tariffs", 0),
              (assign, reg0, ":accumulated_tariffs"),
              (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
              (overlay_set_color, reg1, 0x00AA00),
            (else_try),
              (create_text_overlay, reg1, "str_none", tf_right_align|tf_single_line),
            (try_end),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg1, pos1),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg1, pos1),
            (val_sub, ":cur_y", 27),
          (try_end),
        (try_end),
        
        (try_begin),
          (gt, "$players_kingdom", 0),
          (neq, "$players_kingdom", "fac_player_supporters_faction"),
          (neq, "$players_kingdom", "fac_player_faction"),
          (eq, "$player_has_homage", 0),
          (str_store_faction_name, s0, "$players_kingdom"),
          (create_text_overlay, reg1, "str_mercenary_payment_from_s0", 0),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (call_script, "script_party_calculate_strength", "p_main_party", 0),
          (assign, ":offer_value", reg0),
          (val_div, ":offer_value", 2),
          (val_add, ":offer_value", 30),
          (call_script, "script_round_value", ":offer_value"),
          (val_add, ":net_change", reg0),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (overlay_set_color, reg1, 0x00AA00),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
        (try_end),
        
        (try_begin),
          (gt, ":num_owned_center_values_for_tax_efficiency", ":num_centers_needed_for_efficiency_loss"),
          (gt, ":all_centers_accumulated_total", 0),
          (store_sub, ":ratio_lost", ":num_owned_center_values_for_tax_efficiency", ":num_centers_needed_for_efficiency_loss"),
          (val_mul, ":ratio_lost", ":tax_efficiency_loss_ratio_per_center"),
          (val_min, ":ratio_lost", 65),
          
          #(store_mul, ":tax_lost", ":all_centers_accumulated_total", ":ratio_lost"),
          (store_mul, ":tax_lost", ":all_centers_accumulated_taxes_and_rents", ":ratio_lost"),
          (val_div, ":tax_lost", 100),
          
          (val_sub, ":net_change", ":tax_lost"),
          (create_text_overlay, reg1, "str_loss_due_to_tax_inefficiency", 0),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (store_mul, reg0, ":tax_lost", -1),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (overlay_set_color, reg1, 0xFF0000),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
        (try_end),
        
        (assign, "$g_player_num_creditors", 0), #motomataru chief fix debt morale penalty
        (assign, "$g_player_old_wages", 0), #motomataru chief fix debt morale penalty
        (try_for_parties, ":party_no"),
          (assign, ":garrison_troop", 0),
          (try_begin),
            (this_or_next|party_slot_eq, ":party_no", slot_party_type, spt_town),
            (party_slot_eq, ":party_no", slot_party_type, spt_castle),
            (party_slot_eq, ":party_no", slot_town_lord, "trp_player"),
            (assign, ":garrison_troop", 1),
          (else_try),
            (this_or_next|party_slot_eq, ":party_no", slot_party_type, spt_town),
            (party_slot_eq, ":party_no", slot_party_type, spt_castle),
            (neg|party_slot_ge, ":party_no", slot_town_lord, 1), #unassigned
            (store_faction_of_party, ":center_faction", ":party_no"),
            (eq, ":center_faction", "fac_player_supporters_faction"),
            (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
            (assign, ":garrison_troop", 1),
          (try_end),
          
          (this_or_next|eq, ":party_no", "p_yourlair"),#para salarios de player lair chief
          (this_or_next|eq, ":party_no", "p_main_party"),
          (this_or_next|eq, ":party_no", "p_troop_camp_1"),	#new phaiak
          (this_or_next|eq, ":party_no", "p_troop_camp_2"),	#new phaiak
          (eq, ":garrison_troop", 1),
          (assign, ":total_wage", 0),
          (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
          (try_for_range, ":i_stack", 0, ":num_stacks"),
            (party_stack_get_troop_id, ":stack_troop", ":party_no", ":i_stack"),
            (party_stack_get_size, ":stack_size", ":party_no", ":i_stack"),
            (val_add, "$g_player_num_creditors", ":stack_size"), #motomataru chief fix debt morale penalty
            (call_script, "script_game_get_troop_wage", ":stack_troop", ":party_no"),
            (assign, ":cur_wage", reg0),
            (val_mul, ":cur_wage", ":stack_size"),
            (val_add, ":total_wage", ":cur_wage"),
            # for debug log:
            (val_add, ":num_total_garrison_troops", 1),
          (try_end),
          (try_begin),
            (this_or_next|eq, ":party_no", "p_yourlair"),#para salarios de player lair chief
            (eq, ":garrison_troop", 1),
            (val_div, ":total_wage", 4), #Half payment for garrisons Chief changes 2 to 4, is very cheap have men in garrison, but very expensive have them in campaign
            ###player lair begin
            (assign, ":staff_cost_mant", 0),
            (try_begin), #cost staff in lair
              (eq, "$captain_ok", hire_captainok),#
              (val_add, ":staff_cost_mant", 55),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_priest1", hire_priest1),#
              (val_add, ":staff_cost_mant", 30),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_priest1", hire_priest2),#
              (val_add, ":staff_cost_mant", 30),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$bard_type", hire_bard1),#
              (val_add, ":staff_cost_mant", 40),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$bard_type", hire_bard2),#
              (val_add, ":staff_cost_mant", 40),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_tavernkeeper1", hire_tavernkeeper1),#
              (val_add, ":staff_cost_mant", 10),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_whore1", hire_whore1),#
              (val_add, ":staff_cost_mant", 25),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_whore1", hire_whore2),#
              (val_add, ":staff_cost_mant", 25),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_whore1", hire_whore3),#
              (val_add, ":staff_cost_mant", 15),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_whore1", hire_whore4),#
              (val_add, ":staff_cost_mant", 15),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_trainer1", hire_trainer1),#
              (val_add, ":staff_cost_mant", 45),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_smith1", hire_smith1),
              (val_add, ":staff_cost_mant", 40),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_armorer1", hire_armorer1),
              (val_add, ":staff_cost_mant", 40),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_barber1", hire_barber1),#
              (val_add, ":staff_cost_mant", 15),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_barber1", hire_barber2),#
              (val_add, ":staff_cost_mant", 15),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_barber1", hire_barber3),#
              (val_add, ":staff_cost_mant", 30),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_barber1", hire_barber4),#
              (val_add, ":staff_cost_mant", 15),
            (try_end),
            (try_begin), #cost staff in lair
              (eq, "$hire_cook1", hire_cook1),#
              (val_add, ":staff_cost_mant", 30),
            (try_end),
            (val_add, ":total_wage", ":staff_cost_mant"), #Half payment for garrisons Chief changes 2 to 4, is very cheap have men in garrison, but very expensive have them in campaign
            ###player lair acaba
          (else_try),
            (this_or_next|eq, ":party_no", "p_troop_camp_1"),	#new phaiak
            (this_or_next|eq, ":party_no", "p_troop_camp_2"),	#new phaiak
            (eq, ":party_no", "p_main_party"),
            #(val_mul, ":total_wage", 2), #x2 payment for player party Chief, is very cheap have men in garrison, but very expensive have them in campaign
            (store_sub, ":total_payment_ratio", 14, "$g_cur_week_half_daily_wage_payments"), #between 0 and 7
            (val_mul, ":total_wage", ":total_payment_ratio"),
            (val_div, ":total_wage", 14),
          (try_end),
          ##        (gt, ":total_wage", 0),
          (val_add, "$g_player_old_wages", ":total_wage"), #motomataru chief fix debt morale penalty
          (val_mul, ":total_wage", -1),
          (val_add, ":net_change", ":total_wage"),
          # VC-2176 begin
          (assign, ":block", 0),
          (try_begin),
            (ge, ":total_wage", 0),
            (this_or_next|eq, ":party_no", "p_troop_camp_1"),	#new phaiak
            (this_or_next|eq, ":party_no", "p_troop_camp_2"),
            (eq, ":party_no", "p_yourlair"),
            (assign, ":block", 1),
          (try_end),
          (eq, ":block", 0),
          # VC-2176 end
          (str_store_party_name, s0, ":party_no"),
          (try_begin),
            (eq, ":party_no", "p_main_party"),
            (str_store_string, s0, "str_s0s_party"),
          (try_end),
          (create_text_overlay, reg1, "str_wages_for_s0", 0),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (lt, ":total_wage", 0),
            (assign, reg0, ":total_wage"),
            (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
            (overlay_set_color, reg1, 0xFF0000),
          (else_try),
            (create_text_overlay, reg1, "str_none", tf_right_align|tf_single_line),
          (try_end),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
        (try_end),
        
        (try_begin),
          (gt, "$g_player_debt_to_party_members", 0),
          (val_sub, ":net_change", "$g_player_debt_to_party_members"),
          (assign, ":player_debt_to_party_members", "$g_player_debt_to_party_members"),
          (create_text_overlay, reg1, "str_earlier_debts", 0),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (store_mul, reg0, "$g_player_debt_to_party_members", -1),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (overlay_set_color, reg1, 0xFF0000),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
        (try_end),
        ######chief kingdom screen salary minister
        (assign, ":minister_salary", 0),
        (try_begin),
          (gt, "$g_player_minister", 0),
          (val_add, ":minister_salary", 55),
        (try_end),
        (try_begin),
          (eq, "$control_tax", 1),  #tax control active
          (val_add, ":minister_salary", 3000),
        (try_end),
        
        (try_begin),
          (gt, ":minister_salary", 0),
          (val_sub, ":net_change", ":minister_salary"), #remove money
          (create_text_overlay, reg1, "@Kingdom Advisor:", 0),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (store_mul, reg0, ":minister_salary", -1),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (overlay_set_color, reg1, 0xFF0000),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
        (try_end),
        ###########
        #Chief - player is king,
        (assign, ":lords_payment_final", 0),
        (try_begin),
          (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_active),
          (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
          (try_begin), #extra income from kingdom / lords taxes
            (faction_get_slot,":num_castles","fac_player_supporters_faction",slot_faction_num_castles),
            (faction_get_slot,":num_towns","fac_player_supporters_faction",slot_faction_num_towns),
            (val_mul,":num_castles",800),
            (val_mul,":num_towns",1600),
            (val_add,":num_towns",":num_castles"),
            (val_add, ":lords_payment_final", ":num_towns"),
            (try_begin),
              (eq, "$control_tax", 1),  #tax control active
              (val_div, ":lords_payment_final", 2),
            (else_try),
              (val_div, ":lords_payment_final", 4),
            (try_end),
            (val_max, ":lords_payment_final", 0),
          (try_end),
          #  (assign, ":lords_payment_final", ":lords_payment"),
        (try_end),
        
        (try_begin),
          (gt, ":lords_payment_final", 0),
          (val_add, ":net_change", ":lords_payment_final"),
          (create_text_overlay, reg1, "@Kingdom Tributes:", 0),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":lords_payment_final"),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (overlay_set_color, reg1, 0x00AA00),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
        (try_end),
        ##########################
        
        (create_mesh_overlay, reg1, "mesh_white_plane"),
        (overlay_set_color, reg1, 0x000000),
        (position_set_x, pos1, 24000),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (store_add, ":line_y", ":cur_y", 25),
        (position_set_y, pos1, ":line_y"),
        (overlay_set_position, reg1, pos1),
        (create_text_overlay, reg1, "str_net_change", 0),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (assign, reg0, ":net_change"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (try_begin),
          (gt, reg0, 0),
          (overlay_set_color, reg1, 0x00AA00),
        (else_try),
          (lt, reg0, 0),
          (overlay_set_color, reg1, 0xFF0000),
        (try_end),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":cur_y", 27),
        (create_text_overlay, reg1, "str_earlier_wealth", 0),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (store_troop_gold, ":player_wealth", "trp_player"),
        (assign, reg0, ":player_wealth"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":cur_y", 27),
        (val_mul, ":net_change", -1),
        (try_begin),
          (ge, ":player_wealth", ":net_change"),
          (assign, ":player_wealth_dif", ":net_change"),
          (assign, ":player_new_debt_to_party_members", 0),
        (else_try),
          (assign, ":player_wealth_dif", ":player_wealth"),
          (store_sub, ":player_new_debt_to_party_members", ":net_change", ":player_wealth"),
        (try_end),
        (create_text_overlay, reg1, "str_new_wealth", 0),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (store_sub, reg0, ":player_wealth", ":player_wealth_dif"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":cur_y", 27),
        
        (try_begin),
          (gt, ":player_new_debt_to_party_members", 0),
          (create_text_overlay, reg1, "str_new_debts", 0),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 25),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":player_new_debt_to_party_members"),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
          (neq, "$g_apply_budget_report_to_gold", 0),
          (call_script, "script_objectionable_action", tmt_egalitarian, "str_men_unpaid"),
        (try_end),
        
        (set_container_overlay, -1),
        
        (create_button_overlay, "$g_presentation_obj_budget_report_1", "str_continue"),
        (position_set_x, pos1, 225),
        (position_set_y, pos1, 60),
        (overlay_set_position, "$g_presentation_obj_budget_report_1", pos1),
        
        (try_begin),
          (eq, "$g_apply_budget_report_to_gold", 1),
          (assign, "$g_player_debt_to_party_members", ":player_new_debt_to_party_members"),
          (try_begin), #chief anade Motomataru cambia aqui
            (gt, "$g_player_debt_to_party_members", 0),
            (display_message, "@Your troops are unpaid! Morale has dropped.",0xFFFFAAAA),
            (call_script, "script_get_player_party_morale_values"),
            (store_mul, reg0, "$g_player_party_morale_modifier_debt", -1),
            (call_script, "script_change_player_party_morale", reg0),
          (try_end), #chief acaba
          (try_begin),
            (gt, ":player_wealth_dif", 0),
            (troop_remove_gold, "trp_player", ":player_wealth_dif"),
          (else_try),
            (val_mul, ":player_wealth_dif", -1),
            (troop_add_gold, "trp_player", ":player_wealth_dif"),
          (try_end),
          (try_for_range, ":center_no", centers_begin, centers_end),
            (try_begin),
              (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
              (party_set_slot, ":center_no", slot_center_accumulated_rents, 0),
              (party_set_slot, ":center_no", slot_center_accumulated_tariffs, 0),
            (else_try),
              (party_slot_ge, ":center_no", slot_center_racket, 1),
              (party_get_slot, ":accumulated_rents", ":center_no", slot_center_accumulated_rents),
              (val_div, ":accumulated_rents", 2),
              (party_set_slot, ":center_no", slot_center_accumulated_rents, ":accumulated_rents"),
              (party_get_slot, ":racket", ":center_no", slot_center_racket),
              (val_sub, ":racket", 1),
              (party_set_slot, ":center_no", slot_center_racket, ":racket"),
            (try_end),
          (try_end),
          (assign, "$g_cur_week_half_daily_wage_payments", 0),#Reseting the weekly half wage payments
        (try_end),
        
        # DEBUG LOG
        (try_begin),
          (eq, "$g_apply_budget_report_to_gold", 1),
          ###
          (assign, ":num_towns", 0),
          (assign, ":num_castle", 0),
          (assign, ":num_villages", 0),
          (assign, ":num_enterprise", 0),
          (try_for_range, ":center_no", centers_begin, centers_end),
            (try_begin),
              (party_slot_ge, ":center_no", slot_center_player_enterprise, 1),
              (val_add, ":num_enterprise", 1),
            (try_end),
            (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
            (try_begin),
              (is_between, ":center_no", towns_begin, towns_end),
              (val_add, ":num_towns", 1),
            (else_try),
              (is_between, ":center_no", castles_begin, castles_end),
              (val_add, ":num_castle", 1),
            (else_try),
              (val_add, ":num_villages", 1),
            (try_end),
          (try_end),
          ###
          (store_current_day, reg1),
          (store_troop_gold, reg2, "trp_player"),
          ##
          (assign, reg3, "$num_selled_goods_in_week", 0),
          (assign, reg4, "$selled_goods_in_week_for", 0),
          (assign, reg5, "$num_selled_items_in_week", 0),
          (assign, reg6, "$selled_items_in_week_for", 0),
          (assign, reg7, "$num_buyed_goods_in_week", 0),
          (assign, reg8, "$buyed_goods_in_week_for", 0),
          (assign, reg9, "$num_buyed_items_in_week", 0),
          (assign, reg10, "$buyed_items_in_week_for", 0),
          ##
          (store_party_size_wo_prisoners, reg11,"p_main_party"),
          (assign, reg12, ":num_total_garrison_troops"),
          (assign, reg13, ":num_towns"),
          (assign, reg14, ":num_castle"),
          (assign, reg15, ":num_villages"),
          (assign, reg16, ":num_enterprise"),
          ###
          (assign, reg17, ":net_profit"),
          (assign, reg18, ":accumulated_total"),
          (assign, reg19, ":offer_value"),
          (assign, reg20, ":tax_lost"),
          (assign, reg21, ":total_wage"),
          (assign, reg22, ":player_debt_to_party_members"),
          (assign, reg23, ":minister_salary"),
          (assign, reg24, ":lords_payment_final"),
          ###
          (str_store_troop_name_plural, s30, "trp_pseudo_troop_01"),
          (str_store_string, s30, "@{s30}{reg1},{reg2},{reg3},{reg4},{reg5},{reg6},{reg7},{reg8},{reg9},{reg10},{reg11},{reg12},{reg13},{reg14},{reg15},{reg16},{reg17},{reg18},{reg19},{reg20},{reg21},{reg22},{reg23},{reg24}/"),
          (troop_set_plural_name, "trp_pseudo_troop_01", s30),
          #
          (assign, "$num_selled_goods_in_week", 0),
          (assign, "$selled_goods_in_week_for", 0),
          (assign, "$num_selled_items_in_week", 0),
          (assign, "$selled_items_in_week_for", 0),
          (assign, "$num_buyed_goods_in_week", 0),
          (assign, "$buyed_goods_in_week_for", 0),
          (assign, "$num_buyed_items_in_week", 0),
          (assign, "$buyed_items_in_week_for", 0),
        (try_end),
        
    ]),
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_budget_report_1"),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("game_before_quit", 0, mesh_load_window,
  [
    (ti_on_presentation_load,
      [
        (try_begin),
          (is_trial_version),
          (set_fixed_point_multiplier, 1000),
          (create_mesh_overlay, reg0, "mesh_quit_adv"),
          (position_set_x, pos1, -1),
          (position_set_y, pos1, -1),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 1002),
          (position_set_y, pos1, 1002),
          (overlay_set_size, reg0, pos1),
          (assign, "$g_game_before_quit_state", 0),
          (presentation_set_duration, 999999),
        (try_end),
    ]),
    (ti_on_presentation_run,
      [
        (store_trigger_param_1, ":cur_time"),
        (gt, ":cur_time", 500),
        (try_begin),
          (this_or_next|key_clicked, key_space),
          (this_or_next|key_clicked, key_enter),
          (this_or_next|key_clicked, key_escape),
          (this_or_next|key_clicked, key_back_space),
          (this_or_next|key_clicked, key_left_mouse_button),
          (this_or_next|key_clicked, key_right_mouse_button),
          (this_or_next|key_clicked, key_pad_start),
          (this_or_next|key_clicked, key_pad_ltrigger),
          (key_clicked, key_pad_rtrigger),
          (try_begin),
            (eq, "$g_game_before_quit_state", 0),
            (val_add, "$g_game_before_quit_state", 1),
            (create_mesh_overlay, reg0, "mesh_quit_adv_b"),
            (position_set_x, pos1, -1),
            (position_set_y, pos1, -1),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 1002),
            (position_set_y, pos1, 1002),
            (overlay_set_size, reg0, pos1),
          (else_try),
            (presentation_set_duration, 0),
          (try_end),
        (try_end),
    ]),
]),

("multiplayer_duel_start_counter", prsntf_read_only|prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        
        (assign, "$g_multiplayer_duel_start_counter_overlay", -1),
        (assign, "$g_multiplayer_last_duel_start_counter_value", -1),
        
        (str_clear, s0),
        (create_text_overlay, "$g_multiplayer_duel_start_counter_overlay", s0, tf_center_justify|tf_with_outline),
        (overlay_set_color, "$g_multiplayer_duel_start_counter_overlay", 0xFFFFFF),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 600),
        (overlay_set_position, "$g_multiplayer_duel_start_counter_overlay", pos1),
        (position_set_x, pos1, 2000),
        (position_set_y, pos1, 2000),
        (overlay_set_size, "$g_multiplayer_duel_start_counter_overlay", pos1),
        
        (presentation_set_duration, 999999),
    ]),
    
    (ti_on_presentation_run, [
        (ge, "$g_multiplayer_duel_start_counter_overlay", 0),
        (store_mission_timer_a, ":current_time"),
        (store_sub, ":seconds_past_in_duel_start", ":current_time", "$g_multiplayer_duel_start_time"),
        (store_sub, ":seconds_left_in_duel_start", 3, ":seconds_past_in_duel_start"),
        (try_begin),
          (le, ":seconds_left_in_duel_start", 0),
          (presentation_set_duration, 0),
        (else_try),
          (neq, "$g_multiplayer_last_duel_start_counter_value", ":seconds_left_in_duel_start"),
          (assign, "$g_multiplayer_last_duel_start_counter_value", ":seconds_left_in_duel_start"),
          (assign, reg0, ":seconds_left_in_duel_start"),
          (str_store_string, s0, "str_duel_starts_in_reg0_seconds"),
          (overlay_set_text, "$g_multiplayer_duel_start_counter_overlay", s0),
        (try_end),
    ]),
]),
####Moto chief formations, formaciones
("order_display", prsntf_read_only,0,[
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        
        (try_for_range, ":slot", 0, 9),
          (troop_set_slot, "trp_multiplayer_profile_troop_male", ":slot", -1),  #recycle for order array
        (try_end),
        
        (assign, ":num_orders", 0),
        (assign, ":y_position", 564),
        (try_begin), #Figure out which orders to display, set strings
          (eq, "$gk_order", 0),
          (str_store_string, s1, "@F4 - Complex formations"),
          (assign, ":num_orders", 1),
          (assign, ":y_position", 474),	#564 - 3 * 30
        (else_try),
          (eq, "$gk_order", gk_order_2),
          (str_store_string, s1, "@F7 - Memorize div. placement"),
          (str_store_string, s2, "@F8 - Default division placement"),
          (assign, ":num_orders", 2),
          (assign, ":y_position", 384),	#564 - 6 * 30
        (else_try),
          (eq, "$gk_order", gk_order_4),
          (str_store_string, s1, "@F4 - Ranks"),
          (str_store_string, s2, "@F5 - Shield Wall"),
          (str_store_string, s3, "@F6 - Wedge"),
          (str_store_string, s4, "@F7 - Square"),
          (str_store_string, s5, "@F8 - No Formation"),
          (assign, ":num_orders", 5),
        (try_end),
        (assign, "$menu_by_gk_order", "$gk_order"),
        
        (try_for_range, ":i", 0, ":num_orders"),
          (try_begin),
            (eq, ":i", 0),
            (str_store_string_reg, s0, s1),
          (else_try),
            (eq, ":i", 1),
            (str_store_string_reg, s0, s2),
          (else_try),
            (eq, ":i", 2),
            (str_store_string_reg, s0, s3),
          (else_try),
            (eq, ":i", 3),
            (str_store_string_reg, s0, s4),
          (else_try),
            (eq, ":i", 4),
            (str_store_string_reg, s0, s5),
          (try_end),
          (create_text_overlay, ":overlay", s0),
          (overlay_set_color, ":overlay", 0xFFFFFF),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, ":overlay", pos1),
          (position_set_x, pos1, 1),
          (position_set_y, pos1, ":y_position"),
          (overlay_set_position, ":overlay", pos1),
          
          (troop_set_slot, "trp_multiplayer_profile_troop_male", ":i", ":overlay"),
          (val_sub, ":y_position", 30),
        (try_end),
        (store_mul, ":add_back", 30, ":num_orders"),
        (val_add, ":y_position", ":add_back"),
        (val_sub, ":y_position", 4),
        (try_for_range, ":i", 0, ":num_orders"),
          (create_mesh_overlay, ":overlay", "mesh_order_frame"),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 700),
          (overlay_set_size, ":overlay", pos1),
          
          (position_set_x, pos1, 0),
          (position_set_y, pos1, ":y_position"),
          (overlay_set_position, ":overlay", pos1),
          
          (val_sub, ":y_position", 30),
        (try_end),
        
        (try_begin),
          # (neq, "$gk_order", 0),
          # (neq, "$gk_order", gk_order_1),
          # (neq, "$gk_order", gk_order_2),
          # (neq, "$gk_order", gk_order_3),
          (eq, "$gk_order", gk_order_4),
          (create_mesh_overlay, ":overlay", "mesh_white_plane"),
          (overlay_set_color, ":overlay", 0),
          (overlay_set_alpha, ":overlay", 0x10),
          (position_set_x, pos1, 14000),
          (position_set_y, pos1, 4500),
          (overlay_set_size, ":overlay", pos1),
          
          (position_set_x, pos1, 0),
          (position_set_y, pos1, 498),
          (overlay_set_position, ":overlay", pos1),
        (try_end),
        
        (presentation_set_duration, 999999),
    ]),
    
    (ti_on_presentation_run, [
        (store_trigger_param_1, ":cur_time"),
        (gt, ":cur_time", 250), #0.25 Second after Pres. Start
        (try_begin),
          (this_or_next|game_key_clicked, gk_order_1),
          (this_or_next|game_key_clicked, gk_order_2),
          (this_or_next|game_key_clicked, gk_order_3), #Order Keys not used by Expanded Orders
          (this_or_next|game_key_clicked, gk_view_orders),
          (this_or_next|game_key_clicked, gk_group0_hear),
          (this_or_next|game_key_clicked, gk_group1_hear),
          (this_or_next|game_key_clicked, gk_group2_hear),
          (this_or_next|game_key_clicked, gk_group3_hear),
          (this_or_next|game_key_clicked, gk_group4_hear),
          (this_or_next|game_key_clicked, gk_group5_hear),
          (this_or_next|game_key_clicked, gk_group6_hear),
          (this_or_next|game_key_clicked, gk_group7_hear),
          (this_or_next|game_key_clicked, gk_group8_hear),
          (this_or_next|game_key_clicked, gk_everyone_hear),
          (this_or_next|game_key_clicked, gk_reverse_order_group),
          (game_key_clicked, gk_everyone_around_hear),
          (presentation_set_duration, 0),
        (try_end),
        (try_begin),
          (assign, ":key", -1),
          (try_begin),
            (game_key_clicked, gk_order_4),
            (assign, ":key", 4),
          (else_try),
            (game_key_clicked, gk_order_5),
            (assign, ":key", 5),
          (else_try),
            (game_key_clicked, gk_order_6),
            (assign, ":key", 6),
          (else_try),
            (key_clicked, key_f7),
            (assign, ":key", 7),
          (else_try),
            (key_clicked, key_f8),
            (assign, ":key", 8),
          (try_end),
          (neq, ":key", -1),
          (try_begin),
            (eq, "$menu_by_gk_order", 0),
            (presentation_set_duration, 0),
          (else_try),
            (eq, "$menu_by_gk_order", gk_order_4),
            (assign, ":min_key", 4),
            (assign, ":max_key", 8),
            
            (store_sub, ":num_orders", ":max_key", ":min_key"),
            (val_add, ":num_orders", 1),
            (store_sub, ":key_pressed", ":key", ":min_key"),
            (is_between, ":key_pressed", 0, ":num_orders"),
            (try_for_range, ":i", 0, ":num_orders"),
              (troop_get_slot, ":overlay", "trp_multiplayer_profile_troop_male", ":i"),
              (try_begin),
                (neq, ":i", ":key_pressed"),
                (overlay_animate_to_alpha, ":overlay", 400, 0x00),
                (val_add, ":overlay", ":num_orders"),
                (overlay_animate_to_alpha, ":overlay", 400, 0x00),
              (else_try),
                (overlay_animate_to_alpha, ":overlay", 1100, 0x00),
                (val_add, ":overlay", ":num_orders"),
                (overlay_animate_to_alpha, ":overlay", 1100, 0x00),
              (try_end),
            (try_end),
            (presentation_set_duration, 200),
            (close_order_menu),
            (assign, "$native_opening_menu", 0),
          (try_end),
        (try_end),
    ]),
]),

("console_main_menu_extended", prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (assign, ":num_orders", 0),
        (assign, ":y_position", 564),
        
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (position_set_x, pos2, 1),

        (create_text_overlay, ":overlay", "@F1 - Movement orders"),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (create_text_overlay, ":overlay", "@F2 - Formation orders"),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (create_text_overlay, ":overlay", "@F3 - Fire orders"),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (create_text_overlay, ":overlay", "@F4 - Complex formations"),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        #order frames
        (assign, ":y_position", 564),
        (val_sub, ":y_position", 4),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 700),
        (position_set_x, pos2, 0),
        
        (try_for_range, reg1, 0, ":num_orders"),
          (create_mesh_overlay, ":overlay", "mesh_order_frame"),
          (overlay_set_size, ":overlay", pos1),
          (position_set_y, pos2, ":y_position"),
          (overlay_set_position, ":overlay", pos2),
          (val_sub, ":y_position", 30),
        (try_end),
        
        #blank out Native menu
        (create_mesh_overlay, ":overlay", "mesh_white_plane"),
        (overlay_set_color, ":overlay", 0),
        (overlay_set_alpha, ":overlay", 0x10),
        (position_set_x, pos1, 14000),
        (position_set_y, pos1, 4500),
        (overlay_set_size, ":overlay", pos1),
        
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 498),
        (overlay_set_position, ":overlay", pos1),
        
        (presentation_set_duration, 999999),
    ]),
]),

("console_division_menu", prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (assign, ":num_orders", 0),
        (assign, ":y_position", 564),
        
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (position_set_x, pos2, 1),

        (try_begin),
          (eq, "$FormAI_off", 0),
          (create_text_overlay, ":overlay", "@Ranks"),
        (else_try),
          (create_text_overlay, ":overlay", "@Five Rows"),
        (try_end),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (try_begin),
          (eq, "$FormAI_off", 0),
          (create_text_overlay, ":overlay", "@Shield Wall"),
        (else_try),
          (create_text_overlay, ":overlay", "@Four Rows"),
        (try_end),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (try_begin),
          (eq, "$FormAI_off", 0),
          (create_text_overlay, ":overlay", "@Wedge"),
        (else_try),
          (create_text_overlay, ":overlay", "@Three Rows"),
        (try_end),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (try_begin),
          (eq, "$FormAI_off", 0),
          (create_text_overlay, ":overlay", "@Square"),
        (else_try),
          (create_text_overlay, ":overlay", "@Two Rows"),
        (try_end),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (try_begin),
          (eq, "$FormAI_off", 0),
          (create_text_overlay, ":overlay", "@No Formation"),
        (else_try),
          (create_text_overlay, ":overlay", "@Single Line"),
        (try_end),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (create_text_overlay, ":overlay", "@Memorize div. placement"),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        (create_text_overlay, ":overlay", "@Default division placement"),
        (overlay_set_size, ":overlay", pos1),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (try_begin),
          (eq, ":num_orders", "$dpad_menu_row"),
          (overlay_set_color, ":overlay", 0xFF0000),
        (else_try),
          (overlay_set_color, ":overlay", 0xFFFFFF),
        (try_end),
        (val_sub, ":y_position", 30),
        (val_add, ":num_orders", 1),
        
        #order frames
        (assign, ":y_position", 564),
        (val_sub, ":y_position", 4),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 700),
        (position_set_x, pos2, 0),
        
        (try_for_range, reg1, 0, ":num_orders"),
          (create_mesh_overlay, ":overlay", "mesh_order_frame"),
          (overlay_set_size, ":overlay", pos1),
          (position_set_y, pos2, ":y_position"),
          (overlay_set_position, ":overlay", pos2),
          (val_sub, ":y_position", 30),
        (try_end),

        (presentation_set_duration, 999999),
    ]),
]),

("console_player_functions", prsntf_read_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        (assign, ":x_position", 675),
        (assign, ":y_position", 150),
        
        (position_set_x, pos1, 1000), #text size
        (position_set_y, pos1, 1000),
        (position_set_x, pos3, dot_size * Screen_Undistort_Width_Num / Screen_Undistort_Width_Den), #icon size
        (position_set_y, pos3, dot_size),

        (create_text_overlay, ":overlay", "@    Y^Cancel"),
        (overlay_set_size, ":overlay", pos1),
        (position_set_x, pos2, ":x_position"),
        (position_set_y, pos2, ":y_position"),
        (overlay_set_position, ":overlay", pos2),
        (overlay_set_color, ":overlay", 0xFFFF00),
        (overlay_set_additional_render_height, ":overlay", 10),
        
        (create_mesh_overlay, "$g_presentation_obj_1", "mesh_white_dot"),
        (overlay_set_size, "$g_presentation_obj_1", pos3),
        (store_add, ":dot_x", ":x_position", dot_size/120),
        (store_add, ":dot_y", ":y_position", dot_size/200),
        (position_set_x, pos2, ":dot_x"),
        (position_set_y, pos2, ":dot_y"),
        (overlay_set_position, "$g_presentation_obj_1", pos2),
        (overlay_set_color, "$g_presentation_obj_1", dot_color),
        (overlay_set_alpha, "$g_presentation_obj_1", dot_alpha),
          
        (val_sub, ":y_position", dot_size/(2*dot_spacing_div)),
        (val_sub, ":x_position", dot_size*Screen_Undistort_Width_Num/(2*dot_spacing_div*Screen_Undistort_Width_Den)),
        
        (store_and, reg1, "$player_functions", player_func_trait),
        (try_begin),
          (neq, reg1, 0),
          (create_text_overlay, ":overlay", "@    X^  Trait"),
          (overlay_set_size, ":overlay", pos1),
          (position_set_x, pos2, ":x_position"),
          (position_set_y, pos2, ":y_position"),
          (overlay_set_position, ":overlay", pos2),
          (overlay_set_color, ":overlay", 0x0044FF),
          (overlay_set_additional_render_height, ":overlay", 10),
          
          (create_mesh_overlay, "$g_presentation_obj_2", "mesh_white_dot"),
          (overlay_set_size, "$g_presentation_obj_2", pos3),
          (store_add, ":dot_x", ":x_position", dot_size/120),
          (store_add, ":dot_y", ":y_position", dot_size/200),
          (position_set_x, pos2, ":dot_x"),
          (position_set_y, pos2, ":dot_y"),
          (overlay_set_position, "$g_presentation_obj_2", pos2),
          (overlay_set_color, "$g_presentation_obj_2", dot_color),
          (overlay_set_alpha, "$g_presentation_obj_2", dot_alpha),
        (try_end),
          
        (val_add, ":x_position", dot_size*Screen_Undistort_Width_Num/(dot_spacing_div*Screen_Undistort_Width_Den)),
        
        (store_and, reg1, "$player_functions", player_func_horsecall),
        (try_begin),
          (neq, reg1, 0),
          (create_text_overlay, ":overlay", "@    B^ Horse"),
          (overlay_set_size, ":overlay", pos1),
          (position_set_x, pos2, ":x_position"),
          (position_set_y, pos2, ":y_position"),
          (overlay_set_position, ":overlay", pos2),
          (overlay_set_color, ":overlay", 0xFF0000),
          (overlay_set_additional_render_height, ":overlay", 10),
          
          (create_mesh_overlay, "$g_presentation_obj_3", "mesh_white_dot"),
          (overlay_set_size, "$g_presentation_obj_3", pos3),
          (store_add, ":dot_x", ":x_position", dot_size/120),
          (store_add, ":dot_y", ":y_position", dot_size/200),
          (position_set_x, pos2, ":dot_x"),
          (position_set_y, pos2, ":dot_y"),
          (overlay_set_position, "$g_presentation_obj_3", pos2),
          (overlay_set_color, "$g_presentation_obj_3", dot_color),
          (overlay_set_alpha, "$g_presentation_obj_3", dot_alpha),
        (try_end),
          
        (val_sub, ":y_position", dot_size/(2*dot_spacing_div)),
        (val_sub, ":x_position", dot_size*Screen_Undistort_Width_Num/(2*dot_spacing_div*Screen_Undistort_Width_Den)),
        
        (store_and, reg1, "$player_functions", player_func_creeping),
        (try_begin),
          (neq, reg1, 0),
          (create_text_overlay, ":overlay", "@    A^ Creep"),
          (overlay_set_size, ":overlay", pos1),
          (position_set_x, pos2, ":x_position"),
          (position_set_y, pos2, ":y_position"),
          (overlay_set_position, ":overlay", pos2),
          (overlay_set_color, ":overlay", 0x00FF00),
          (overlay_set_additional_render_height, ":overlay", 10),
          
          (create_mesh_overlay, "$g_presentation_obj_4", "mesh_white_dot"),
          (overlay_set_size, "$g_presentation_obj_4", pos3),
          (store_add, ":dot_x", ":x_position", dot_size/120),
          (store_add, ":dot_y", ":y_position", dot_size/200),
          (position_set_x, pos2, ":dot_x"),
          (position_set_y, pos2, ":dot_y"),
          (overlay_set_position, "$g_presentation_obj_4", pos2),
          (overlay_set_color, "$g_presentation_obj_4", dot_color),
          (overlay_set_alpha, "$g_presentation_obj_4", dot_alpha),
        (try_end),
          
        (presentation_set_duration, 999999),
    ]),
]),

("formation_mod_option", 0, mesh_load_window, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        (create_text_overlay, reg1, "@Extended Formations and AI Options", tf_center_justify),
        (position_set_x, pos0, Screen_Width/2),
        #  (position_set_y, pos0, Screen_Title_Height),
        (position_set_y, pos0, 600),
        (overlay_set_position, reg1, pos0),
        
        #  (assign, ":y_pos", Screen_Title_Height-Screen_Text_Height-Screen_Text_Height),
        (assign, ":y_pos", 450),
        
        #Disable formations option
        (create_text_overlay, reg1, "@Disable mod formations: ", tf_right_align),
        (position_set_y, pos0, ":y_pos"),
        (overlay_set_position, reg1, pos0),
        
        (create_check_box_overlay, "$form_options_overlay_1", "mesh_checkbox_off", "mesh_checkbox_on"),
        (copy_position, pos1, pos0),
        (store_add, reg2, ":y_pos", Screen_Checkbox_Height_Adj),
        (position_set_y, pos1, reg2),
        (overlay_set_position, "$form_options_overlay_1", pos1),
        
        (overlay_set_val, "$form_options_overlay_1", "$FormAI_off"),
        
        (val_sub, ":y_pos", Screen_Text_Height),
        
        #Player division assignment
        (create_text_overlay, reg1, "@Put player in division: ", tf_right_align),
        (position_set_y, pos0, ":y_pos"),
        (overlay_set_position, reg1, pos0),
        
        (create_number_box_overlay, "$form_options_overlay_2", 0, 10),
        (copy_position, pos1, pos0),
        (overlay_set_position, "$form_options_overlay_2", pos0),
        
        (overlay_set_val, "$form_options_overlay_2", "$FormAI_player_in_division"),
        
        (store_sub, reg2, "$FormAI_player_in_division", 1),
        (try_begin),
          (lt, reg2, 0),
          (str_store_string, s1, "str_none"),
        (else_try),
          (str_store_class_name, s1, reg2),
        (try_end),
        (create_text_overlay, reg1, "@{s1}", tf_left_align),
        (copy_position, pos1, pos0),
        (store_add, reg2, Screen_Width/2, Screen_Numberbox_Width+5),
        (position_set_x, pos1, reg2),
        (overlay_set_position, reg1, pos1),
        
        (val_sub, ":y_pos", Screen_Text_Height),
        
        #Autorotate formations option
        (create_text_overlay, reg1, "@Army rotates to face enemy center: ", tf_right_align),
        (position_set_y, pos0, ":y_pos"),
        (overlay_set_position, reg1, pos0),
        
        (create_check_box_overlay, "$form_options_overlay_3", "mesh_checkbox_off", "mesh_checkbox_on"),
        (copy_position, pos1, pos0),
        (store_add, reg2, ":y_pos", Screen_Checkbox_Height_Adj),
        (position_set_y, pos1, reg2),
        (overlay_set_position, "$form_options_overlay_3", pos1),
        
        (overlay_set_val, "$form_options_overlay_3", "$FormAI_autorotate"),
        
        (val_sub, ":y_pos", Screen_Text_Height),
        
        #Prevent AI from taking defensive
        (create_text_overlay, reg1, "@Prevent AI from taking defensive: ", tf_right_align),
        (position_set_y, pos0, ":y_pos"),
        (overlay_set_position, reg1, pos0),
        
        (create_check_box_overlay, "$form_options_overlay_4", "mesh_checkbox_off", "mesh_checkbox_on"),
        (copy_position, pos1, pos0),
        (store_add, reg2, ":y_pos", Screen_Checkbox_Height_Adj),
        (position_set_y, pos1, reg2),
        (overlay_set_position, "$form_options_overlay_4", pos1),
        
        (overlay_set_val, "$form_options_overlay_4", "$FormAI_AI_no_defense"),
        
        (val_sub, ":y_pos", Screen_Text_Height),
        
        # This is for Done button
        (assign, "$form_options_overlay_exit", 0), # forced initialization
        (create_game_button_overlay, "$form_options_overlay_exit", "str_done"),
        (position_set_x, pos1, 2*Screen_Width/3),
        (position_set_y, pos1, Screen_Border_Width),
        (overlay_set_position, "$form_options_overlay_exit", pos1),
    ]),
    
    (ti_on_presentation_run, [
        (try_begin),
          (this_or_next|key_clicked, key_escape),
          (key_clicked, key_pad_start),
          (presentation_set_duration, 0),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$form_options_overlay_1"),
          (assign, "$FormAI_off", ":value"),
        (else_try),
          (eq, ":object", "$form_options_overlay_2"),
          (assign, "$FormAI_player_in_division", ":value"),
          (start_presentation, "prsnt_formation_mod_option"),
        (else_try),
          (eq, ":object", "$form_options_overlay_3"),
          (assign, "$FormAI_autorotate", ":value"),
        (else_try),
          (eq, ":object", "$form_options_overlay_4"),
          (assign, "$FormAI_AI_no_defense", ":value"),
        (else_try),
          (eq, ":object", "$form_options_overlay_exit"),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),

###presentacion character creation, creacion personaje, chief
#1
("intro_epic",0,mesh_load_window,[
    (ti_on_presentation_load,
      [(presentation_set_duration,99999),
        (set_fixed_point_multiplier, 1000),
        ##			#determina posicion para coordenadas
        ##			(create_text_overlay, "$g_cursor_coord", "@00,00"),
        ##			(overlay_set_color, "$g_cursor_coord", 0xDDDDDD),
        ##			(position_set_x, pos1, 10),
        ##			(position_set_y, pos1, 700),
        ##			(overlay_set_position, "$g_cursor_coord", pos1),
        ##			#Borrar cuando finalice su uso
        # Presentation title, centered at the top
        (create_text_overlay, reg1, "@Anno Domini 867", tf_center_justify),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 650), # Higher, means more toward the right
        (position_set_y, pos1, 550), # Higher, means more toward the top
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1700),
        (position_set_y, pos1, 1700),
        (overlay_set_size, reg1, pos1),
        
        ###mesh de fondo
        # (create_mesh_overlay, reg0, "mesh_pic_extra_intro1"),
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro1map"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        #Message first part
        (create_text_overlay, "$g_presentation_obj_1","@We are in the ninth century.^" +
          "Long gone are the lights of Rome,^" +
          "absorbed by the tide of time,^" +
          "yet several centuries remain until the^" +
          "golden age of knights and princesses^" +
          "to come.^^" +
          "It is a brutal, dark and ruthless^" +
          "era of raw strength and survival,^" +
          "where men go to bed every night^" +
        "praying to see a new day.", tf_center_justify),
        (position_set_x, pos1, 265),
        (position_set_y, pos1, 330),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        #Message second part
        (create_text_overlay, "$g_presentation_obj_2","@It is the age of the Viking,^" +
          "the clans of Ireland, the ascension^" +
          "of Wessex and the emergence of the^" +
          "Kingdom of Alba.^^" +
        "It awaits you...", tf_center_justify),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 130),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        #CONTINUE BUTTON
        (create_game_button_overlay,"$g_presentation_obj_4","str_continue",tf_right_align),
        (position_set_x, pos1, 890),
        (position_set_y, pos1, 10),
        (overlay_set_position, "$g_presentation_obj_4", pos1),
    ]),
    
    (ti_on_presentation_run,
      [
        ##			#determina posicion para coordenadas
        ##		(mouse_get_position, pos1),
        ##		(position_get_x, reg1, pos1),
        ##		(position_get_y, reg2, pos1),
        ##		(overlay_set_text, "$g_cursor_coord", "@{reg1},{reg2}"),
        ##			#Borrar cuando finalice su uso
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_4"),
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          (jump_to_menu, "mnu_start_game_2"),
          ##            (try_begin),
          ##               (neq, "$creation_canceled", 999),
          ##               (start_presentation, "prsnt_player_sheet_bio"),
          ##           (try_end),
          #   (start_presentation, "prsnt_player_sheet_bio"),
        (try_end),
    ]),
]),

#pantalla eleccion campana (Campaign choice chief)
("choice_campaign", 0, mesh_load_window, [
    # (ti_on_presentation_load,
      # [
        # (presentation_set_duration, 999999),
        # (set_fixed_point_multiplier, 1000),
        
        # ## basicos
        # (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 25),
        # (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        # (create_game_button_overlay, "$g_presentation_obj_2", "str_back"),
        # (position_set_x, pos1, 730),
        # (position_set_y, pos1, 25),
        # (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        # ##        (create_text_overlay, reg1, "@Campaign Selection", tf_center_justify),
        # ##        #(overlay_set_color, reg1, 0xDDDDDD),
        # ##        (position_set_x, pos1, 450),
        # ##        (position_set_y, pos1, 700),
        # ##        (overlay_set_position, reg1, pos1),
        # ##        (position_set_x, pos1, 1200),
        # ##        (position_set_y, pos1, 1200),
        # ##        (overlay_set_size, reg1, pos1),
        # (create_text_overlay, reg1, "@Choose Campaign Type.", tf_center_justify),
        # #  (overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 250),
        # (position_set_y, pos1, 570),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 1200),
        # (position_set_y, pos1, 1200),
        # (overlay_set_size, reg1, pos1),
        # (create_text_overlay, reg1, "@Choose Options.", tf_center_justify),	#"@Choose Difficulty Options."
        # #  (overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 750),
        # (position_set_y, pos1, 600),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 1200),
        # (position_set_y, pos1, 1200),
        # (overlay_set_size, reg1, pos1),
        # (create_text_overlay, reg1, "@You can change these options during the game at your camp.", tf_center_justify),
        # #  (overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 750),
        # (position_set_y, pos1, 570),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 800),
        # (position_set_y, pos1, 800),
        # (overlay_set_size, reg1, pos1),
        
        # ## ###mesh de fondo
        # (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        # (position_set_x, pos1, -1),
        # (position_set_y, pos1, -1),
        # (overlay_set_position, reg0, pos1),
        # (position_set_x, pos1, 1002),
        # (position_set_y, pos1, 1002),
        # (overlay_set_size, reg0, pos1),
        
        # ## opciones
        # ##        (position_set_x, pos1, 100),
        # ##        (position_set_y, pos1, 420),
        # ##        (create_text_overlay, reg1, "@Campaign Type:", tf_center_justify),
        # ##        (overlay_set_position, reg1, pos1),
        # ##        (position_set_x, pos1, 600),
        # ##        (position_set_y, pos1, 570),
        # ##        (create_text_overlay, reg1, "@Difficulty Level:", tf_center_justify),
        # ##        (overlay_set_position, reg1, pos1),
        
        # ## enlaces:
        # # campaign
        # (position_set_x, pos1, 250),
        # (position_set_y, pos1, 420),
        
        # (create_combo_button_overlay, "$g_presentation_obj_11"),
        # (overlay_set_position, "$g_presentation_obj_11", pos1),
        # (overlay_add_item, "$g_presentation_obj_11", "@ROYAL SANDBOX CAMPAIGN"),
        # (overlay_add_item, "$g_presentation_obj_11", "@LORDLY SANDBOX CAMPAIGN"),
        # (overlay_add_item, "$g_presentation_obj_11", "@SANDBOX CAMPAIGN"),
        # (overlay_add_item, "$g_presentation_obj_11", "@STORYLINE CAMPAIGN"),
        
        # (try_begin),
          # (eq, "$campaign_type", camp_kingc),
          # (overlay_set_val, "$g_presentation_obj_11", 0),
        # (else_try),
          # (eq, "$campaign_type", camp_lordc),
          # (overlay_set_val, "$g_presentation_obj_11", 1),
        # (else_try),
          # (eq, "$campaign_type", camp_storyline),
          # (overlay_set_val, "$g_presentation_obj_11", 3),
        # (else_try),
          # # (eq, "$campaign_type", camp_sandbox),
          # (overlay_set_val, "$g_presentation_obj_11", 2),
        # (try_end),
        
        # ## Description
        # (call_script, "script_texto_initial_inform"),
        # (create_text_overlay, reg1, "@{s1}", tf_double_space|tf_scrollable|tf_center_justify),
        # (position_set_x, pos1, 100),
        # (position_set_y, pos1, 100),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 300),
        # (position_set_y, pos1, 200),
        # (overlay_set_area_size, reg1, pos1),
        # (position_set_x, pos1, 1000),
        # (position_set_y, pos1, 1000),
        # (overlay_set_size, reg1, pos1),
        
        # # Difficulty
        # (position_set_x, pos1, 740),
        # (position_set_y, pos1, 470),
        # (create_combo_button_overlay, "$g_presentation_obj_12"),
        # (overlay_set_position, "$g_presentation_obj_12", pos1),
        # (overlay_add_item, "$g_presentation_obj_12", "@Impossible"),
        # (overlay_add_item, "$g_presentation_obj_12", "@Full Realism"),
        # (overlay_add_item, "$g_presentation_obj_12", "str_normal"),
        # (overlay_add_item, "$g_presentation_obj_12", "str_beginner"),
        # (overlay_add_item, "$g_presentation_obj_12", "@Custom"),
        # (try_begin),
          # (eq, "$difficulty_type", camp_d5),
          # (overlay_set_val, "$g_presentation_obj_12", 0),
        # (else_try),
          # (eq, "$difficulty_type", camp_d4),
          # (overlay_set_val, "$g_presentation_obj_12", 1),
        # (else_try),
          # (eq, "$difficulty_type", camp_d3),
          # (overlay_set_val, "$g_presentation_obj_12", 2),
        # (else_try),
          # (eq, "$difficulty_type", camp_d2),
          # (overlay_set_val, "$g_presentation_obj_12", 3),
        # (else_try),
          # (eq, "$difficulty_type", camp_d1),
          # (overlay_set_val, "$g_presentation_obj_12", 4),
        # (try_end),
        
        # ###
        # #phaiak:
        # (assign, ":button_y_position", 420),#390
        # (assign, ":button_distance", 30),
        
        # ### ###recruit level easy
        
        # (create_text_overlay, "$g_presentation_obj_27", "@Easy Recruitment:", 0),
        # (overlay_set_color, "$g_presentation_obj_27", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_27", 0xDDDDDD),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, ":button_y_position"),
        # (overlay_set_position, "$g_presentation_obj_27", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_27", pos1),
        
        # (try_begin), #
          # (create_check_box_overlay, "$g_presentation_obj_20", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 850),
          # (position_set_y, pos1, ":button_y_position"),
          # (overlay_set_position, "$g_presentation_obj_20", pos1),
          # (overlay_set_val, "$g_presentation_obj_20", "$recruitment_on"),
        # (try_end),
        
        # ###
        # (val_sub, ":button_y_position", ":button_distance"),
        # (create_text_overlay, "$g_presentation_obj_30", "@Easy Levelling:", 0),
        # (overlay_set_color, "$g_presentation_obj_30", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_30", 0xDDDDDD),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, ":button_y_position"),
        # (overlay_set_position, "$g_presentation_obj_30", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_30", pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_23", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 850),
          # (position_set_y, pos1, ":button_y_position"),
          # (overlay_set_position, "$g_presentation_obj_23", pos1),
          # (overlay_set_val, "$g_presentation_obj_23", "$easy_levelling"),
        # (try_end),
        # ###
        # ###
        # (val_sub, ":button_y_position", ":button_distance"),
        # (create_text_overlay, "$g_presentation_obj_32", "@Easy Upkeep:", 0),
        # (overlay_set_color, "$g_presentation_obj_32", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_32", 0xDDDDDD),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, ":button_y_position"),
        # (overlay_set_position, "$g_presentation_obj_32", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_32", pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_31", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 850),
          # (position_set_y, pos1, ":button_y_position"),
          # (overlay_set_position, "$g_presentation_obj_31", pos1),
          # (overlay_set_val, "$g_presentation_obj_31", "$easy_wage"),
        # (try_end),
        # ###
        # (val_sub, ":button_y_position", ":button_distance"),
        # (create_text_overlay, "$g_presentation_obj_26", "@Shield Bash:", 0),
        # (overlay_set_color, "$g_presentation_obj_26", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_26", 0xDDDDDD),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, ":button_y_position"),
        # (overlay_set_position, "$g_presentation_obj_26", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_26", pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_19", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 850),
          # (position_set_y, pos1, ":button_y_position"),
          # (overlay_set_position, "$g_presentation_obj_19", pos1),
          # (overlay_set_val, "$g_presentation_obj_19", "$g_multiplayer_allow_shield_bash"),
        # (try_end),
        # ###
        # (val_sub, ":button_y_position", ":button_distance"),
        # (create_text_overlay, "$g_presentation_obj_24", "@Stamina:", 0),
        # (overlay_set_color, "$g_presentation_obj_24", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_24", 0xDDDDDD),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, ":button_y_position"),
        # (overlay_set_position, "$g_presentation_obj_24", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_24", pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_17", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 850),
          # (position_set_y, pos1, ":button_y_position"),
          # (overlay_set_position, "$g_presentation_obj_17", pos1),
          # (overlay_set_val, "$g_presentation_obj_17", "$stamina_on"),
        # (try_end),
        # ###
        # ###
        # (val_sub, ":button_y_position", ":button_distance"),
        # (create_text_overlay, "$g_presentation_obj_25", "@Armor Penalty:", 0),
        # (overlay_set_color, "$g_presentation_obj_25", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_25", 0xDDDDDD),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, ":button_y_position"),
        # (overlay_set_position, "$g_presentation_obj_25", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_25", pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_18", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 850),
          # (position_set_y, pos1, ":button_y_position"),
          # (overlay_set_position, "$g_presentation_obj_18", pos1),
          # (overlay_set_val, "$g_presentation_obj_18", "$g_armor_penalties"),
        # (try_end),
        # ###
        # #####
        # ##        (create_text_overlay, "$g_presentation_obj_26", "@Formations + AI:", 0),
        # ##        (overlay_set_color, "$g_presentation_obj_26", 0x000000), #Black se ve bien
        # ##        #(overlay_set_color, "$g_presentation_obj_26", 0xDDDDDD),
        # ##        (position_set_x, pos1, 600),
        # ##        (position_set_y, pos1, 440),
        # ##        (overlay_set_position, "$g_presentation_obj_26", pos1),
        # ##        (position_set_x, pos1, 900),
        # ##        (position_set_y, pos1, 900),
        # ##        (overlay_set_size, "$g_presentation_obj_26", pos1),
        # ##
        # ##    (try_begin),
        # ##       (create_check_box_overlay, "$g_presentation_obj_19", "mesh_checkbox_off", "mesh_checkbox_on"),
        # ##        (position_set_x, pos1, 750),
        # ##        (position_set_y, pos1, 440),
        # ##        (overlay_set_position, "$g_presentation_obj_19", pos1),
        # ##        (overlay_set_val, "$g_presentation_obj_19", "$formations_on"),
        # ##     (try_end),
        # #####
        # #
        # ##        (create_text_overlay, "$g_presentation_obj_27", "@Autosave:", 0),
        # ##        (overlay_set_color, "$g_presentation_obj_27", 0x000000), #Black se ve bien
        # ##        #(overlay_set_color, "$g_presentation_obj_27", 0xDDDDDD),
        # ##        (position_set_x, pos1, 600),
        # ##        (position_set_y, pos1, 310),
        # ##        (overlay_set_position, "$g_presentation_obj_27", pos1),
        # ##        (position_set_x, pos1, 900),
        # ##        (position_set_y, pos1, 900),
        # ##        (overlay_set_size, "$g_presentation_obj_27", pos1),
        # ##
        # ##    (try_begin), #cause lag
        # ##       (create_check_box_overlay, "$g_presentation_obj_20", "mesh_checkbox_off", "mesh_checkbox_on"),
        # ##        (position_set_x, pos1, 850),
        # ##        (position_set_y, pos1, 310),
        # ##        (overlay_set_position, "$g_presentation_obj_20", pos1),
        # ##        (overlay_set_val, "$g_presentation_obj_20", "$autosave_on"),
        # ##     (try_end),
        
        # (val_sub, ":button_y_position", ":button_distance"),
        # (create_text_overlay, "$g_presentation_obj_28", "@Rest Improves Morale:", 0),
        # (overlay_set_color, "$g_presentation_obj_28", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_28", 0xDDDDDD),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, ":button_y_position"),
        # (overlay_set_position, "$g_presentation_obj_28", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_28", pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_21", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 850),
          # (position_set_y, pos1, ":button_y_position"),
          # (overlay_set_position, "$g_presentation_obj_21", pos1),
          # (overlay_set_val, "$g_presentation_obj_21", "$moralep_on"),
        # (try_end),
        # ###
        # ###
        # (val_sub, ":button_y_position", ":button_distance"),
        # (create_text_overlay, "$g_presentation_obj_29", "@Insane Difficulty:", 0),
        # (overlay_set_color, "$g_presentation_obj_29", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_29", 0xDDDDDD),
        # (position_set_x, pos1, 600),
        # (position_set_y, pos1, ":button_y_position"),
        # (overlay_set_position, "$g_presentation_obj_29", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_29", pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_22", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 850),
          # (position_set_y, pos1, ":button_y_position"),
          # (overlay_set_position, "$g_presentation_obj_22", pos1),
          # (overlay_set_val, "$g_presentation_obj_22", "$insanedamage_on"),
        # (try_end),
        # ###
        
        # ## Description difficult
        # (try_begin),
          # (gt, "$temp", 0),
          # (call_script, "script_texto_initial_difficult"),
          # (create_text_overlay, reg1, "@{s4}", tf_double_space|tf_scrollable|tf_center_justify),
          # (position_set_x, pos1, 530),
          # (position_set_y, pos1, 70),
          # (overlay_set_position, reg1, pos1),
          # (position_set_x, pos1, 430),
          # (position_set_y, pos1, 130),
          # (overlay_set_area_size, reg1, pos1),
          # (position_set_x, pos1, 800),
          # (position_set_y, pos1, 800),
          # (overlay_set_size, reg1, pos1),
        # (try_end),
    # ]),
    
    # (ti_on_presentation_mouse_enter_leave, [
        # (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":one_exit_zero_enter"),
        
        # (try_begin),
          # (eq, ":object", "$g_presentation_obj_17"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 1),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_18"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 2),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_19"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 8),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          # # (else_try),
          # # (eq, ":object", "$g_presentation_obj_20"),
          # # (try_begin),
          # # (eq, ":one_exit_zero_enter", 1),
          # # (assign, "$temp", 0),
          # # (else_try),
          # # (assign, "$temp", 3),
          # # (try_end),
          # # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_21"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 4),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_22"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 5),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_23"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 6),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_24"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 1),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_25"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 2),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_26"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 8),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_27"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 3),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_28"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 4),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_29"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 5),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_30"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 6),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (else_try),
          # (this_or_next|eq, ":object", "$g_presentation_obj_31"),
          # (eq, ":object", "$g_presentation_obj_32"),
          # (try_begin),
            # (eq, ":one_exit_zero_enter", 1),
            # (assign, "$temp", 0),
          # (else_try),
            # (assign, "$temp", 7),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
          
        # (try_end),
    # ]),
    
    # (ti_on_presentation_event_state_change,
      # [
        # (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        # (try_begin),
          # (eq, ":object", "$g_presentation_obj_11"),
          # (try_begin),
            # (eq, ":value", 0),
            # (assign, "$campaign_type", camp_kingc),
          # (else_try),
            # (eq, ":value", 1),
            # (assign, "$campaign_type", camp_lordc),
          # (else_try),
            # (eq, ":value", 3),
            # (assign, "$campaign_type", camp_storyline),
          # (else_try),
            # (assign, "$campaign_type", camp_sandbox),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_17"),
          # (assign, "$stamina_on", ":value"),
          # (start_presentation, "prsnt_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_18"),
          # (assign, "$g_armor_penalties", ":value"),
          # (start_presentation, "prsnt_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_19"),
          # (assign, "$g_multiplayer_allow_shield_bash", ":value"),
          # (start_presentation, "prsnt_choice_campaign"),
          # ##		(else_try),
          # ##		  (eq, ":object", "$g_presentation_obj_19"),
          # ##		  (assign, "$formations_on", ":value"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_20"),
          # (assign, "$recruitment_on", ":value"),
          # (start_presentation, "prsnt_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_21"),
          # (assign, "$moralep_on", ":value"),
          # (start_presentation, "prsnt_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_22"),
          # (assign, "$insanedamage_on", ":value"),
          # (start_presentation, "prsnt_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_23"),
          # (assign, "$goredec_on", ":value"),
          # (start_presentation, "prsnt_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_31"),
          # (assign, "$g_vc_menu_turned_off", ":value"),
          # (start_presentation, "prsnt_choice_campaign"),
          # #
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_12"),
          # (try_begin),
            # (eq, ":value", 0),
            # (assign, "$difficulty_type", camp_d5),
            # ###difficult settings
            # (assign, "$g_multiplayer_allow_shield_bash", 1), #shield bash on
            # (assign, "$stamina_on", 1), #stamina on
            # (assign, "$g_armor_penalties", 1), #armor penalties on
            # (assign, "$moralep_on", 1), #morale rest penalties on
            # (assign, "$insanedamage_on", 1), #insane damage on
            # #(assign, "$goredec_on", 1), #gore off
            # #easy off:
            # (assign, "$recruitment_on", 0), #recruitment easy off
            # (assign, "$easy_levelling", 0),
            # (assign, "$easy_wage", 0),
          # (else_try),
            # (eq, ":value", 1),
            # (assign, "$difficulty_type", camp_d4),
            # ###difficult settings
            # (assign, "$g_multiplayer_allow_shield_bash", 1), #shield bash on
            # (assign, "$stamina_on", 1), #stamina on
            # (assign, "$g_armor_penalties", 1), #armor penalties on
            # (assign, "$moralep_on", 1), #morale rest penalties on
            # (assign, "$insanedamage_on", 0), #insane damage off
            # (assign, "$goredec_on", 0), #gore off
            # #easy off:
            # (assign, "$recruitment_on", 0), #recruitment easy off
            # (assign, "$easy_levelling", 0),
            # (assign, "$easy_wage", 0),
          # (else_try),
            # (eq, ":value", 2),
            # (assign, "$difficulty_type", camp_d3),
            # ###difficult settings
            # (assign, "$g_multiplayer_allow_shield_bash", 1), #shield bash on
            # (assign, "$stamina_on", 1), #stamina on
            # (assign, "$g_armor_penalties", 1), #armor penalties on
            # (assign, "$recruitment_on", 0), #recruitment easy on
            # (assign, "$insanedamage_on", 0), #insane damage off
            # (assign, "$goredec_on", 0), #gore off
            # #easy off:
            # (assign, "$recruitment_on", 0), #recruitment easy off
            # (assign, "$easy_levelling", 0),
            # (assign, "$easy_wage", 0),
          # (else_try),
            # (eq, ":value", 3),
            # (assign, "$difficulty_type", camp_d2),
            # ###difficult settings
            # (assign, "$g_multiplayer_allow_shield_bash", 0), #shield bash on
            # (assign, "$stamina_on", 0), #stamina on
            # (assign, "$g_armor_penalties", 0), #armor penalties on
            # (assign, "$moralep_on", 0), #morale rest penalties on
            # (assign, "$insanedamage_on", 0), #insane damage off
            # (assign, "$goredec_on", 0), #gore off
            # #easy on:
            # (assign, "$recruitment_on", 1), #recruitment easy on
            # (assign, "$easy_levelling", 1),
            # (assign, "$easy_wage", 1),
          # (else_try),
            # (eq, ":value", 4),
            # (assign, "$difficulty_type", camp_d1),
            # ###difficult settings
            # (assign, "$g_multiplayer_allow_shield_bash", 0), #shield bash on
            # (assign, "$stamina_on", 0), #stamina on
            # (assign, "$g_armor_penalties", 0), #armor penalties on
            # (assign, "$moralep_on", 0), #morale rest penalties on
            # (assign, "$insanedamage_on", 0), #insane damage off
            # (assign, "$goredec_on", 0), #gore off
            # #easy off:
            # (assign, "$recruitment_on", 0), #recruitment easy off
            # (assign, "$easy_levelling", 0),
            # (assign, "$easy_wage", 0),
          # (try_end),
          # (start_presentation, "prsnt_choice_campaign"),
        # (else_try), ## Initial
          # (eq, ":object", "$g_presentation_obj_2"),
          # ##          (assign, "$campaign_type", camp_storyline),
          # ##          (assign, "$difficulty_type", camp_d4),
          # (presentation_set_duration, 0),
          # (jump_to_menu, "mnu_start_game_11"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_1"),
          # (presentation_set_duration, 0),
          # (try_for_range, ":center_no", centers_begin, centers_end),
            # (eq, "$recruitment_on", 1),
            # (party_set_slot,":center_no",recruit_permission_need, 0),
          # (try_end),
          # (jump_to_menu, "mnu_start_game_1"),
          # #          (try_end),
        # (try_end),
    # ]),
]),
###screen difficult choices
("campmenu_choice_campaign", 0, mesh_load_window, [
    # (ti_on_presentation_load,
      # [
        # (presentation_set_duration, 999999),
        # (set_fixed_point_multiplier, 1000),
        # (assign, "$autosave_on", 0), #autosave off
        
        # ## basicos
        # (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 25),
        # (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        # ##        (create_text_overlay, reg1, "@Campaign Selection", tf_center_justify),
        # ##        #(overlay_set_color, reg1, 0xDDDDDD),
        # ##        (position_set_x, pos1, 450),
        # ##        (position_set_y, pos1, 700),
        # ##        (overlay_set_position, reg1, pos1),
        # ##        (position_set_x, pos1, 1200),
        # ##        (position_set_y, pos1, 1200),
        # ##        (overlay_set_size, reg1, pos1),
        # (create_text_overlay, reg1, "@Choose Campaign Type.", tf_center_justify),
        # #  (overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 250),
        # (position_set_y, pos1, 570),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        # (create_text_overlay, reg1, "@Choose Options.", tf_center_justify),
        # #  (overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 750),
        # (position_set_y, pos1, 570),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        # (create_text_overlay, reg1, "@You can change difficult settings.", tf_center_justify),
        # #  (overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 750),
        # (position_set_y, pos1, 540),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 800),
        # (position_set_y, pos1, 800),
        # (overlay_set_size, reg1, pos1),
        
        # ## ###mesh de fondo
        # (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        # (position_set_x, pos1, -1),
        # (position_set_y, pos1, -1),
        # (overlay_set_position, reg0, pos1),
        # (position_set_x, pos1, 1002),
        # (position_set_y, pos1, 1002),
        # (overlay_set_size, reg0, pos1),
        
        # ## enlaces:
        # # campaign
        # (position_set_x, pos1, 250),
        # (position_set_y, pos1, 420),
        
        # (create_combo_button_overlay, "$g_presentation_obj_11"),
        # (overlay_set_position, "$g_presentation_obj_11", pos1),
        # (overlay_add_item, "$g_presentation_obj_11", "@ROYAL SANDBOX CAMPAIGN"),
        # (overlay_add_item, "$g_presentation_obj_11", "@LORDLY SANDBOX CAMPAIGN"),
        # (overlay_add_item, "$g_presentation_obj_11", "@SANDBOX CAMPAIGN"),
        # (overlay_add_item, "$g_presentation_obj_11", "@STORYLINE CAMPAIGN"),
        
        # (try_begin),
          # (eq, "$campaign_type", camp_kingc),
          # (overlay_set_val, "$g_presentation_obj_11", 0),
        # (else_try),
          # (eq, "$campaign_type", camp_lordc),
          # (overlay_set_val, "$g_presentation_obj_11", 1),
        # (else_try),
          # (eq, "$campaign_type", camp_storyline),
          # (overlay_set_val, "$g_presentation_obj_11", 3),
        # (else_try),
          # # (eq, "$campaign_type", camp_sandbox),
          # (overlay_set_val, "$g_presentation_obj_11", 2),
        # (try_end),
        
        # ## Description
        # (call_script, "script_texto_initial_inform"),
        # (create_text_overlay, reg1, "@{s1}", tf_double_space|tf_scrollable|tf_center_justify),
        # (position_set_x, pos1, 100),
        # (position_set_y, pos1, 100),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 300),
        # (position_set_y, pos1, 200),
        # (overlay_set_area_size, reg1, pos1),
        # (position_set_x, pos1, 800),
        # (position_set_y, pos1, 800),
        # (overlay_set_size, reg1, pos1),
        
        
        # (create_text_overlay, reg1, "@Shield Bash:", 0),
        # (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # #(overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 650),
        # (position_set_y, pos1, 430),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_19", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 900),
          # (position_set_y, pos1, 430),
          # (overlay_set_position, "$g_presentation_obj_19", pos1),
          # (overlay_set_val, "$g_presentation_obj_19", "$g_multiplayer_allow_shield_bash"),
        # (try_end),
        # ###
        # (create_text_overlay, reg1, "@Stamina:", 0),
        # (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # #(overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 650),
        # (position_set_y, pos1, 400),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_17", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 900),
          # (position_set_y, pos1, 400),
          # (overlay_set_position, "$g_presentation_obj_17", pos1),
          # (overlay_set_val, "$g_presentation_obj_17", "$stamina_on"),
        # (try_end),
        # ###
        # ###
        # (create_text_overlay, reg1, "@Armor Penalty:", 0),
        # (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # #(overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 650),
        # (position_set_y, pos1, 370),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_18", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 900),
          # (position_set_y, pos1, 370),
          # (overlay_set_position, "$g_presentation_obj_18", pos1),
          # (overlay_set_val, "$g_presentation_obj_18", "$g_armor_penalties"),
        # (try_end),
        # ###
        # #####
        # ##        (create_text_overlay, reg1, "@Formations + AI:", 0),
        # ##        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # ##        #(overlay_set_color, reg1, 0xDDDDDD),
        # ##        (position_set_x, pos1, 600),
        # ##        (position_set_y, pos1, 440),
        # ##        (overlay_set_position, reg1, pos1),
        # ##        (position_set_x, pos1, 900),
        # ##        (position_set_y, pos1, 900),
        # ##        (overlay_set_size, reg1, pos1),
        # ##
        # ##    (try_begin),
        # ##       (create_check_box_overlay, "$g_presentation_obj_19", "mesh_checkbox_off", "mesh_checkbox_on"),
        # ##        (position_set_x, pos1, 750),
        # ##        (position_set_y, pos1, 440),
        # ##        (overlay_set_position, "$g_presentation_obj_19", pos1),
        # ##        (overlay_set_val, "$g_presentation_obj_19", "$formations_on"),
        # ##     (try_end),
        # ###
        # ###
        # ##        (create_text_overlay, reg1, "@Autosave:", 0),
        # ##        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # ##        #(overlay_set_color, reg1, 0xDDDDDD),
        # ##        (position_set_x, pos1, 650),
        # ##        (position_set_y, pos1, 340),
        # ##        (overlay_set_position, reg1, pos1),
        # ##        (position_set_x, pos1, 900),
        # ##        (position_set_y, pos1, 900),
        # ##        (overlay_set_size, reg1, pos1),
        # ##
        # ##    (try_begin),
        # ##       (create_check_box_overlay, "$g_presentation_obj_20", "mesh_checkbox_off", "mesh_checkbox_on"),
        # ##        (position_set_x, pos1, 900),
        # ##        (position_set_y, pos1, 340),
        # ##        (overlay_set_position, "$g_presentation_obj_20", pos1),
        # ##        (overlay_set_val, "$g_presentation_obj_20", "$autosave_on"),
        # ##     (try_end),
        # ###
        # ### ###recruit level easy
        # (create_text_overlay, "$g_presentation_obj_27", "@Easy Recruitment:", 0),
        # (overlay_set_color, "$g_presentation_obj_27", 0x000000), #Black se ve bien
        # #(overlay_set_color, "$g_presentation_obj_27", 0xDDDDDD),
        # (position_set_x, pos1, 650),
        # (position_set_y, pos1, 340),
        # (overlay_set_position, "$g_presentation_obj_27", pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, "$g_presentation_obj_27", pos1),
        
        # (try_begin), #cause lag
          # (create_check_box_overlay, "$g_presentation_obj_20", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 900),
          # (position_set_y, pos1, 340),
          # (overlay_set_position, "$g_presentation_obj_20", pos1),
          # (overlay_set_val, "$g_presentation_obj_20", "$recruitment_on"),
        # (try_end),
        # ###
        # ###
        # (create_text_overlay, reg1, "@Rest Improves Morale:", 0),
        # (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # #(overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 650),
        # (position_set_y, pos1, 310),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_21", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 900),
          # (position_set_y, pos1, 310),
          # (overlay_set_position, "$g_presentation_obj_21", pos1),
          # (overlay_set_val, "$g_presentation_obj_21", "$moralep_on"),
        # (try_end),
        # ###
        # ###
        # (create_text_overlay, reg1, "@Insane Difficulty:", 0),
        # (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # #(overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 650),
        # (position_set_y, pos1, 280),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_22", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 900),
          # (position_set_y, pos1, 280),
          # (overlay_set_position, "$g_presentation_obj_22", pos1),
          # (overlay_set_val, "$g_presentation_obj_22", "$insanedamage_on"),
        # (try_end),
        # ###
        # ###
        # (create_text_overlay, reg1, "@Gore:", 0),
        # (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # #(overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 650),
        # (position_set_y, pos1, 250),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_23", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 900),
          # (position_set_y, pos1, 250),
          # (overlay_set_position, "$g_presentation_obj_23", pos1),
          # (overlay_set_val, "$g_presentation_obj_23", "$goredec_on"),
        # (try_end),
        # ###
        # ###VC-1954:
        # (create_text_overlay, reg1, "@Disable Scenic Menu:", 0),
        # (overlay_set_color, reg1, 0x000000), #Black se ve bien
        # #(overlay_set_color, reg1, 0xDDDDDD),
        # (position_set_x, pos1, 650),
        # (position_set_y, pos1, 220),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 900),
        # (overlay_set_size, reg1, pos1),
        
        # (try_begin),
          # (create_check_box_overlay, "$g_presentation_obj_24", "mesh_checkbox_off", "mesh_checkbox_on"),
          # (position_set_x, pos1, 900),
          # (position_set_y, pos1, 220),
          # (overlay_set_position, "$g_presentation_obj_24", pos1),
          # (overlay_set_val, "$g_presentation_obj_24", "$g_vc_menu_turned_off"),
        # (try_end),
        # ###
        
        # ## Description difficult
        # (call_script, "script_texto_initial_difficult"),
        # (create_text_overlay, reg1, "@{s4}", tf_double_space|tf_scrollable|tf_center_justify),
        # (position_set_x, pos1, 570),
        # (position_set_y, pos1, 60),
        # (overlay_set_position, reg1, pos1),
        # (position_set_x, pos1, 350),
        # (position_set_y, pos1, 130),
        # (overlay_set_area_size, reg1, pos1),
        # (position_set_x, pos1, 700),
        # (position_set_y, pos1, 700),
        # (overlay_set_size, reg1, pos1),
        
    # ]),
    
    # #(ti_on_presentation_run,
    # #[
    # #]),
    
    # (ti_on_presentation_event_state_change,
      # [
        # (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        # (try_begin),
          # (eq, ":object", "$g_presentation_obj_11"),
          # (display_message, "@Campaign type cannot be changed after start of game."),
          # ##          (try_begin),
          # ##            # (eq, ":value", 0),
          # ##            # (assign, "$campaign_type", camp_kingc),
          # ##          # (else_try),
          # ##            # (eq, ":value", 1),
          # ##            (eq, ":value", 0),
          # ##            (assign, "$campaign_type", camp_sandbox),
          # ##          (else_try),
          # ##            # (eq, ":value", 2),
          # ##            (eq, ":value", 1),
          # ##            (assign, "$campaign_type", camp_storyline),
          # ##          (try_end),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_17"),
          # (assign, "$stamina_on", ":value"),
          # (assign, "$temp", 1),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_18"),
          # (assign, "$g_armor_penalties", ":value"),
          # (assign, "$temp", 2),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_19"),
          # (assign, "$g_multiplayer_allow_shield_bash", ":value"),
          # (assign, "$temp", 8),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
          # ##		(else_try),
          # ##		  (eq, ":object", "$g_presentation_obj_19"),
          # ##		  (assign, "$formations_on", ":value"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_20"),
          # (assign, "$recruitment_on", ":value"), #no autosave
          # (assign, "$temp", 3),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
          # ##		(else_try),
          # ##		  (eq, ":object", "$g_presentation_obj_20"),
          # ##		  (assign, "$autosave_on", ":value"), #no autosave
          # ##                   (assign, "$temp", 3),
          # ##                 (start_presentation, "prsnt_campmenu_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_21"),
          # (assign, "$moralep_on", ":value"),
          # (assign, "$temp", 4),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_22"),
          # (assign, "$insanedamage_on", ":value"),
          # (assign, "$temp", 5),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_23"),
          # (assign, "$goredec_on", ":value"),
          # (assign, "$temp", 6),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_24"),
          # (assign, "$g_vc_menu_turned_off", ":value"),
          # (assign, "$temp", 7),
          # (start_presentation, "prsnt_campmenu_choice_campaign"),
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_1"),
          # (presentation_set_duration, 0),
          # (try_for_range, ":center_no", centers_begin, centers_end),
            # (eq, "$recruitment_on", 1),
            # (party_set_slot,":center_no",recruit_permission_need, 0),
          # (try_end),
          # (change_screen_return),
          # #          (try_end),
        # (try_end),
    # ]),
]),

###VC-2198 begin
("vc_options", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (assign, "$autosave_on", 0), #autosave off
        
        #0. BACKROUND
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        #1. BASICS
        (position_set_y, pos1, 25),
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 825),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        (try_begin),
          (eq, reg60, 0),	#no start game
          (create_game_button_overlay, "$g_presentation_obj_2", "@More"),
        (else_try),
          (create_game_button_overlay, "$g_presentation_obj_2", "str_back"),
        (end_try),
        (position_set_x, pos1, 625),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        #2. CAMPAIGN
        (create_text_overlay, reg1, "@Campaign Type", tf_center_justify),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, reg1, pos1),
        
        (create_combo_button_overlay, "$g_presentation_obj_5"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 590),
        (overlay_set_position, "$g_presentation_obj_5", pos1),
        (try_begin),
          (eq, reg60, 0),	#no start game
          (overlay_set_alpha, "$g_presentation_obj_5", 0xA0),
          (try_begin),
            (eq, "$campaign_type", camp_kingc),
            (overlay_add_item, "$g_presentation_obj_5", "@ROYAL SANDBOX CAMPAIGN"),
          (else_try),
            (eq, "$campaign_type", camp_lordc),
            (overlay_add_item, "$g_presentation_obj_5", "@LORDLY SANDBOX CAMPAIGN"),
          (else_try),
            (eq, "$campaign_type", camp_storyline),
            (overlay_add_item, "$g_presentation_obj_5", "@STORYLINE CAMPAIGN"),
          (else_try),
            (overlay_add_item, "$g_presentation_obj_5", "@SANDBOX CAMPAIGN"),
          (try_end),
        (else_try),
          (overlay_add_item, "$g_presentation_obj_5", "@ROYAL SANDBOX CAMPAIGN"),
          (overlay_add_item, "$g_presentation_obj_5", "@LORDLY SANDBOX CAMPAIGN"),
          (overlay_add_item, "$g_presentation_obj_5", "@SANDBOX CAMPAIGN"),
          (overlay_add_item, "$g_presentation_obj_5", "@STORYLINE CAMPAIGN"),
          (try_begin),
            (eq, "$campaign_type", camp_kingc),
            (overlay_set_val, "$g_presentation_obj_5", 0),
          (else_try),
            (eq, "$campaign_type", camp_lordc),
            (overlay_set_val, "$g_presentation_obj_5", 1),
          (else_try),
            (eq, "$campaign_type", camp_storyline),
            (overlay_set_val, "$g_presentation_obj_5", 3),
          (else_try),
            # (eq, "$campaign_type", camp_sandbox),
            (overlay_set_val, "$g_presentation_obj_5", 2),
          (try_end),
        (end_try),
        
        #3. DIFFICULTY
        (create_text_overlay, reg1, "@Difficulty Type", tf_center_justify),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 540),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, reg1, pos1),
        
        (create_combo_button_overlay, "$g_presentation_obj_6"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 480),
        (overlay_set_position, "$g_presentation_obj_6", pos1),
        (overlay_add_item, "$g_presentation_obj_6", "@Impossible"),
        (overlay_add_item, "$g_presentation_obj_6", "@Full Realism"),
        (overlay_add_item, "$g_presentation_obj_6", "str_normal"),
        (overlay_add_item, "$g_presentation_obj_6", "str_beginner"),
        (overlay_add_item, "$g_presentation_obj_6", "@Custom"),
        (try_begin),
          (eq, "$difficulty_type", camp_d5),
          (overlay_set_val, "$g_presentation_obj_6", 0),
        (else_try),
          (eq, "$difficulty_type", camp_d4),
          (overlay_set_val, "$g_presentation_obj_6", 1),
        (else_try),
          (eq, "$difficulty_type", camp_d3),
          (overlay_set_val, "$g_presentation_obj_6", 2),
        (else_try),
          (eq, "$difficulty_type", camp_d2),
          (overlay_set_val, "$g_presentation_obj_6", 3),
        (else_try),
          (eq, "$difficulty_type", camp_d1),
          (overlay_set_val, "$g_presentation_obj_6", 4),
        (try_end),
        
        #4. OPTIONS
        (create_text_overlay, reg1, "@Options", tf_center_justify),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos2, 1200),
        (position_set_y, pos2, 1200),
        (overlay_set_size, reg1, pos2),
        
        #5. CONTAINER
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_admin_panel_container", s0, tf_scrollable),
        (position_set_x, pos1, 575),
        (position_set_y, pos1, 90),
        (overlay_set_position, "$g_presentation_obj_admin_panel_container", pos1),
        (position_set_x, pos1, 350),
        (position_set_y, pos1, 535),
        (overlay_set_area_size, "$g_presentation_obj_admin_panel_container", pos1),
        (set_container_overlay, "$g_presentation_obj_admin_panel_container"),
        
        #lines
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 19*30 + 11*40 + 30),	# 30 for each checkbox or gap + 40 for each other elements + 30 buffer at the end
        
        #HINT
        (try_begin),
          (eq, reg60, 1),	#start game
          (position_get_y, ":y", pos1),
          (val_add, ":y", 35),
          (position_set_y, pos1, ":y"),
          (create_text_overlay, reg1, "@These options can be changed later in the camp menu.", tf_double_space|tf_scrollable|tf_center_justify),	#
          (copy_position, pos2, pos1),
          #(position_set_x, pos2, 175),
          (overlay_set_position, reg1, pos2),
          (position_set_x, pos2, 350),
          (position_set_y, pos2, 60),
          (overlay_set_area_size, reg1, pos2),
          (position_set_x, pos2, 900),
          (position_set_y, pos2, 900),
          (overlay_set_size, reg1, pos2),
          (position_get_y, ":y", pos1),
          (val_sub, ":y", 35),
          (position_set_y, pos1, ":y"),
        (end_try),
        
        #VC DIFFICULTY SETTINGS
        (create_text_overlay, reg1, "str_recruitment", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (try_begin),
          (eq, "$recruitment_on_freezed", 1),
          (eq, "$recruitment_on", 1),
          (overlay_add_item, reg2, "str_beginner"),
          (overlay_set_alpha, reg2, 0xA0),
        (else_try),
          (overlay_add_item, reg2, "str_normal"),
          (overlay_add_item, reg2, "str_beginner"),
          (overlay_set_val, reg2, "$recruitment_on"),
        (end_try),
        (assign, "$g_presentation_obj_11", reg2),
        
        (create_text_overlay, reg1, "str_levelling", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (try_begin),
          (eq, "$easy_levelling_freezed", 1),
          (eq, "$easy_levelling", 1),
          (overlay_add_item, reg2, "str_beginner"),
          (overlay_set_alpha, reg2, 0xA0),
        (else_try),
          (eq, "$easy_levelling_freezed", 1),
          (eq, "$easy_levelling", 2),
          (overlay_add_item, reg2, "str_hardcore"),
          (overlay_set_alpha, reg2, 0xA0),
        (else_try),
          (overlay_add_item, reg2, "str_normal"),
          (overlay_add_item, reg2, "str_beginner"),
          (overlay_add_item, reg2, "str_hardcore"),
          (overlay_set_val, reg2, "$easy_levelling"),
        (end_try),
        (assign, "$g_presentation_obj_12", reg2),
        
        (create_text_overlay, reg1, "str_budget", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (try_begin),
          (eq, "$easy_wage_freezed", 1),
          (eq, "$easy_wage", 1),
          (overlay_add_item, reg2, "str_beginner"),
          (overlay_set_alpha, reg2, 0x80),
        (else_try),
          (overlay_add_item, reg2, "str_normal"),
          (overlay_add_item, reg2, "str_beginner"),
          (overlay_set_val, reg2, "$easy_wage"),
        (end_try),
        (assign, "$g_presentation_obj_13", reg2),
        
        #gap
        (call_script, "script_prsnt_vc_menu_helper_gap"),
        
        #NATIVE DIFFICULTY SETTINGS
        (create_text_overlay, reg1, "str_damage_to_player", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (overlay_add_item, reg2, "@Reduced to 1/4 (Easiest)"),
        (overlay_add_item, reg2, "@Reduced to 1/2 (Easy)"),
        (overlay_add_item, reg2, "str_normal"),
        (options_get_damage_to_player, reg8), #0 = 1/4, 1 = 1/2, 2 = 1/1
        (overlay_set_val, reg2, reg8),
        (assign, "$g_presentation_obj_25", reg2),
        
        (create_text_overlay, reg1, "str_damage_to_friends", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (overlay_add_item, reg2, "@Reduced to 1/2 (Easiest)"),
        (overlay_add_item, reg2, "@Reduced to 3/4 (Easy)"),
        (overlay_add_item, reg2, "str_normal"),
        (options_get_damage_to_friends, reg8), #0 = 1/2, 1 = 3/4, 2 = 1/1
        (overlay_set_val, reg2, reg8),
        (assign, "$g_presentation_obj_26", reg2),
        
        #gap
        (call_script, "script_prsnt_vc_menu_helper_gap"),
        
        #DAMAGE SETTINGS
        (create_text_overlay, reg1, "str_combat_ai", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (overlay_add_item, reg2, "str_hardcore"),
        (overlay_add_item, reg2, "str_normal"),
        (overlay_add_item, reg2, "str_beginner"),
        (options_get_combat_ai, reg8), #0 = good, 1 = average, 2 = poor
        (overlay_set_val, reg2, reg8),
        (assign, "$g_presentation_obj_27", reg2),
        
        (create_text_overlay, reg1, "str_movement_and_combat_speed", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (overlay_add_item, reg2, "@Slowest"),
        (overlay_add_item, reg2, "@Slower"),
        (overlay_add_item, reg2, "str_normal"),
        (overlay_add_item, reg2, "@Faster"),
        (overlay_add_item, reg2, "@Fastest"),
        (options_get_combat_speed, reg8), #0 = slowest, 1 = slower, 2 = normal, 3 = faster, 4 = fastest
        (overlay_set_val, reg2, reg8),
        (assign, "$g_presentation_obj_29", reg2),
        
        (create_text_overlay, reg1, "str_campaign_ai", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (overlay_add_item, reg2, "str_hardcore"),
        (overlay_add_item, reg2, "str_normal"),
        (overlay_add_item, reg2, "str_beginner"),
        (options_get_campaign_ai, reg8), #0 = good, 1 = average, 2 = poor
        (overlay_set_val, reg2, reg8),
        (assign, "$g_presentation_obj_28", reg2),
        
        (create_text_overlay, reg1, "str_quantity_bandit_parties", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (overlay_add_item, reg2, "@Less"),
        (overlay_add_item, reg2, "str_normal"),
        (overlay_add_item, reg2, "@More"),
        (overlay_set_val, reg2, "$bandit_quantity_option"),
        (assign, "$g_presentation_obj_33", reg2),
        
        #gap
        (call_script, "script_prsnt_vc_menu_helper_gap"),
        
        #REALITY SETTINGS
        (create_text_overlay, reg1, "str_stamina", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$stamina_on"),
        (assign, "$g_presentation_obj_14", reg2),
        
        (create_text_overlay, reg1, "str_gear_affects_skills", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$g_armor_penalties"),
        (assign, "$g_presentation_obj_15", reg2),
        
        (create_text_overlay, reg1, "str_shield_bash", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$g_multiplayer_allow_shield_bash"),
        (assign, "$g_presentation_obj_20", reg2),
        
        (create_text_overlay, reg1, "str_wounds", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$vc_wounds_on"),
        (assign, "$g_presentation_obj_31", reg2),
        
        (create_text_overlay, reg1, "str_blood_loss", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$vc_bloodloss_on"),
        (assign, "$g_presentation_obj_32", reg2),
        
        (create_text_overlay, reg1, "str_weapon_break", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$vc_weapon_break_on"),
        (assign, "$form_options_overlay_2", reg2),
        
        (create_text_overlay, reg1, "str_resting_morale", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$moralep_on"),
        (assign, "$g_presentation_obj_16", reg2),
        
        #gap
        (call_script, "script_prsnt_vc_menu_helper_gap"),
        
        #PERFORMANCE SETTINGS
        (create_text_overlay, reg1, "str_battle_size", 0),
        (call_script, "script_prsnt_vc_menu_helper_3"),
        (options_get_battle_size, reg8), #0-1000
        (overlay_set_val, reg2, reg8),
        (assign, "$g_presentation_obj_30", reg2),
        
        (create_text_overlay, reg1, "str_disable_scenic_menu", 0),	#VC-1954
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$g_vc_menu_turned_off"),
        (assign, "$g_presentation_obj_19", reg2),
        
        #gap
        (call_script, "script_prsnt_vc_menu_helper_gap"),
        
        #SPECIAL SETTINGS
        (create_text_overlay, reg1, "str_insane_difficult", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$insanedamage_on"),
        (assign, "$g_presentation_obj_17", reg2),
        
        (create_text_overlay, reg1, "str_gore", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$goredec_on"),
        (assign, "$g_presentation_obj_18", reg2),
        
        (create_text_overlay, reg1, "str_music_in_battles", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$ambient_music_in_battle"),
        (assign, "$g_presentation_obj_24", reg2),
        
        #gap
        (call_script, "script_prsnt_vc_menu_helper_gap"),
        
        #FORMATION SETTINGS
        (create_text_overlay, reg1, "str_player_division", 0),
        (call_script, "script_prsnt_vc_menu_helper_2"),
        (try_for_range, ":class", -1, 9),
          (try_begin),
            (eq, ":class", -1),
            (overlay_add_item, reg2, "str_none"),
          (else_try),
            (str_store_class_name, s7, ":class"),
            (overlay_add_item, reg2, s7),
          (try_end),
        (end_try),
        (overlay_set_val, reg2, "$FormAI_player_in_division"),
        (assign, "$form_options_overlay_1", reg2),
        
        (create_text_overlay, reg1, "str_disable_complex_formations", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$FormAI_off"),
        (assign, "$g_presentation_obj_21", reg2),
        
        (create_text_overlay, reg1, "str_have_formations_face_enemy", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$FormAI_autorotate"),
        (assign, "$g_presentation_obj_22", reg2),
        
        (create_text_overlay, reg1, "str_players_enemies_only_attack", 0),
        (call_script, "script_prsnt_vc_menu_helper"),
        (overlay_set_val, reg2, "$FormAI_AI_no_defense"),
        (assign, "$g_presentation_obj_23", reg2),
        
        (set_container_overlay, -1),
        
        # #gap
        # (position_get_y, ":y", pos1),
        # (val_sub, ":y", 30),
        # (position_set_y, pos1, ":y"),
        
        
        
        #6. DESCRIPTION
        #headline
        (create_text_overlay, reg1, "str_empty_string", tf_center_justify),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, reg1, pos1),
        (assign, "$g_presentation_obj_3", reg1),
        
        (create_text_overlay, reg1, "str_empty_string", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 75),
        (position_set_y, pos1, 100),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 350),
        (position_set_y, pos1, 260),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (assign, "$g_presentation_obj_7", reg1),
        
        #7. WARNING
        (str_store_string, s1, "str_beginner"),
        (str_store_string, s2, "str_hardcore"),
        (str_store_string, s3, "str_continue"),
        (create_text_overlay, reg1, "@Warning: The '{s1}' and '{s2}' options for this setting can't be disabled any more after you click '{s3}.'", tf_double_space|tf_scrollable|tf_center_justify|tf_with_outline),
        (position_set_x, pos1, 75),
        (position_set_y, pos1, 90),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 350),
        (position_set_y, pos1, 70),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (overlay_set_color, reg1, 0xFF5555),
        (assign, "$g_presentation_obj_4", reg1),
        (overlay_set_display, "$g_presentation_obj_4", 0),
        
    ]),
    
    (ti_on_presentation_mouse_enter_leave,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":one_exit_zero_enter"),
        
        (str_clear, s2),
        (str_clear, s3),
        (str_clear, s4),
        (overlay_set_color, "$g_presentation_obj_3", 0x000000),
        
        (try_begin),
          (eq, ":one_exit_zero_enter", 1),
        (else_try),
          (eq, ":object", "$g_presentation_obj_5"),
          (str_store_string,s2,"@Choose a campaign type!"),
          (str_store_string,s4,"@Storyline Campaign: Start as a protagonist in a story. Due to certain perma-death results, ironman save mode is not available.^^Sandbox Campaign: Start a long, totally free play game.^^Lordly Sandbox Campaign: Start as a lord.^^Royal Sandbox Campaign: Start as a king."),
        (else_try),
          (eq, ":object", "$g_presentation_obj_6"),
          (str_store_string,s2,"@Choose a difficulty type!"),
          
        (else_try),
          (store_add, ":object_plus_one", ":object", 1),
          
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_11"),
          (eq, ":object", "$g_presentation_obj_11"),
          #(str_store_string,s2,"@RECRUITMENT > Level of difficulty.",0xFFf1e73f),
          (str_store_string,s2,"str_recruitment"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s4,"@At Beginner level, when you ask permission to recruit in villages, the answer is always positive and without cost."),
          (overlay_set_display, "$g_presentation_obj_4", 1),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_12"),
          (eq, ":object", "$g_presentation_obj_12"),
          (str_store_string,s2,"str_levelling"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s4,"@At Beginner level, improving troops is easier."),	#The initially Viking Conquest style is Realism. #irritating?
          (overlay_set_display, "$g_presentation_obj_4", 1),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_13"),
          (eq, ":object", "$g_presentation_obj_13"),
          (str_store_string,s2,"str_budget"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s4,"@At Beginner level, the wages of the player's troops are reduced 40%. Additionally the loot amount in monasteries and the chance to capture a ship are increased."),	#The initially Viking Conquest style is Realism. #irritating?
          (overlay_set_display, "$g_presentation_obj_4", 1),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_14"),
          (eq, ":object", "$g_presentation_obj_14"),
          (str_store_string,s2,"str_stamina"),
          (str_store_string,s3,"str_realism_feature"),
          (str_store_string,s8,"str_this_setting_affects_all"),
          (str_store_string,s4,"@Stamina is calculated from Health and Athletic skills and affects physical endurance during battle. When a character's stamina is exhausted, he or she won't be able to run and his or her weapons' damage will be halved.^^{s8}"),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_15"),
          (eq, ":object", "$g_presentation_obj_15"),
          (str_store_string,s2,"str_gear_affects_skills"),
          (str_store_string,s3,"str_realism_feature"),
          (str_store_string,s8,"str_this_setting_affects_all"),
          (str_store_string,s4,"@Your skill points will deteriorate when you equip heavy armor. This skill brings better balance to the game, as light troops become more important. Other equipment may have positive effect on skills.^^{s8}"),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_16"),
          (eq, ":object", "$g_presentation_obj_16"),
          (str_store_string,s2,"str_resting_morale"),
          (str_store_string,s3,"str_realism_feature"),
          (str_store_string,s4,"@Your army needs regular rest in a settlement, your camp site or your refuge from time to time. Lack of rest will lower your troop morale, while resting will improve it."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_17"),
          (eq, ":object", "$g_presentation_obj_17"),
          (str_store_string,s2,"str_insane_difficult"),
          (str_store_string,s3,"str_special_setting"),
          (str_store_string,s4,"@Your enemies will cause double damage while you cause only half."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_18"),
          (eq, ":object", "$g_presentation_obj_18"),
          (str_store_string,s2,"str_gore"),
          (str_store_string,s3,"str_special_setting"),
          (str_store_string,s4,"@Add decapitation to battles."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_19"),
          (eq, ":object", "$g_presentation_obj_19"),
          (str_store_string,s2,"str_disable_scenic_menu"),
          (str_store_string,s3,"str_performance_feature"),
          (str_store_string,s4,"@Disable the 3D view in settlement/village menus to improve the loading time for slower machines."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_20"),
          (eq, ":object", "$g_presentation_obj_20"),
          (str_store_string,s2,"str_shield_bash"),
          (str_store_string,s3,"str_realism_feature"),
          (str_store_string,s4,"@Attack while holding your shield (default: hold Right Mouse Button + Left Mouse Button). The short delay is meant to keep the player from mistakenly executing a shield bash during normal fighting.^^The AI will also be able to use this ability."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_21"),
          (eq, ":object", "$g_presentation_obj_21"),
          (str_store_string,s2,"str_disable_complex_formations"),
          (str_store_string,s3,"str_formation_feature"),
          (str_store_string,s4,"@The divisions of the player's army will not adopt the formations of shield wall, wedge, or square. Moreover, the F4 menu that contains these selections will no longer appear.^^The default ranks formations will always be adopted when the player closes ranks beyond the point needed to make a shoulder-to-shoulder line."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_22"),
          (eq, ":object", "$g_presentation_obj_22"),
          (str_store_string,s2,"str_have_formations_face_enemy"),
          (str_store_string,s3,"str_formation_feature"),
          (str_store_string,s4,"@When multiple divisions are placed, they will set up to face the center of the enemy forces. Without this option, they will set up along the facing that the player has when he/she places them, although individual divisions will still turn to face the enemy.^^For example, with the option OFF and the player facing AWAY from the attacker, infantry will set up on the RIGHT flank rather than the LEFT."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_23"),
          (eq, ":object", "$g_presentation_obj_23"),
          (str_store_string,s2,"str_players_enemies_only_attack"),
          (str_store_string,s3,"str_formation_feature"),
          (str_store_string,s4,"@The army opposing the player never takes a defensive position at the back of the map, but will always charge the armies of the player and his/her allies."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_24"),
          (eq, ":object", "$g_presentation_obj_24"),
          (str_store_string,s2,"str_music_in_battles"),
          (str_store_string,s3,"str_special_setting"),
          (str_store_string,s4,"@Disable music in battles and add more ambient sounds."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_25"),
          (eq, ":object", "$g_presentation_obj_25"),
          (str_store_string,s2,"str_damage_to_player"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s4,"@Set how much damage is done to your character."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_26"),
          (eq, ":object", "$g_presentation_obj_26"),
          (str_store_string,s2,"str_damage_to_friends"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s4,"@Set how much damage is done to your army."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_27"),
          (eq, ":object", "$g_presentation_obj_27"),
          (str_store_string,s2,"str_combat_ai"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s4,"@Set how well troops fight. They fight worst at Beginner level."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_28"),
          (eq, ":object", "$g_presentation_obj_28"),
          (str_store_string,s2,"str_campaign_ai"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s4,"@Campaign AI affects many aspects of the game, like:^- size of bandit parties^- renown loss in battles^- chance of recruiting lords^- taxes^- how lords get reinforcements^- how lords respond to the player's requests"),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_29"),
          (eq, ":object", "$g_presentation_obj_29"),
          (str_store_string,s2,"str_movement_and_combat_speed"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s8,"str_this_setting_affects_all"),
          (str_store_string,s4,"@Set the running speed of troops in battle.^^{s8}"),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_30"),
          (eq, ":object", "$g_presentation_obj_30"),
          (str_store_string,s2,"str_battle_size"),
          (str_store_string,s3,"str_performance_feature"),
          (call_script, "script_current_battle_size"),
          (str_store_string,s2,"@{s2} {reg0}"),
          (str_store_string,s4,"str_battle_size_text"),
          (overlay_set_display, "$g_presentation_obj_4", 0),
          (try_begin),
            (gt, reg0, 300),
            (overlay_set_color, "$g_presentation_obj_3", 0xFF0000),
          (try_end),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_31"),
          (eq, ":object", "$g_presentation_obj_31"),
          (str_store_string,s2,"str_wounds"),
          (str_store_string,s3,"str_realism_feature"),
          (str_store_string,s4,"@The player may receive specific, debilitating wounds in battle. Physicians in larger towns will treat these wounds for a price, after which they will heal within a few days. Any negative effects will then be removed. If wound is not treated after some time, it will change to a scar, and the negative effects will then be permanent."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_32"),
          (eq, ":object", "$g_presentation_obj_32"),
          (str_store_string,s2,"str_blood_loss"),
          (str_store_string,s3,"str_realism_feature"),
          (str_store_string,s8,"str_this_setting_affects_all"),
          (str_store_string,s4,"@Wounded troops take damage from blood loss.^^{s8}"),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$g_presentation_obj_33"),
          (eq, ":object", "$g_presentation_obj_33"),
          (str_store_string,s2,"str_quantity_bandit_parties"),
          (str_store_string,s3,"str_difficulty_setting"),
          (str_store_string,s4,"@From now on, spawn 33% less or 50% more bandits, raiders, etc."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$form_options_overlay_1"),
          (eq, ":object", "$form_options_overlay_1"),
          (str_store_string,s2,"str_player_division"),
          (str_store_string,s3,"str_formation_feature"),
          (str_store_string,s4,"@Sets the player as commander of the chosen division. This division will set up immediately left and behind the player on Hold and Follow commands (Wedge will put player on the point). Consider it for bodyguard divisions."),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (else_try),
          (this_or_next|eq, ":object_plus_one", "$form_options_overlay_2"),
          (eq, ":object", "$form_options_overlay_2"),
          (str_store_string,s2,"str_weapon_break"),
          (str_store_string,s3,"str_realism_feature"),
          (str_store_string,s4,"@Equipment may get damaged in battles, depending on its stats and the weapon maintenance skill of the party. Moreover, weaponsmiths and armorers offer to repair your equipment.^^{s8}"),
          (overlay_set_display, "$g_presentation_obj_4", 0),
        (try_end),
        
        
        
        (str_store_string,s3,"@{s3}^^{s4}"),
        (overlay_set_text, "$g_presentation_obj_3", s2),
        (overlay_set_text, "$g_presentation_obj_7", s3),
        
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),

        # (assign, reg8, ":value"),
        # (display_message, "@value = {reg8}"),
        (overlay_set_color, "$g_presentation_obj_3", 0x000000),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          
          (try_begin),
            (neq, "$recruitment_on", 0),
            (assign, "$recruitment_on_freezed", 1),
          (end_try),
          (try_begin),
            (neq, "$easy_levelling", 0),
            (assign, "$easy_levelling_freezed", 1),
          (end_try),
          (try_begin),
            (neq, "$easy_wage", 0),
            (assign, "$easy_wage_freezed", 1),
          (end_try),
          (try_begin),
            (eq, "$moralep_on", 0),
            (party_set_slot, "p_main_party", slot_party_unrested_morale_penalty, 0),
          (end_try),
          
          (try_for_range, ":center_no", centers_begin, centers_end),
            (eq, "$recruitment_on", 1),
            (party_set_slot,":center_no",recruit_permission_need, 0),
          (try_end),
          (try_begin),
            (eq, reg60, 0),	#no start game
            (jump_to_menu, "mnu_camp"),
          (else_try),
			(jump_to_menu, "mnu_start_game_1"),
          (end_try),
        (else_try),
          (eq, ":object", "$g_presentation_obj_2"),
          (presentation_set_duration, 0),
          
          (try_begin),
            (eq, reg60, 0),	#no start game
            (jump_to_menu, "mnu_camp_action"),
          (else_try),
            (jump_to_menu, "mnu_start_game_11"),
          (end_try),
          
        (else_try),
          (eq, ":object", "$g_presentation_obj_5"),
          (eq, reg60, 1),	#only start game
          (start_presentation, "prsnt_vc_options"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$campaign_type", camp_kingc),
          (else_try),
            (eq, ":value", 1),
            (assign, "$campaign_type", camp_lordc),
          (else_try),
            (eq, ":value", 3),
            (assign, "$campaign_type", camp_storyline),
          (else_try),
            (assign, "$campaign_type", camp_sandbox),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_6"),
          #(start_presentation, "prsnt_vc_options"),
          (assign, "$g_multiplayer_allow_shield_bash", 0),
          (assign, "$stamina_on", 0),
          (assign, "$g_armor_penalties", 0),
          (assign, "$moralep_on", 0),
          (assign, "$vc_wounds_on", 0),
          (assign, "$vc_bloodloss_on", 0),
          (assign, "$vc_weapon_break_on", 0),
          (assign, "$insanedamage_on", 0),
          (assign, "$bandit_quantity_option", 1),	#0 = 2/3, 1 = 1, 2 = 3/2
          (options_set_damage_to_player, 0),	#0 = 1/4, 1 = 1/2, 2 = 1/1
          (options_set_damage_to_friends, 0),	#0 = 1/2, 1 = 3/4, 2 = 1/1
          (options_set_combat_ai, 2),		#0 = good, 1 = average, 2 = poor
          (options_set_campaign_ai, 2),	#0 = good, 1 = average, 2 = poor
          (options_set_combat_speed, 0),	#0 = slowest, 1 = slower, 2 = normal, 3 = faster, 4 = fastest
          
          (try_begin),
            (eq, ":value", 0),
            (assign, "$difficulty_type", camp_d5),	#impossible
            (assign, "$g_multiplayer_allow_shield_bash", 1), #shield bash on
            (assign, "$stamina_on", 1), #stamina on
            (assign, "$g_armor_penalties", 1), #armor penalties on
            (assign, "$moralep_on", 1), #morale rest penalties on
            (assign, "$vc_wounds_on", 1),
            (assign, "$vc_bloodloss_on", 1),
            (assign, "$vc_weapon_break_on", 1),
            (assign, "$insanedamage_on", 1), #insane damage on
            (assign, "$bandit_quantity_option", 2),	#0 = 2/3, 1 = 1, 2 = 3/2
            (assign, ":difficulty_level", 2),
            (options_set_damage_to_player, 2),	#0 = 1/4, 1 = 1/2, 2 = 1/1
            (options_set_damage_to_friends, 2),	#0 = 1/2, 1 = 3/4, 2 = 1/1
            (options_set_combat_ai, 0),		#0 = good, 1 = average, 2 = poor
            (options_set_campaign_ai, 0),	#0 = good, 1 = average, 2 = poor
            (options_set_combat_speed, 4),	#0 = slowest, 1 = slower, 2 = normal, 3 = faster, 4 = fastest
          (else_try),
            (eq, ":value", 1),
            (assign, "$difficulty_type", camp_d4),	#realism
            (assign, "$g_multiplayer_allow_shield_bash", 1), #shield bash on
            (assign, "$stamina_on", 1), #stamina on
            (assign, "$g_armor_penalties", 1), #armor penalties on
            (assign, "$moralep_on", 1), #morale rest penalties on
            (assign, "$vc_wounds_on", 1),
            (assign, "$vc_bloodloss_on", 1),
            (assign, "$vc_weapon_break_on", 1),
            (assign, ":difficulty_level", 0),
            (options_set_damage_to_player, 2),	#0 = 1/4, 1 = 1/2, 2 = 1/1
            (options_set_damage_to_friends, 2),	#0 = 1/2, 1 = 3/4, 2 = 1/1
            (options_set_combat_ai, 1),		#0 = good, 1 = average, 2 = poor
            (options_set_campaign_ai, 1),	#0 = good, 1 = average, 2 = poor
            (options_set_combat_speed, 3),	#0 = slowest, 1 = slower, 2 = normal, 3 = faster, 4 = fastest
          (else_try),
            (eq, ":value", 2),
            (assign, "$difficulty_type", camp_d3),	#normal
            (assign, "$g_multiplayer_allow_shield_bash", 1), #shield bash on
            (assign, "$stamina_on", 1), #stamina on
            (assign, "$g_armor_penalties", 1), #armor penalties on
            (assign, "$vc_wounds_on", 1),
            (assign, "$vc_bloodloss_on", 1),
            (assign, "$vc_weapon_break_on", 1),
            (assign, ":difficulty_level", 0),
            (options_set_damage_to_player, 2),	#0 = 1/4, 1 = 1/2, 2 = 1/1
            (options_set_damage_to_friends, 2),	#0 = 1/2, 1 = 3/4, 2 = 1/1
            (options_set_combat_ai, 1),		#0 = good, 1 = average, 2 = poor
            (options_set_campaign_ai, 1),	#0 = good, 1 = average, 2 = poor
            (options_set_combat_speed, 2),	#0 = slowest, 1 = slower, 2 = normal, 3 = faster, 4 = fastest
          (else_try),
            (eq, ":value", 3),
            (assign, "$difficulty_type", camp_d2),	#beginner
            (assign, ":difficulty_level", 1),
          (else_try),
            (eq, ":value", 4),
            (assign, "$difficulty_type", camp_d1),
            (assign, ":difficulty_level", 0),
          (try_end),
          
          (try_begin),
            (neq, "$easy_levelling_freezed", 1),
            (assign, "$easy_levelling", ":difficulty_level"),
          (end_try),
          
          (try_begin),
            (neq, "$easy_wage_freezed", 1),
            (eq, ":difficulty_level", 2),
            (assign, "$easy_wage", 0),
          (else_try),
            (neq, "$easy_wage_freezed", 1),
            (assign, "$easy_wage", ":difficulty_level"),
          (end_try),
          
          (try_begin),
            (neq, "$recruitment_on_freezed", 1),
            (eq, ":difficulty_level", 2),
            (assign, "$recruitment_on", 0),
          (else_try),
            (neq, "$recruitment_on_freezed", 1),
            (assign, "$recruitment_on", ":difficulty_level"),
          (end_try),
          
          (overlay_set_val, "$g_presentation_obj_11", "$recruitment_on"),
          (overlay_set_val, "$g_presentation_obj_12", "$easy_levelling"),
          (overlay_set_val, "$g_presentation_obj_13", "$easy_wage"),
          
          (options_get_damage_to_player, reg8),
          (overlay_set_val, "$g_presentation_obj_25", reg8),
          (options_get_damage_to_friends, reg8),
          (overlay_set_val, "$g_presentation_obj_26", reg8),
          (options_get_combat_ai, reg8),
          (overlay_set_val, "$g_presentation_obj_27", reg8),
          (options_get_combat_speed, reg8),
          (overlay_set_val, "$g_presentation_obj_29", reg8),
          (options_get_campaign_ai, reg8),
          (overlay_set_val, "$g_presentation_obj_28", reg8),
          
          (overlay_set_val, "$g_presentation_obj_33", "$bandit_quantity_option"),
          (overlay_set_val, "$g_presentation_obj_14", "$stamina_on"),
          (overlay_set_val, "$g_presentation_obj_15", "$g_armor_penalties"),
          (overlay_set_val, "$g_presentation_obj_20", "$g_multiplayer_allow_shield_bash"),
          (overlay_set_val, "$g_presentation_obj_31", "$vc_wounds_on"),
          (overlay_set_val, "$g_presentation_obj_32", "$vc_bloodloss_on"),
          (overlay_set_val, "$form_options_overlay_2", "$vc_weapon_break_on"),
          (overlay_set_val, "$g_presentation_obj_16", "$moralep_on"),
          
          (overlay_set_val, "$g_presentation_obj_17", "$insanedamage_on"),
          (overlay_set_val, "$g_presentation_obj_18", "$goredec_on"),
          
        (else_try),
          (assign, "$difficulty_type", camp_d1),	#all other changes will change the difficulty type
          (overlay_set_val, "$g_presentation_obj_6", 4),
          (overlay_set_val, ":object", ":value"),
          
          (eq, ":object", "$g_presentation_obj_11"),
          (neq, "$recruitment_on_freezed", 1),
          (assign, "$recruitment_on", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_12"),
          (neq, "$easy_levelling_freezed", 1),
          (assign, "$easy_levelling", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_13"),
          (neq, "$easy_wage_freezed", 1),
          (assign, "$easy_wage", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_14"),
          (assign, "$stamina_on", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_15"),
          (assign, "$g_armor_penalties", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_16"),
          (assign, "$moralep_on", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_17"),
          (assign, "$insanedamage_on", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_18"),
          (assign, "$goredec_on", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_19"),
          (assign, "$g_vc_menu_turned_off", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_20"),
          (assign, "$g_multiplayer_allow_shield_bash", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_21"),
          (assign, "$FormAI_off", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_22"),
          (assign, "$FormAI_autorotate", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_23"),
          (assign, "$FormAI_AI_no_defense", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_24"),
          (assign, "$ambient_music_in_battle", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_25"),
          (options_set_damage_to_player, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_26"),
          (options_set_damage_to_friends, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_27"),
          (options_set_combat_ai, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_28"),
          (options_set_campaign_ai, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_29"),
          (options_set_combat_speed, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_30"),
          (options_set_battle_size, ":value"),
          (str_store_string,s2,"str_battle_size"),
          #
          (str_store_string,s3,"str_performance_feature"),
          (call_script, "script_current_battle_size"),
          (str_store_string,s2,"@{s2} {reg0}"),
          (str_store_string,s4,"str_battle_size_text"),
          (str_store_string,s3,"@{s3}^^{s4}"),
          (overlay_set_text, "$g_presentation_obj_3", s2),
          (overlay_set_text, "$g_presentation_obj_7", s3),
          (try_begin),
            (gt, reg0, 300),
            (overlay_set_color, "$g_presentation_obj_3", 0xFF0000),
          (try_end),
        (else_try),
          (eq, ":object", "$g_presentation_obj_31"),
          (assign, "$vc_wounds_on", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_32"),
          (assign, "$vc_bloodloss_on", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_33"),
          (assign, "$bandit_quantity_option", ":value"),
        (else_try),
          (eq, ":object", "$form_options_overlay_1"),
          (assign, "$FormAI_player_in_division", ":value"),
        (else_try),
          (eq, ":object", "$form_options_overlay_2"),
          (assign, "$vc_weapon_break_on", ":value"),
        (try_end),
    ]),
  
  (ti_on_presentation_run,
     [(try_begin),
      (key_clicked, key_pad_rright),
      (presentation_set_duration, 0),
    
      (try_begin),
        (neq, "$recruitment_on", 0),
        (assign, "$recruitment_on_freezed", 1),
      (end_try),
      (try_begin),
          (neq, "$easy_levelling", 0),
          (assign, "$easy_levelling_freezed", 1),
      (end_try),
      (try_begin),
          (neq, "$easy_wage", 0),
          (assign, "$easy_wage_freezed", 1),
      (end_try),
      (try_begin),
          (eq, "$moralep_on", 0),
          (party_set_slot, "p_main_party", slot_party_unrested_morale_penalty, 0),
      (end_try),
      
      (try_for_range, ":center_no", centers_begin, centers_end),
          (eq, "$recruitment_on", 1),
          (party_set_slot,":center_no",recruit_permission_need, 0),
      (try_end),
      (try_begin),
          (eq, reg60, 0),	#no start game
          (jump_to_menu, "mnu_camp"),
      (else_try),
          (jump_to_menu, "mnu_start_game_1"),
      (end_try),
    (else_try),
      (key_clicked, key_pad_rleft),
      (presentation_set_duration, 0),
        
      (try_begin),
        (eq, reg60, 0),	#no start game
        (jump_to_menu, "mnu_camp_action"),
      (else_try),
        (jump_to_menu, "mnu_start_game_11"),
      (end_try),
    (try_end),
    ]),
]),
###VC-2198 end

############
###segunda pantalla, biografia
("player_sheet_bio", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        ##        (position_set_x, pos1, 1000),
        ##        (position_set_y, pos1, 1000),
        ##        (overlay_set_size, "$g_presentation_obj_1", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_2", "@Default"),
        (position_set_x, pos1, 740),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        ##        (position_set_x, pos1, 1000),
        ##        (position_set_y, pos1, 1000),
        ##        (overlay_set_size, "$g_presentation_obj_2", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_3", "@Randomize"),
        (position_set_x, pos1, 580),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_3", pos1),
        ##        (position_set_x, pos1, 1000),
        ##        (position_set_y, pos1, 1000),
        ##        (overlay_set_size, "$g_presentation_obj_3", pos1),
        
        (create_text_overlay, reg1, "@Who are you?", tf_center_justify),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@Be careful with your choices.^They will affect your attributes, skills and dialogs, among other things.", tf_center_justify),
        #  (overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 670),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@Bio:", tf_left_align),
        #  (overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 590),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, reg1, pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        ## opciones personales
        (position_set_x, pos1, 125),
        (position_set_y, pos1, 500),
        (create_text_overlay, reg1, "@Gender:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 450),
        (create_text_overlay, reg1, "@Height:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 400),
        (create_text_overlay, reg1, "@Age:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 350),
        (create_text_overlay, reg1, "@Personality:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 300),
        (create_text_overlay, reg1, "@Greatest Virtue:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        ## opciones de pasado
        #(position_set_x, pos1, 580),
        (position_set_y, pos1, 550),
        (try_begin),
          (neq, "$campaign_type", camp_lordc),
          (neq, "$campaign_type", camp_kingc),
          (create_text_overlay, reg1, "@Ethnicity:", tf_center_justify),
        (else_try),
          (create_text_overlay, reg1, "@Kingdom:", tf_center_justify),
        (try_end),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 250),
        (create_text_overlay, reg1, "@Father's Occupation:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 200),
        (create_text_overlay, reg1, "@Learnt While a Child:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 150),
        (create_text_overlay, reg1, "@Vocation:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 100),
        (create_text_overlay, reg1, "@Religion:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        ## enlaces a lo que hacen:
        (position_set_x, pos3, 810),
        (position_set_y, pos3, 810),
        
        # gender
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 510),
        (create_combo_button_overlay, "$g_presentation_obj_11"),
        (overlay_set_position, "$g_presentation_obj_11", pos1),
        (overlay_set_size, "$g_presentation_obj_11", pos3),
        (overlay_add_item, "$g_presentation_obj_11", "@Female"),
        (overlay_add_item, "$g_presentation_obj_11", "@Male"),
        (try_begin),
          (eq, "$character_gender", tf_female),
          (overlay_set_val, "$g_presentation_obj_11", 0),
        (else_try),
          (overlay_set_val, "$g_presentation_obj_11", 1),
        (try_end),
        
        (position_set_y, pos1, 460),
        (create_combo_button_overlay, "$g_presentation_obj_12"),
        (overlay_set_position, "$g_presentation_obj_12", pos1),
        (overlay_set_size, "$g_presentation_obj_12", pos3),
        (overlay_add_item, "$g_presentation_obj_12", "@Normal"),
        (overlay_add_item, "$g_presentation_obj_12", "@Tall"),
        (overlay_add_item, "$g_presentation_obj_12", "@Short"),
        
        (try_begin),
          (eq, "$character_height", cb3_normal),
          (overlay_set_val, "$g_presentation_obj_12", 0),
        (else_try),
          (eq, "$character_height", cb3_alto),
          (overlay_set_val, "$g_presentation_obj_12", 1),
        (else_try),
          (eq, "$character_height", cb3_bajo),
          (overlay_set_val, "$g_presentation_obj_12", 2),
        (try_end),
        
        
        # Age
        (position_set_y, pos1, 410),
        (create_combo_button_overlay, "$g_presentation_obj_13"),
        (overlay_set_position, "$g_presentation_obj_13", pos1),
        (overlay_set_size, "$g_presentation_obj_13", pos3),
        (overlay_add_item, "$g_presentation_obj_13", "@Young (16-22 years old)"),
        (overlay_add_item, "$g_presentation_obj_13", "@Adult (23-40 years old)"),
        (overlay_add_item, "$g_presentation_obj_13", "@Elder (40 or more years old)"),
        (try_begin),
          (eq, "$age_type", cb4_young),
          (overlay_set_val, "$g_presentation_obj_13", 0),
        (else_try),
          (eq, "$age_type", cb4_adult),
          (overlay_set_val, "$g_presentation_obj_13", 1),
        (else_try),
          (eq, "$age_type", cb4_elder),
          (overlay_set_val, "$g_presentation_obj_13", 2),
        (try_end),
        
        # Personality
        (position_set_y, pos1, 360),
        (create_combo_button_overlay, "$g_presentation_obj_14"),
        (overlay_set_position, "$g_presentation_obj_14", pos1),
        (overlay_set_size, "$g_presentation_obj_14", pos3),
        (overlay_add_item, "$g_presentation_obj_14", "@Sanguine"),
        (overlay_add_item, "$g_presentation_obj_14", "@Choleric"),
        (overlay_add_item, "$g_presentation_obj_14", "@Melancholic"),
        (overlay_add_item, "$g_presentation_obj_14", "@Phlegmatic"),
        (try_begin),
          (eq, "$virtue_type", cb5_bold),
          (overlay_set_val, "$g_presentation_obj_14", 0),
        (else_try),
          (eq, "$virtue_type", cb5_extroverted),
          (overlay_set_val, "$g_presentation_obj_14", 1),
        (else_try),
          (eq, "$virtue_type", cb5_responsible),
          (overlay_set_val, "$g_presentation_obj_14", 2),
        (else_try),
          (eq, "$virtue_type", cb5_calm),
          (overlay_set_val, "$g_presentation_obj_14", 3),
        (try_end),
        
        # Cardinal virtues
        (position_set_y, pos1, 310),
        (create_combo_button_overlay, "$g_presentation_obj_15"),
        (overlay_set_position, "$g_presentation_obj_15", pos1),
        (overlay_set_size, "$g_presentation_obj_15", pos3),
        (overlay_add_item, "$g_presentation_obj_15", "@Justice"),
        (overlay_add_item, "$g_presentation_obj_15", "@Temperance"),
        (overlay_add_item, "$g_presentation_obj_15", "@Fortitude"),
        (overlay_add_item, "$g_presentation_obj_15", "@Wisdom"),
        (try_begin),
          (eq, "$defect_type", cb6_justice),
          (overlay_set_val, "$g_presentation_obj_15", 0),
        (else_try),
          (eq, "$defect_type", cb6_temperance),
          (overlay_set_val, "$g_presentation_obj_15", 1),
        (else_try),
          (eq, "$defect_type", cb6_fortitude),
          (overlay_set_val, "$g_presentation_obj_15", 2),
        (else_try),
          (eq, "$defect_type", cb6_prudence),
          (overlay_set_val, "$g_presentation_obj_15", 3),
        (try_end),
        
        # Nacionalidad
        # (position_set_x, pos1, 830),
        (position_set_y, pos1, 560),
        (create_combo_button_overlay, "$g_presentation_obj_16"),
        (overlay_set_position, "$g_presentation_obj_16", pos1),
        (overlay_set_size, "$g_presentation_obj_16", pos3),
        
        #by culture
        (try_begin),
          (neq, "$campaign_type", camp_lordc),
          (neq, "$campaign_type", camp_kingc),
          
          (overlay_add_item, "$g_presentation_obj_16", "@Anglo-Saxon"),
          (overlay_add_item, "$g_presentation_obj_16", "@Norse"),
          (overlay_add_item, "$g_presentation_obj_16", "@Frisian"),
          (overlay_add_item, "$g_presentation_obj_16", "@Irish"),
          (overlay_add_item, "$g_presentation_obj_16", "@Briton"),
          (overlay_add_item, "$g_presentation_obj_16", "@Scoto-Pict"),
          (overlay_add_item, "$g_presentation_obj_16", "@Foreigner"),
          (try_begin),
            (eq, "$nacionalidad_type", cb7_anglesaxon),
            (overlay_set_val, "$g_presentation_obj_16", 0),
          (else_try),
            (eq, "$nacionalidad_type", cb7_norseman),
            (overlay_set_val, "$g_presentation_obj_16", 1),
          (else_try),
            (eq, "$nacionalidad_type", cb7_frisian),
            (overlay_set_val, "$g_presentation_obj_16", 2),
          (else_try),
            (eq, "$nacionalidad_type", cb7_irish),
            (overlay_set_val, "$g_presentation_obj_16", 3),
          (else_try),
            (eq, "$nacionalidad_type", cb7_briton),
            (overlay_set_val, "$g_presentation_obj_16", 4),
          (else_try),
            (eq, "$nacionalidad_type", cb7_scotopict),
            (overlay_set_val, "$g_presentation_obj_16", 5),
          (else_try),
            (eq, "$nacionalidad_type", cb7_foreigner),
            (overlay_set_val, "$g_presentation_obj_16", 6),
          (try_end),
          
          #by kingdom
        (else_try),
          (try_for_range, ":faction", npc_kingdoms_begin, npc_kingdoms_end),
            (str_store_faction_name, s0, ":faction"),
            (overlay_add_item, "$g_presentation_obj_16", "@{s0}"),
          (try_end),
          
          (store_sub, reg0, "$g_faction_selected", npc_kingdoms_begin),
          (overlay_set_val, "$g_presentation_obj_16", reg0),
        (try_end),
        
        # father
        (position_set_y, pos1, 260),
        (create_combo_button_overlay, "$g_presentation_obj_17"),
        (overlay_set_position, "$g_presentation_obj_17", pos1),
        (overlay_set_size, "$g_presentation_obj_17", pos3),
        (overlay_add_item, "$g_presentation_obj_17", "@Outlaw"),
        (overlay_add_item, "$g_presentation_obj_17", "@Peasant"),
        (overlay_add_item, "$g_presentation_obj_17", "@Priest"),
        (overlay_add_item, "$g_presentation_obj_17", "@Craftsman"),
        (overlay_add_item, "$g_presentation_obj_17", "@Merchant"),
        (overlay_add_item, "$g_presentation_obj_17", "@Noble"),
        (try_begin),
          (eq, "$background_type", cb_thief),
          (overlay_set_val, "$g_presentation_obj_17", 0),
        (else_try),
          (eq, "$background_type", cb_nomad),
          (overlay_set_val, "$g_presentation_obj_17", 1),
        (else_try),
          (eq, "$background_type", cb_forester),
          (overlay_set_val, "$g_presentation_obj_17", 2),
        (else_try),
          (eq, "$background_type", cb_guard),
          (overlay_set_val, "$g_presentation_obj_17", 3),
        (else_try),
          (eq, "$background_type", cb_merchant),
          (overlay_set_val, "$g_presentation_obj_17", 4),
        (else_try),
          (eq, "$background_type", cb_noble),
          (overlay_set_val, "$g_presentation_obj_17", 5),
        (try_end),
        
        
        # child learn how
        (position_set_y, pos1, 210),
        (create_combo_button_overlay, "$g_presentation_obj_18"),
        (overlay_set_position, "$g_presentation_obj_18", pos1),
        (overlay_set_size, "$g_presentation_obj_18", pos3),
        (overlay_add_item, "$g_presentation_obj_18", "@Farming"),
        (overlay_add_item, "$g_presentation_obj_18", "@Stealing"),
        (overlay_add_item, "$g_presentation_obj_18", "@Oratory"),
        (overlay_add_item, "$g_presentation_obj_18", "@Crafts"),
        (overlay_add_item, "$g_presentation_obj_18", "@Martial Arts"),
        (try_begin),
          (eq, "$child_type", cb2_steppe_child),
          (overlay_set_val, "$g_presentation_obj_18", 0),
        (else_try),
          (eq, "$child_type", cb2_urchin),
          (overlay_set_val, "$g_presentation_obj_18", 1),
        (else_try),
          (eq, "$child_type", cb2_merchants_helper),
          (overlay_set_val, "$g_presentation_obj_18", 2),
        (else_try),
          (eq, "$child_type", cb2_apprentice),
          (overlay_set_val, "$g_presentation_obj_18", 3),
        (else_try),
          (eq, "$child_type", cb2_page),
          (overlay_set_val, "$g_presentation_obj_18", 4),
        (try_end),
        
        # Before begin this adventure, you waste your life in:
        (position_set_y, pos1, 160),
        (create_combo_button_overlay, "$g_presentation_obj_19"),
        (overlay_set_position, "$g_presentation_obj_19", pos1),
        (overlay_set_size, "$g_presentation_obj_19", pos3),
        (overlay_add_item, "$g_presentation_obj_19", "@Slave"),
        (overlay_add_item, "$g_presentation_obj_19", "@Priest"),
        (overlay_add_item, "$g_presentation_obj_19", "@Traveler"),
        (overlay_add_item, "$g_presentation_obj_19", "@Hunter"),
        (overlay_add_item, "$g_presentation_obj_19", "@Landowner"),
        (try_begin),
          (eq, "$blife_type", cb3_slave),
          (overlay_set_val, "$g_presentation_obj_19", 0),
        (else_try),
          (eq, "$blife_type", cb3_student),
          (overlay_set_val, "$g_presentation_obj_19", 1),
        (else_try),
          (eq, "$blife_type", cb3_traveler),
          (overlay_set_val, "$g_presentation_obj_19", 2),
        (else_try),
          (eq, "$blife_type", cb3_roamer),
          (overlay_set_val, "$g_presentation_obj_19", 3),
        (else_try),
          (eq, "$blife_type", cb3_landowner),
          (overlay_set_val, "$g_presentation_obj_19", 4),
        (try_end),
        # Religion
        (position_set_y, pos1, 110),
        (create_combo_button_overlay, "$g_presentation_obj_20"),
        (overlay_set_position, "$g_presentation_obj_20", pos1),
        (overlay_set_size, "$g_presentation_obj_20", pos3),
        (overlay_add_item, "$g_presentation_obj_20", "@Christian"),
        (overlay_add_item, "$g_presentation_obj_20", "@Pagan"),
        (try_begin),
          (eq, "$religion_type", cb3_christian),
          (overlay_set_val, "$g_presentation_obj_20", 0),
        (else_try),
          (eq, "$religion_type", cb3_pagan),
          (overlay_set_val, "$g_presentation_obj_20", 1),
        (try_end),
        
        ## story
        (call_script, "script_texto_historia_character"),
        (create_text_overlay, reg1, "@{s1}", tf_double_space|tf_scrollable),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 500),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 820),
        (position_set_y, pos1, 820),
        (overlay_set_size, reg1, pos1),
        
        ##        (create_text_overlay, reg1, "@{s1}", tf_double_space|tf_scrollable),
        ##        (position_set_x, pos1, 400),
        ##        (position_set_y, pos1, 80),
        ##        (overlay_set_position, reg1, pos1),
        ##        (position_set_x, pos1, 500),
        ##        (position_set_y, pos1, 450),
        ##        (overlay_set_area_size, reg1, pos1),
        
    ]),
    
    #(ti_on_presentation_run,
    #[
    #]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_11"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$character_gender", tf_female),
            (assign, reg59, tf_female),
          (else_try),
            (assign, "$character_gender", tf_male),
            (assign, reg59, tf_male),
          (try_end),
          #alturas
        (else_try),
          (eq, ":object", "$g_presentation_obj_12"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$character_height", cb3_normal),
          (else_try),
            (eq, ":value", 1),
            (assign, "$character_height", cb3_alto),
          (else_try),
            (eq, ":value", 2),
            (assign, "$character_height", cb3_bajo),
          (try_end),
          #age
        (else_try),
          (eq, ":object", "$g_presentation_obj_13"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$age_type", cb4_young),
          (else_try),
            (eq, ":value", 1),
            (assign, "$age_type", cb4_adult),
          (else_try),
            (eq, ":value", 2),
            (assign, "$age_type", cb4_elder),
          (try_end),
          #virtue
        (else_try),
          (eq, ":object", "$g_presentation_obj_14"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$virtue_type", cb5_bold),
          (else_try),
            (eq, ":value", 1),
            (assign, "$virtue_type", cb5_extroverted),
          (else_try),
            (eq, ":value", 2),
            (assign, "$virtue_type", cb5_responsible),
          (else_try),
            (eq, ":value", 3),
            (assign, "$virtue_type", cb5_calm),
          (try_end),
          #Defects
        (else_try),
          (eq, ":object", "$g_presentation_obj_15"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$defect_type", cb6_justice),
          (else_try),
            (eq, ":value", 1),
            (assign, "$defect_type", cb6_temperance),
          (else_try),
            (eq, ":value", 2),
            (assign, "$defect_type", cb6_fortitude),
          (else_try),
            (eq, ":value", 3),
            (assign, "$defect_type", cb6_prudence),
          (try_end),
          
          #Nationality
        (else_try),
          (eq, ":object", "$g_presentation_obj_16"),
          
          #by culture
          (try_begin),
            (neq, "$campaign_type", camp_lordc),
            (neq, "$campaign_type", camp_kingc),
            
            (try_begin),
              (eq, ":value", 0),
              (assign, "$nacionalidad_type", cb7_anglesaxon),
            (else_try),
              (eq, ":value", 1),
              (assign, "$nacionalidad_type", cb7_norseman),
            (else_try),
              (eq, ":value", 2),
              (assign, "$nacionalidad_type", cb7_frisian),
            (else_try),
              (eq, ":value", 3),
              (assign, "$nacionalidad_type", cb7_irish),
            (else_try),
              (eq, ":value", 4),
              (assign, "$nacionalidad_type", cb7_briton),
            (else_try),
              (eq, ":value", 5),
              (assign, "$nacionalidad_type", cb7_scotopict),
            (else_try),
              (eq, ":value", 6),
              (assign, "$nacionalidad_type", cb7_foreigner),
            (try_end),
            
            #by faction
          (else_try),
            (store_add, "$g_faction_selected", ":value", npc_kingdoms_begin),
            (call_script, "script_faction_to_cb7", "$g_faction_selected"),
            (assign, "$nacionalidad_type", reg0),
          (try_end),
          
          
          # father
        (else_try),
          (eq, ":object", "$g_presentation_obj_17"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$background_type", cb_thief),
          (else_try),
            (eq, ":value", 1),
            (assign, "$background_type", cb_nomad),
          (else_try),
            (eq, ":value", 2),
            (assign, "$background_type", cb_forester),
          (else_try),
            (eq, ":value", 3),
            (assign, "$background_type", cb_guard),
          (else_try),
            (eq, ":value", 4),
            (assign, "$background_type", cb_merchant),
          (else_try),
            (eq, ":value", 5),
            (assign, "$background_type", cb_noble),
          (try_end),
          #child
        (else_try),
          (eq, ":object", "$g_presentation_obj_18"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$child_type", cb2_steppe_child),
          (else_try),
            (eq, ":value", 1),
            (assign, "$child_type", cb2_urchin),
          (else_try),
            (eq, ":value", 2),
            (assign, "$child_type", cb2_merchants_helper),
          (else_try),
            (eq, ":value", 3),
            (assign, "$child_type", cb2_apprentice),
          (else_try),
            (eq, ":value", 4),
            (assign, "$child_type", cb2_page),
          (try_end),
          #before adventure
        (else_try),
          (eq, ":object", "$g_presentation_obj_19"),
          (try_begin),
            (neq, "$campaign_type", camp_lordc),
            (neq, "$campaign_type", camp_kingc),
            (try_begin),
              (eq, ":value", 0),
              (assign, "$blife_type", cb3_slave),
            (else_try),
              (eq, ":value", 1),
              (assign, "$blife_type", cb3_student),
            (else_try),
              (eq, ":value", 2),
              (assign, "$blife_type", cb3_traveler),
            (else_try),
              (eq, ":value", 3),
              (assign, "$blife_type", cb3_roamer),
            (else_try),
              (eq, ":value", 4),
              (assign, "$blife_type", cb3_landowner),
            (try_end),
            
          (else_try),
            (lt, ":value", 4),
            (display_message, "@This option is not available in Lordly or Royal Sandbox modes."),
          (try_end),
          
          #religion
        (else_try),
          (eq, ":object", "$g_presentation_obj_20"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$religion_type", cb3_christian),
          (else_try),
            (eq, ":value", 1),
            (assign, "$religion_type", cb3_pagan),
          (try_end),
          
        (else_try), ## Randomize
          (eq, ":object", "$g_presentation_obj_3"),
          # height
          (store_random_in_range, ":r_value", 0, 3),
          (try_begin),
            (eq, ":r_value", 0),
            (assign, "$character_height", cb3_normal),
          (else_try),
            (eq, ":r_value", 1),
            (assign, "$character_height", cb3_alto),
          (else_try),
            #(eq, ":r_value", 2),
            (assign, "$character_height", cb3_bajo),
          (try_end),
          # age
          (store_random_in_range, ":r_value", 0, 3),
          (try_begin),
            (eq, ":r_value", 0),
            (assign, "$age_type", cb4_young),
          (else_try),
            (eq, ":r_value", 1),
            (assign, "$age_type", cb4_adult),
          (else_try),
            #(eq, ":r_value", 2),
            (assign, "$age_type", cb4_elder),
          (try_end),
          # Personality
          (store_random_in_range, ":r_value", 0, 4),
          (try_begin),
            (eq, ":r_value", 0),
            (assign, "$virtue_type", cb5_bold),
          (else_try),
            (eq, ":r_value", 1),
            (assign, "$virtue_type", cb5_extroverted),
          (else_try),
            (eq, ":r_value", 2),
            (assign, "$virtue_type", cb5_responsible),
          (else_try),
            #  (eq, ":r_value", 3),
            (assign, "$virtue_type", cb5_calm),
          (try_end),
          # Virtues
          (store_random_in_range, ":r_value", 0, 4),
          (try_begin),
            (eq, ":r_value", 0),
            (assign, "$defect_type", cb6_justice),
          (else_try),
            (eq, ":r_value", 1),
            (assign, "$defect_type", cb6_temperance),
          (else_try),
            (eq, ":r_value", 2),
            (assign, "$defect_type", cb6_fortitude),
          (else_try),
            #  (eq, ":r_value", 3),
            (assign, "$defect_type", cb6_prudence),
          (try_end),
          
          # Nationality
          (try_begin),
            (neq, "$campaign_type", camp_lordc),
            (neq, "$campaign_type", camp_kingc),
            
            (store_random_in_range, ":r_value", 0, 7),
            (try_begin),
              (eq, ":r_value", 0),
              (assign, "$nacionalidad_type", cb7_anglesaxon),
            (else_try),
              (eq, ":r_value", 1),
              (assign, "$nacionalidad_type", cb7_norseman),
            (else_try),
              (eq, ":r_value", 2),
              (assign, "$nacionalidad_type", cb7_frisian),
            (else_try),
              (eq, ":r_value", 3),
              (assign, "$nacionalidad_type", cb7_irish),
            (else_try),
              (eq, ":r_value", 4),
              (assign, "$nacionalidad_type", cb7_briton),
            (else_try),
              (eq, ":r_value", 5),
              (assign, "$nacionalidad_type", cb7_scotopict),
            (else_try),
              (assign, "$nacionalidad_type", cb7_foreigner),
            (try_end),
            
            #pick faction
          (else_try),
            (store_random_in_range, "$g_faction_selected", npc_kingdoms_begin, npc_kingdoms_end),
            (call_script, "script_faction_to_cb7", "$g_faction_selected"),
            (assign, "$nacionalidad_type", reg0),
          (try_end),
          
          # Father
          (store_random_in_range, ":r_value", 0, 6),
          (try_begin),
            (eq, ":r_value", 0),
            (assign, "$background_type", cb_thief),
          (else_try),
            (eq, ":r_value", 1),
            (assign, "$background_type", cb_nomad),
          (else_try),
            (eq, ":r_value", 2),
            (assign, "$background_type", cb_forester),
          (else_try),
            (eq, ":r_value", 3),
            (assign, "$background_type", cb_guard),
          (else_try),
            (eq, ":r_value", 4),
            (assign, "$background_type", cb_merchant),
          (else_try),
            # (eq, ":r_value", 5),
            (assign, "$background_type", cb_noble),
          (try_end),
          (store_random_in_range, ":r_value", 0, 5),
          (try_begin),
            (eq, ":r_value", 0),
            (assign, "$child_type", cb2_steppe_child),
          (else_try),
            (eq, ":r_value", 1),
            (assign, "$child_type", cb2_urchin),
          (else_try),
            (eq, ":r_value", 2),
            (assign, "$child_type", cb2_merchants_helper),
          (else_try),
            (eq, ":r_value", 3),
            (assign, "$child_type", cb2_apprentice),
          (else_try),
            # (eq, ":r_value", 4),
            (assign, "$child_type", cb2_page),
          (try_end),
          
          (try_begin),
            (neq, "$campaign_type", camp_lordc),
            (neq, "$campaign_type", camp_kingc),
            
            (store_random_in_range, ":r_value", 0, 5),
            (try_begin),
              (eq, ":r_value", 0),
              (assign, "$blife_type", cb3_slave),
            (else_try),
              (eq, ":r_value", 1),
              (assign, "$blife_type", cb3_student),
            (else_try),
              (eq, ":r_value", 2),
              (assign, "$blife_type", cb3_traveler),
            (else_try),
              (eq, ":r_value", 3),
              (assign, "$blife_type", cb3_roamer),
            (else_try),
              # (eq, ":r_value", 4),
              (assign, "$blife_type", cb3_landowner),
            (try_end),
          (try_end),
          
          (try_begin),
            (eq, "$nacionalidad_type", cb7_norseman),
            (assign, "$religion_type", cb3_pagan),
          (else_try),
            (assign, "$religion_type", cb3_christian),
          (try_end),
          (start_presentation, "prsnt_player_sheet_bio"),
          
        (else_try), ## Initial
          (eq, ":object", "$g_presentation_obj_2"),
          (assign, "$character_gender", tf_male),
          (assign, "$character_height", cb3_normal),
          (assign, "$age_type", cb4_young),
          (assign, "$virtue_type", cb5_bold),
          (assign, "$defect_type", cb6_prudence),
          (assign, "$g_faction_selected", "fac_kingdom_5"),
          (assign, "$nacionalidad_type", cb7_anglesaxon),
          (assign, "$background_type", cb_thief),
          (assign, "$child_type", cb2_steppe_child),
          (assign, "$blife_type", cb3_student),
          (assign, "$religion_type", cb3_pagan),
          (start_presentation, "prsnt_player_sheet_bio"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_1"),
          # genderblife
          ##          (try_begin),
          ##            (eq,"$character_gender",tf_male),
          ##            (troop_set_type,"trp_player", 0),
          ##          (else_try),
          ##            (troop_set_type,"trp_player", 1),
          ##          (try_end),
          #altura and gender
          (try_begin),
            (eq,"$character_height",cb3_alto),
            #            (troop_set_type,"trp_player", 0),
            (try_begin),
              (eq,"$character_gender", tf_female),
              # (val_or, ":char_type", tf_alta),
              (troop_set_type,"trp_player", tf_alta),
            (else_try),
              # (val_or, ":char_type", tf_alto),
              (troop_set_type,"trp_player", tf_alto),
            (try_end),
            
          (else_try),
            (eq,"$character_height",cb3_bajo),
            #            (troop_set_type,"trp_player", 1),
            (try_begin),
              (eq,"$character_gender", tf_female),
              #(val_or, ":char_type", tf_baja),
              (troop_set_type,"trp_player", tf_baja),
            (else_try),
              # (val_or, ":char_type", tf_bajo),
              (troop_set_type,"trp_player", tf_bajo),
            (try_end),
          (else_try),
            (troop_set_type,"trp_player", "$character_gender"),
          (try_end),
          
          (assign, reg59, "$character_gender"),
          (presentation_set_duration, 0),
          (jump_to_menu, "mnu_start_game_4"),
        (try_end),
        (call_script, "script_texto_historia_character"),
        (overlay_set_text, reg1, "@{s1}"),
    ]),
]),
###character creation chief acaba

##########CHARACTER SCREEN chief#########
("character_screen_main",0,0,[
    (ti_on_presentation_load,
      [(presentation_set_duration,999999),
        (set_fixed_point_multiplier, 1000),
        
        ##      (create_mesh_overlay, reg1, "mesh_load_window"),
        ##      (position_set_x, pos1, 1002),
        ##      (position_set_y, pos1, 1002),
        ##      (overlay_set_size, reg1, pos1),
        ##      (position_set_x, pos1, -1),
        ##      (position_set_y, pos1, -1),
        ##      (overlay_set_position, reg1, pos1),
        (call_script,"script_check_if_playername_is_correct"),
        (str_clear,s2),
        (str_clear,s3),
        (str_clear,s4),
        (str_clear,s5),
        (str_clear,s6),
        (str_clear,s7),
        (str_clear,s8),
        (str_clear,s9),
        
        (str_clear,s10),
        (str_clear,s11),
        (str_clear,s12),
        (str_clear,s13),
        (str_clear,s14),
        (str_clear,s15),
        (str_clear,s16),
        (str_clear,s17),
        (str_clear,s18),
        
        #preventing bugs:
        (assign, "$g_presentation_obj_12", -1),
        (assign, "$g_presentation_obj_13", -1),
        (assign, "$g_presentation_obj_14", -1),
        (assign, "$g_presentation_obj_15", -1),
        (assign, "$g_presentation_obj_16", -1),
        (assign, "$g_presentation_obj_17", -1),
        
        (create_game_button_overlay, "$g_presentation_obj_1", "str_done"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        # (try_begin), #Kingdom report access if player is king
        (create_game_button_overlay, "$g_presentation_obj_2", "@Your Kingdom"),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        # (try_end),
        #####shadow
        ##                (create_text_overlay, reg1, "@Name: ^{playername}", tf_center_justify), #arriba centrado
        ##        (overlay_set_color, reg1, 0xD5C7B6), #Beige
        ##        (position_set_x, pos1, 168),
        ##        (position_set_y, pos1, 550),
        ##        (overlay_set_position, reg1, pos1),
        ##        (position_set_x, pos1, 1100),
        ##        (position_set_y, pos1, 1100),
        ##        (overlay_set_size, reg1, pos1),
        ####
        (create_text_overlay, reg1, "@Name ^{playername}", tf_center_justify), #arriba centrado
        # (overlay_set_color, reg1, 0x996633), #saddle brown, se ve bien
        # (overlay_set_color, reg1, 0xB7AA9C), #sandstone, demasiado grisaceo
        #(overlay_set_color, reg1, 0xA28A56), #tan
        #(overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
        #(overlay_set_color, reg1, 0xD5D3B6), #Fawn se ve poco
        #  (overlay_set_color, reg1, 0x9ACD32), #Yellow green se ve regular
        #(overlay_set_color, reg1, 0xFFDD21), #Primrose Yellow se ve bien
        ##        (overlay_set_color, reg1, 0xD5C7B6), #Beige se ve poco
        ##        (overlay_set_color, reg1, 0x0x777777), #Traffic Grey se ve bien
        # (overlay_set_color, reg1, 0xFFFFFF), #White se ve bien
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        (position_set_x, pos1, 169),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1100),
        (position_set_y, pos1, 1100),
        (overlay_set_size, reg1, pos1),
        #player basic
        (create_text_overlay, reg1, "@Level:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (store_character_level, reg0, "trp_player"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 410),
        (overlay_set_position, reg1, pos1),
        #  (overlay_set_color, reg1, 0x008000), #verde que se ve bien
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        
        (create_text_overlay, reg1, "@Health:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (store_troop_health,reg0,"trp_player",1),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        
        (create_text_overlay, reg1, "@Stamina:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, ":basic_stamina",reg0),
        (store_skill_level, ":fatigue",  "skl_athletics", "trp_player"),
        (val_add, ":fatigue", 1), #obtenemos total fatigue min 90 max 210
        (val_mul, ":fatigue", 2), #obtenemos total fatigue min 90 max 210
        (val_add, ":basic_stamina", ":fatigue"), #obtenemos total fatigue min 60 max 141
        (assign, reg0,":basic_stamina"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        #player social
        (create_text_overlay, reg1, "@Renown:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 340),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (troop_get_slot, reg0, "trp_player", slot_troop_renown),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 340),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        
        (create_text_overlay, reg1, "@Reputation:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 320),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        (call_script, "script_player_honor_to_s3", "$player_honor"),
        
        (create_text_overlay, reg1, "@{!}{s3}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 320),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (lt, "$player_honor", 0),
          (overlay_set_color, reg1, 0xFF0000), #rojo
        (else_try),
          (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        (try_end),
        # right to rule
        (create_text_overlay, reg1, "@Right to Rule:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0, "$player_right_to_rule"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        (create_text_overlay, reg1, "@Money:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 280),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (store_troop_gold, reg0, "trp_player"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 280),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        
        #player info extra
        (create_text_overlay, reg1, "@Religion:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 250),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (try_begin),
          (eq, "$g_player_faith", 2),
          #   (eq, "$religion_type", cb3_pagan),
          (str_store_string,s4,"@Scandinavian Gods"),
        (else_try),
          (str_store_string,s4,"@Christianity"),
        (try_end),
        (create_text_overlay, reg1, "@{!}{s4}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 250),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        
        (create_text_overlay, reg1, "@Can read:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 230),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (try_begin),
          (eq, "$sabe_leer", 1),
          (str_store_string,s6,"str_yes_wo_dot"),
        (else_try),
          (str_store_string,s6,"str_no_wo_dot"),
        (try_end),
        (create_text_overlay, reg1, "@{!}{s6}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 230),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (eq, "$sabe_leer", 1),
          (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        (else_try),
          (overlay_set_color, reg1, 0xFF0000), #rojo
        (try_end),
        
        
        (create_text_overlay, reg1, "@Reading:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 210),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (try_begin),
          (gt, "$g_player_reading_book", 0),
          (player_has_item, "$g_player_reading_book"),
          (str_store_item_name, s7, "$g_player_reading_book"),
        (else_try),
          (str_store_string, s7, "@No books."),
        (try_end),
        (create_text_overlay, reg1, "@{!}{s7}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 210),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (gt, "$g_player_reading_book", 0),
          (player_has_item, "$g_player_reading_book"),
          (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        (else_try),
          (overlay_set_color, reg1, 0xFF0000), #rojo
        (try_end),
        
        
        ### traits
        (create_text_overlay, reg1, "@Trait:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (try_begin),
          (eq, "$player_trait", 1),
          (str_store_string,s9,"str_trait_1"),
        (else_try),
          (eq, "$player_trait", 2),
          (str_store_string,s9,"str_trait_2"),
        (else_try),
          (eq, "$player_trait", 3),
          (str_store_string,s9,"str_trait_3"),
        (else_try),
          (eq, "$player_trait", 4),
          (str_store_string,s9,"str_trait_4"),
        (else_try),
          (str_store_string,s9,"str_none"),
        (try_end),
        (create_text_overlay, reg1, "@{!}{s9}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (ge, "$player_trait", 1),
          (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        (else_try),
          (overlay_set_color, reg1, 0xFF0000), #rojo
        (try_end),
        
        ####
        # Specials
        (create_text_overlay, reg1, "@Special Trait:", 0),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 160),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (try_begin),
          (eq, "$special1", 1),
          (str_store_string,s9,"@Dungeon Master"),
        (else_try),
          (eq, "$special1", 2),
          (str_store_string,s9,"@Ladies' Man"),
        (else_try),
          (eq, "$special1", 3),
          (str_store_string,s9,"@Wine Connoisseur"),
        (else_try),
          (str_store_string,s9,"str_none"),
        (try_end),
        (create_text_overlay, reg1, "@{!}{s9}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 160),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (ge, "$special1", 1),
          (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        (else_try),
          (overlay_set_color, reg1, 0xFF0000), #rojo
        (try_end),
        ##########
        ###scars ###Phaiak maybe you want add some scars notes when player dont heal his wounds and lose attribute or skill points?
        (create_text_overlay, reg1, "@Scars:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 140),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        #phaiak begin
        (quest_get_slot, reg1, "qst_vc_wounds", slot_quest_int_penalty_perma_points),
        (quest_get_slot, reg2, "qst_vc_wounds", slot_quest_cha_penalty_perma_points),
        (quest_get_slot, reg3, "qst_vc_wounds", slot_quest_str_penalty_perma_points),
        (quest_get_slot, reg4, "qst_vc_wounds", slot_quest_agi_penalty_perma_points),
        (store_add, ":number_of_scars", reg1, reg2),
        (val_add, ":number_of_scars", reg3),
        (val_add, ":number_of_scars", reg4),
        (try_begin),
          (le, ":number_of_scars", 0),
          (str_store_string, s10, "str_none"),
        (else_try),
          (assign, reg1, ":number_of_scars"),
          (str_store_string, s10, "@{reg1}"),
        (try_end),
        #phaiak end
        
        (create_text_overlay, reg1, "@{!}{s10}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 140),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (ge, "$player_trait", 1),
          (overlay_set_color, reg1, 0xE12126), #red
        (else_try),
          (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        (try_end),
        
        (create_text_overlay, reg1, "@Wounds:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        #phaiak begin
        (quest_get_slot, reg1, "qst_vc_wounds", slot_quest_int_penalty_fluid_points),
        (quest_get_slot, reg2, "qst_vc_wounds", slot_quest_cha_penalty_fluid_points),
        (quest_get_slot, reg3, "qst_vc_wounds", slot_quest_str_penalty_fluid_points),
        (quest_get_slot, reg4, "qst_vc_wounds", slot_quest_agi_penalty_fluid_points),
        (store_add, ":number_of_wounds", reg1, reg2),
        (val_add, ":number_of_wounds", reg3),
        (val_add, ":number_of_wounds", reg4),
        (try_begin),
          (le, ":number_of_wounds", 0),
          (str_store_string, s11, "str_none"),
        (else_try),
          (assign, reg1, ":number_of_wounds"),
          (str_store_string, s11, "@{reg1}"),
        (end_try),
        #phaiak end
        
        (create_text_overlay, reg1, "@{!}{s11}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (ge, "$player_trait", 1),
          (overlay_set_color, reg1, 0xE12126), #red
        (else_try),
          (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        (try_end),
        
        
        (create_text_overlay, reg1, "@Enemies Killed:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 90),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (get_player_agent_kill_count, reg0),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 90),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        
        (create_text_overlay, reg1, "@Enemies Wounded:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 70),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (get_player_agent_kill_count, reg0, 1),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 70),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        
        (create_text_overlay, reg1, "@Allies Killed:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 50),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (get_player_agent_own_troop_kill_count, reg0),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 50),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0xE12126), #red
        
        (create_text_overlay, reg1, "@Allies Wounded:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 30),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (get_player_agent_own_troop_kill_count, reg0, 1),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 30),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0xE12126), #red
        
        ##player picture arriba derecha
        (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_player"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 550),
        (overlay_set_size, "$jq_portrait", pos1),
        (position_set_x, pos1, 300),
        (position_set_y, pos1, 440),
        (overlay_set_position, "$jq_portrait", pos1),
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_character"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (try_begin),
          (ge,"$g_presentations_next_presentation",-1),
          #player story
          (create_game_button_overlay,"$g_presentation_obj_3","@Story",tf_center_justify),
          (position_set_x, pos1, 180),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_3", pos1),
          #Skills/attributes
          (create_game_button_overlay,"$g_presentation_obj_4","@Attributes/Skills",tf_center_justify),
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_4", pos1),
          #Wounds Report
          (create_game_button_overlay,"$g_presentation_obj_5","@Wounds",tf_center_justify),
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_5", pos1),
          #Quest
          (create_game_button_overlay,"$g_presentation_obj_6","@Quest",tf_center_justify),
          (position_set_x, pos1, 180),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_6", pos1),
          #Party Info
          (create_game_button_overlay,"$g_presentation_obj_7","@Party",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_7", pos1),
          #relations basic Info
          (create_game_button_overlay,"$g_presentation_obj_8","@Relations",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_8", pos1),
          #Weekly budget
          (create_game_button_overlay,"$g_presentation_obj_9","@Budget",tf_center_justify), #en el medio
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_9", pos1),
          #Stadistics
          (create_game_button_overlay,"$g_presentation_obj_10","@Statistics",tf_center_justify),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_10", pos1),
          #Set Goal -> only displays when looking at Statistics and not in storyline
          (try_begin),
            (try_begin),
              (quest_get_slot, ":current_goal", "qst_vc_menu", slot_set_goal_type),
              (ge, ":current_goal", goal_custom),
              (str_store_string, s50, "str_set_goal_open_button_label2"),
            (else_try),
              (str_store_string, s50, "str_set_goal_open_button_label"),
            (try_end),
            (create_game_button_overlay,"$g_presentation_open_set_goal",s50,tf_center_justify),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 565),
            (overlay_set_position, "$g_presentation_open_set_goal", pos1),
            (str_clear, s50),
            
            (this_or_next|eq, "$campaign_type", camp_storyline),
            (neq, "$temp", 1),
            (overlay_set_display, "$g_presentation_open_set_goal", 0),
            
          (try_end),
          #Companions mission
          (create_game_button_overlay,"$g_presentation_obj_11","@Companions",tf_center_justify),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_11", pos1),
          
          (try_begin),
            (create_game_button_overlay,"$g_presentation_companions","str_com_view_companions",tf_center_justify),
            (position_set_x, pos1, 755),
            (position_set_y, pos1, 600),
            (overlay_set_position, "$g_presentation_companions", pos1),
            (neq, "$temp", 4),
            (overlay_set_display, "$g_presentation_companions", 0),
          (try_end),
          
          #Relations
          #factions
          (try_begin), #show when Relations info is ok
            (eq,"$temp",2),
            
            (create_game_button_overlay,"$g_presentation_obj_12","@Factions",tf_center_justify),
            (position_set_x, pos1, 600),
            (position_set_y, pos1, 600),
            (overlay_set_position, "$g_presentation_obj_12", pos1),
            #Lords relations
            (create_game_button_overlay,"$g_presentation_obj_13","@Known Lords",tf_center_justify),
            (position_set_x, pos1, 755),
            (position_set_y, pos1, 600),
            (overlay_set_position, "$g_presentation_obj_13", pos1),
            #Lords relations
            (create_game_button_overlay,"$g_presentation_obj_14","@Courtship",tf_center_justify),
            (position_set_x, pos1, 910),
            (position_set_y, pos1, 600),
            (overlay_set_position, "$g_presentation_obj_14", pos1),
          (try_end),
          #Ships
          (create_game_button_overlay,"$g_presentation_obj_17","@Ships",tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_17", pos1),
        (try_end),
        #lo q hace
        (try_begin),
          ###estadisiticas
          (eq,"$temp",1),
          (assign, ":total_effect", 0),
          #wealth
          (store_troop_gold, ":wealth", "trp_player"),
          (store_div, ":wealth_effect", ":wealth", 200),
          (val_add, ":total_effect", ":wealth_effect"),
          #ruled centers and friendly/enemy centers
          (assign, ":num_towns", 0),
          (assign, ":num_castles", 0),
          (assign, ":num_villages", 0),
          (assign, ":num_friendly_towns", 0),
          (assign, ":num_friendly_villages", 0),
          (assign, ":num_enemy_towns", 0),
          (assign, ":num_enemy_villages", 0),
          (try_for_range, ":center_no", centers_begin, centers_end),
            (party_get_slot, ":type", ":center_no", slot_party_type),
            (try_begin),
              (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
              (try_begin),
                (eq, ":type", spt_town),
                (val_add, ":num_towns", 1),
              (else_try),
                (eq, ":type", spt_castle),
                (val_add, ":num_castles", 1),
              (else_try),
                (val_add, ":num_villages", 1),
              (try_end),
            (try_end),
            (party_get_slot, ":relation", ":center_no", slot_center_player_relation),
            (try_begin),
              (ge, ":relation", 40),
              (try_begin),
                (eq, ":type", spt_town),
                (val_add, ":num_friendly_towns", 1),
              (else_try),
                (eq, ":type", spt_village),
                (val_add, ":num_friendly_villages", 1),
              (try_end),
            (else_try),
              (le, ":relation", -40),
              (try_begin),
                (eq, ":type", spt_town),
                (val_add, ":num_enemy_towns", 1),
              (else_try),
                (eq, ":type", spt_village),
                (val_add, ":num_enemy_villages", 1),
              (try_end),
            (try_end),
          (try_end),
          (store_mul, ":num_towns_effect", ":num_towns", 100),
          (store_mul, ":num_castles_effect", ":num_castles", 50),
          (store_mul, ":num_villages_effect", ":num_villages", 20),
          (store_add, ":num_centers", ":num_towns", ":num_castles"),
          (val_add, ":num_centers", ":num_villages"),
          (store_add, ":ruled_centers_effect", ":num_towns_effect", ":num_castles_effect"),
          (val_add, ":ruled_centers_effect", ":num_villages_effect"),
          (val_add, ":total_effect", ":ruled_centers_effect"),
          (store_mul, ":num_friendly_towns_effect", ":num_friendly_towns", 20),
          (store_mul, ":num_friendly_villages_effect", ":num_friendly_villages", 4),
          (store_add, ":num_friendly_centers", ":num_friendly_towns", ":num_friendly_villages"),
          (store_add, ":friendly_centers_effect", ":num_friendly_towns_effect", ":num_friendly_villages_effect"),
          (val_add, ":total_effect", ":friendly_centers_effect"),
          (store_mul, ":num_enemy_towns_effect", ":num_enemy_towns", -40),
          (store_mul, ":num_enemy_villages_effect", ":num_enemy_villages", -8),
          (store_add, ":num_enemy_centers", ":num_enemy_towns", ":num_enemy_villages"),
          (store_add, ":enemy_centers_effect", ":num_enemy_towns_effect", ":num_enemy_villages_effect"),
          (val_add, ":total_effect", ":enemy_centers_effect"),
          #inventory
          (assign, ":total_item_value", 0),
          (troop_get_inventory_capacity, ":capacity", "trp_player"),
          (try_for_range, ":i_inv", 0, ":capacity"),
            (troop_get_inventory_slot, ":item", "trp_player", ":i_inv"),
            (ge, ":item", 0),
            (store_item_value, ":item_value", ":item"),
            (val_add, ":total_item_value", ":item_value"),
          (try_end),
          (store_div, ":total_item_value_effect", ":total_item_value", 200),
          (val_add, ":total_effect", ":total_item_value_effect"),
          #renown
          (troop_get_slot, ":renown", "trp_player", slot_troop_renown),
          (store_div, ":renown_effect", ":renown", 1),
          (val_add, ":total_effect", ":renown_effect"),
          #enemies and friends
          (assign, ":num_enemies", 0),
          (assign, ":num_friends", 0),
          (try_for_range, ":troop_no", heroes_begin, heroes_end),
            (this_or_next|troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_lady),
            (call_script, "script_troop_get_player_relation", ":troop_no"),
            (assign, ":relation", reg0),
            #(troop_get_slot, ":relation", ":troop_no", slot_troop_player_relation),
            (try_begin),
              (ge, ":relation", 40),
              (val_add, ":num_friends", 1),
            (else_try),
              (le, ":relation", -40),
              (val_add, ":num_enemies", 1),
            (try_end),
          (try_end),
          (store_mul, ":num_friends_effect", ":num_friends", 10),
          (val_add, ":total_effect", ":num_friends_effect"),
          (store_mul, ":num_enemies_effect", ":num_enemies", -10),
          (val_add, ":total_effect", ":num_enemies_effect"),
          #current day
          (store_current_day, ":cur_day"),
          (store_div, ":cur_day_effect", ":cur_day", -1),
          (val_add, ":total_effect", ":cur_day_effect"),
          #g_total_victories
          (store_mul, ":total_victories_effect", "$g_total_victories", 2),
          (val_add, ":total_effect", ":total_victories_effect"),
          #g_total_defeats
          (store_mul, ":total_defeats_effect", "$g_total_defeats", -3),
          (val_add, ":total_effect", ":total_defeats_effect"),
          #g_total_quests_completed
          (store_mul, ":total_quests_completed_effect", "$g_total_quests_completed", 4),
          (val_add, ":total_effect", ":total_quests_completed_effect"),
          #xp
          (troop_get_xp, ":xp", "trp_player"),
          (store_div, ":xp_effect", ":xp", 5000),
          (val_add, ":total_effect", ":xp_effect"),
          #companions joined / departed
          (assign, ":num_companions_joined", 0),
          (assign, ":num_companions_departed", 0),
          (try_for_range, ":troop_no", companions_begin, companions_end),
            (try_begin),
              (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_player_companion),
              (val_add, ":num_companions_joined", 1),
            (else_try),
              (troop_slot_ge, ":troop_no", slot_troop_playerparty_history, 1),
              (val_add, ":num_companions_departed", 1),
            (try_end),
          (try_end),
          (store_div, ":num_companions_joined_effect", ":num_companions_joined", 2),
          (val_add, ":total_effect", ":num_companions_joined_effect"),
          (store_div, ":num_companions_departed_effect", ":num_companions_departed", -4),
          (val_add, ":total_effect", ":num_companions_departed_effect"),
          #difficulty
          (get_average_game_difficulty, ":difficulty"),
          (assign, ":difficulty_effect", ":total_effect"),
          (val_mul, ":total_effect", ":difficulty"),
          (val_div, ":total_effect", 75),
          (val_mul, ":total_effect", ":difficulty"),
          (val_div, ":total_effect", 75),
          (store_sub, ":difficulty_effect", ":total_effect", ":difficulty_effect"),
          
          (assign, reg5, ":cur_day"),
          (store_character_level, reg4, "trp_player"),
          (create_text_overlay, reg1, "@Level: {reg4} ^Days of Adventuring: {reg5}.", tf_center_justify),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 540),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 950),
          (position_set_y, pos1, 950),
          (overlay_set_size, reg1, pos1),
          ##        (overlay_set_color, reg1, 0),
          (create_text_overlay, reg2, "@Effect on Score", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg2, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 490),
          (overlay_set_position, reg2, pos1),
          (assign, reg0, ":num_centers"),
          (create_text_overlay, reg1, "@Settlements Owned by You: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 470),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":ruled_centers_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 470),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":num_friendly_centers"),
          (create_text_overlay, reg1, "@Friendly Settlements: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 450),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":friendly_centers_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 450),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":num_enemy_centers"),
          (create_text_overlay, reg1, "@Hostile Settlements: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 430),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":enemy_centers_effect"),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 430),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (lt, reg0, 0),
            (overlay_set_color, reg1, 0xE12126), #red
          (try_end),
          
          (assign, reg0, ":num_friends"),
          (create_text_overlay, reg1, "@Friendly Lords: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 410),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":num_friends_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 410),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":num_enemies"),
          (create_text_overlay, reg1, "@Hostile Lords: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 390),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":num_enemies_effect"),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 390),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (lt, reg0, 0),
            (overlay_set_color, reg1, 0xE12126), #red
          (try_end),
          
          (assign, reg0, "$g_total_victories"),
          (create_text_overlay, reg1, "@Victories: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 370),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":total_victories_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 370),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, "$g_total_defeats"),
          (create_text_overlay, reg1, "@Defeats: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 350),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":total_defeats_effect"),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 350),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (lt, reg0, 0),
            (overlay_set_color, reg1, 0xE12126), #red
          (try_end),
          
          (assign, reg0, "$g_total_quests_completed"),
          (create_text_overlay, reg1, "@Quests Completed: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 330),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":total_quests_completed_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 330),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":num_companions_joined"),
          (create_text_overlay, reg1, "@Companions Found: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 310),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":num_companions_joined_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 310),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":num_companions_departed"),
          (create_text_overlay, reg1, "@Companions Lost/Departed: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 290),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":num_companions_departed_effect"),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 290),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (lt, reg0, 0),
            (overlay_set_color, reg1, 0xE12126), #red
          (try_end),
          
          (assign, reg0, ":wealth"),
          (create_text_overlay, reg1, "@Wealth: {reg0} peningas", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 270),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":wealth_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 270),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":total_item_value"),
          (create_text_overlay, reg1, "@Inventory: {reg0} peningas", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 250),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":total_item_value_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 250),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":renown"),
          (create_text_overlay, reg1, "@Renown: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 230),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":renown_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 230),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":xp"),
          (create_text_overlay, reg1, "@Experience: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 210),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":xp_effect"),
          (create_text_overlay, reg1, "@{!}{reg0?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 210),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (try_end),
          
          (assign, reg0, ":cur_day"),
          (create_text_overlay, reg1, "@Days Passed: {reg0}", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 190),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":cur_day_effect"),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 190),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (lt, reg0, 0),
            (overlay_set_color, reg1, 0xE12126), #red
          (try_end),
          
          (assign, reg0, ":difficulty"),
          (create_text_overlay, reg1, "@Difficulty: {reg0}%", 0),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 170),
          (overlay_set_position, reg1, pos1),
          (assign, reg0, ":difficulty_effect"),
          (assign, reg3, reg0),
          (val_max, reg3, 0),
          (create_text_overlay, reg1, "@{!}{reg3?+:}{reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 170),
          (overlay_set_position, reg1, pos1),
          (try_begin),
            (gt, reg0, 0),
            (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
          (else_try),
            (lt, reg0, 0),
            (overlay_set_color, reg1, 0xE12126), #red
          (try_end),
          
          (assign, reg0, ":total_effect"),
          (create_text_overlay, reg1, "@TOTAL SCORE: {reg0}", tf_center_justify),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 120),
          (overlay_set_position, reg1, pos1),
        (else_try),
          (eq,"$g_presentations_next_presentation",-1),
          (call_script, "script_texto_journal"),
          (create_text_overlay,"$g_presentation_obj_15",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_15",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_15", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_15", pos1),
        (else_try),
          (ge,"$g_presentations_next_presentation",0),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_16", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_16", pos1),
          ##
          ##			(create_game_button_overlay,"$g_presentation_obj_10",s5,tf_center_justify),
          ##			(position_set_x,pos1,870),
          ##			(position_set_y,pos1,25),
          ##			(overlay_set_position,"$g_presentation_obj_10",pos1),
        (else_try),
          (eq,"$g_presentations_next_presentation",-2),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_left_align),
          (position_set_x,pos1,600),
          (position_set_y,pos1,130),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
        (try_end),
    ]),
    
    (ti_on_presentation_run,
      [
    ]),
    #
    
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (try_begin),
          (eq,"$g_presentation_obj_1",":object"), #exit
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
        (else_try),
          (eq,"$g_presentation_obj_2",":object"), #factions kingdoms report
          (str_clear,s1),
          
          (try_begin),
            (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_active),
            (troop_get_slot, ":spouse", "trp_player", slot_troop_spouse),
            (this_or_next|faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
            (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, ":spouse"), #wife can change kingdom name
            
            (assign,"$temp",0),
            (assign,"$g_presentations_next_presentation",-1),
            (assign, "$factionorders_type", factionorders_no),
            (start_presentation, "prsnt_faction_screen_main"),
          (else_try),
            (assign,"$temp",0),
            (display_log_message, "@You need to be the ruler of your faction in order to access your kingdom control panel.", 0xFF0000), #chief anadido
            ###           (display_message, "@Entering enemy territory, your party moves more warily.",0xFFFFAAAA), #chief anadido
            (assign,"$g_presentations_next_presentation",-1),
            (start_presentation,"prsnt_character_screen_main"),
          (try_end),
          
        (else_try),
          (eq,"$g_presentation_obj_3",":object"), #story
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_historia_character"),
          (start_presentation,"prsnt_character_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_4",":object"), #Skills
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (change_screen_view_character),
          #   (presentation_set_duration,0),
        (else_try),
          (eq,"$g_presentation_obj_5",":object"), #Wounds report
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_store_wound_report"),
          (str_store_string, s1, "@^^^^Wounds Information:^^{s3}^^----------^^{s4}^^----------^^{s5}^^----------^^{s6}"),
          (start_presentation,"prsnt_character_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_6",":object"), # Quest
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (change_screen_notes, 4),
          #  (presentation_set_duration,0),
        (else_try),
          (eq,"$g_presentation_obj_7",":object"), # Party Info
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_partysize_morale"),
          (start_presentation,"prsnt_character_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_8",":object"), # Relations
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_kigdom_info"),
          (assign,"$temp",2),
          (start_presentation,"prsnt_character_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_9",":object"), # Weekly Budget
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (assign, "$g_apply_budget_report_to_gold", 0),
          #(presentation_set_duration,0),
          (start_presentation, "prsnt_budget_report"),
        (else_try),
          (eq,"$g_presentation_obj_10",":object"), # Stadistic
          (str_clear,s1),
          (assign,"$temp",1),
          #(presentation_set_duration,0),
          # (start_presentation, "prsnt_estadisticas_player"),
          (start_presentation,"prsnt_character_screen_main"),
          
        (else_try),
          (eq, "$g_presentation_open_set_goal", ":object"),
          (call_script, "script_button_open_set_goal_prsnt"),
          
        (else_try),
          (eq,"$g_presentation_obj_11",":object"), # Companions missions
          (str_clear,s1),
          (assign,"$temp",4),  # to create companions prsnt button
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_companions_report"),
          (start_presentation,"prsnt_character_screen_main"),
          
        (else_try),
          (eq, "$g_presentation_companions", ":object"),
          (call_script, "script_button_open_companions_prsnt"),
          
        (else_try),
          (eq,"$g_presentation_obj_12",":object"), # Factions relations
          (str_clear,s1),
          #(assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_kigdomsr_info"),
          #(assign,"$temp",2),
          (start_presentation,"prsnt_character_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_13",":object"), # lords relations
          (str_clear,s1),
          #(assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_lords_relation"),
          #(assign,"$temp",2),
          (start_presentation,"prsnt_character_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_14",":object"), # courtship relations
          (str_clear,s1),
          #(assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_courtship_relation"),
          #(assign,"$temp",2),
          (start_presentation,"prsnt_character_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_17",":object"), # ships VC-1905
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_ships"),
          (start_presentation,"prsnt_character_screen_main"),
        (try_end),
        
    ]),
]),

#Camp screen
("camp_screen_main",0,mesh_load_window,[
    (ti_on_presentation_load,
      [(presentation_set_duration,999999),
        (set_fixed_point_multiplier, 1000),
        
        (str_clear,s2),
        (str_clear,s3),
        (str_clear,s4),
        (str_clear,s5),
        (str_clear,s6),
        (str_clear,s7),
        (str_clear,s8),
        (str_clear,s9),
        
        (str_clear,s10),
        (str_clear,s11),
        (str_clear,s12),
        (str_clear,s13),
        (str_clear,s14),
        (str_clear,s15),
        (str_clear,s16),
        (str_clear,s17),
        (str_clear,s18),
        
        (assign, "$g_presentation_obj_17", -1),
        (assign, "$g_presentation_obj_18", -1),
        (assign, "$g_presentation_obj_19", -1),
        
        (create_game_button_overlay, "$g_presentation_obj_1", "@Resume Traveling"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###shadow
        (create_text_overlay, reg1, "@Your Camp", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xD5C7B6), #Beige
        (position_set_x, pos1, 248),
        (position_set_y, pos1, 548),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 230),
        (overlay_set_area_size, reg1, pos1),
        ####
        (create_text_overlay, reg1, "@Your Camp", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xFFFFFF), #White se ve bien
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        
        (create_text_overlay, reg1, "@You stop to rest.^Here you can manage your camp's resources.", tf_center_justify),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 510),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        
        #Camp options #minimo X hombres necesarios.
        (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
        (assign, ":num_men", 0),
        (try_for_range, ":i_stack", 0, ":num_stacks"),
          (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
          (val_add, ":num_men", ":stack_size"),
        (try_end),
        
        (create_text_overlay, reg1, "@Send Scouts:", 0),
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 440),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@^Sending scouts ahead of the army will increase your chances of spotting enemies. However, these men always move very exposed, so their life expectancy is low.", tf_scrollable),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 70),
        (overlay_set_area_size, reg1, pos1),
        
        (try_begin),
          (lt, ":num_men", 30), # se muestra si el player tiene por lo menos 30 hombres
          (create_text_overlay, reg1, "@Thirty men are needed.", 0),
          (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
          #(overlay_set_color, reg1, 0xDDDDDD),
          (position_set_x, pos1, 280),
          (position_set_y, pos1, 440),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
        (else_try),
          (create_check_box_overlay, "$g_presentation_obj_17", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 440),
          (overlay_set_position, "$g_presentation_obj_17", pos1),
          (overlay_set_val, "$g_presentation_obj_17", "$send_scouts"),
        (try_end),
        
        (create_text_overlay, reg1, "@Send Foragers:", 0),
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 325),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@^Send men to forage as your army travels. They return with extra food every half day.", tf_scrollable),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 255),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 70),
        (overlay_set_area_size, reg1, pos1),
        
        (try_begin),
          (lt, ":num_men", 40), # se muestra si el player tiene por lo menos 30 hombres
          (create_text_overlay, reg1, "@Forty men are needed.", 0),
          (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
          #(overlay_set_color, reg1, 0xDDDDDD),
          (position_set_x, pos1, 280),
          (position_set_y, pos1, 325),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
        (else_try),
          (create_check_box_overlay, "$g_presentation_obj_18", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 325),
          (overlay_set_position, "$g_presentation_obj_18", pos1),
          (overlay_set_val, "$g_presentation_obj_18", "$foragers_a"),
        (try_end),
        
        (create_text_overlay, reg1, "@Fortify Camp:", 0),
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 210),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@^Fortify your camp with basic defences. The men engaged in this difficult work will need a reward of 200 peningas, or you could face troubles.", tf_scrollable),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 140),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 70),
        (overlay_set_area_size, reg1, pos1),
        
        (try_begin),
          (lt, ":num_men", 60), # se muestra si el player tiene por lo menos 60 hombres
          (create_text_overlay, reg1, "@Sixty men are needed.", 0),
          (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
          #(overlay_set_color, reg1, 0xDDDDDD),
          (position_set_x, pos1, 280),
          (position_set_y, pos1, 210),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
        (else_try),
          (create_check_box_overlay, "$g_presentation_obj_19", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 210),
          (overlay_set_position, "$g_presentation_obj_19", pos1),
          (overlay_set_val, "$g_presentation_obj_19", "$fortified_camp"),
        (try_end),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        #
        (try_begin),
          (ge,"$g_presentations_next_presentation",-1),
          #Refuge
          (create_game_button_overlay,"$g_presentation_obj_3","@Your Refuge",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_3", pos1),
          #Wait Here
          (create_game_button_overlay,"$g_presentation_obj_4","@Wait Here",tf_center_justify),
          (position_set_x, pos1, 180),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_4", pos1),
          #Troop tree info
          (create_game_button_overlay,"$g_presentation_obj_5","@Troop Tree",tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_5", pos1),
          #Second Outfit
          (create_game_button_overlay,"$g_presentation_obj_6","@Second Outfit",tf_center_justify),
          (position_set_x, pos1, 180),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_6", pos1),
          #Read Book
          (create_game_button_overlay,"$g_presentation_obj_7","@Read Book",tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_7", pos1),
          # Retire action
          (create_game_button_overlay,"$g_presentation_obj_8","@Retire",tf_center_justify),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_8", pos1),
          #Recruit prisoners
          (create_game_button_overlay,"$g_presentation_obj_9","@Recruit Prisoners",tf_center_justify),
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_9", pos1),
          #Pick faction color
          (create_game_button_overlay,"$g_presentation_obj_10","@Map Colour",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_10", pos1),
          #Take a action
          (create_game_button_overlay,"$g_presentation_obj_12","@Options",tf_center_justify),
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_12", pos1),
          # Followers
          (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
          (assign, ":num_men", 0),
          (try_for_range, ":i_stack", 0, ":num_stacks"),
            (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
            (val_add, ":num_men", ":stack_size"),
          (try_end),
          
          (try_begin), #
            (eq,"$followers_on",1),
            (ge, ":num_men", 290), #player has less than 200 men or no access to followers
            (create_game_button_overlay,"$g_presentation_obj_14","@Followers' Camp",tf_center_justify),
            (position_set_x, pos1, 820),
            (position_set_y, pos1, 700),
            (overlay_set_position, "$g_presentation_obj_14", pos1),
          (try_end),
        (try_end),
        ###
        (try_begin),
          (eq,"$g_presentations_next_presentation",-1),
          (call_script, "script_texto_global_camp_info"),
          (create_text_overlay,"$g_presentation_obj_15",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_15",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_15", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_15", pos1),
          #Visit fortified camp added visit camp normal too.
          #(eq, "$fortified_camp", 1), #fortified ok
          # camp visit
          # (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
          # (assign, ":num_men", 0),
          # (try_for_range, ":i_stack", 0, ":num_stacks"),
          # (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
          # (val_add, ":num_men", ":stack_size"),
          # (try_end),
          
          (try_begin), #
            (ge, ":num_men", 20), #player has over 20 men or no access to camp
            (create_game_button_overlay,"$g_presentation_obj_13","@Visit Camp",tf_center_justify),
          (else_try),
            (create_game_button_overlay,"$g_presentation_obj_13","@Check Location",tf_center_justify),
          (try_end),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 25),
          (overlay_set_position, "$g_presentation_obj_13", pos1),
          
        (else_try),
          (ge,"$g_presentations_next_presentation",0),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_16", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_16", pos1),
        (else_try),
          (eq,"$g_presentations_next_presentation",-2),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_left_align),
          (position_set_x,pos1,600),
          (position_set_y,pos1,130),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq,"$g_presentation_obj_1",":object"), #Exit
          (str_clear,s1),
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          #(assign, "$fortified_camp", 0),
          (assign,"$temp",6),
          (change_screen_return),
        (else_try),
          (eq,"$g_presentation_obj_3",":object"), #Refuge
          (str_clear,s1), #temp 3 activado desde script
          (assign, ":continue", 0),
          
          (try_for_range, ":center_no", centers_begin, centers_end),
            (store_distance_to_party_from_party, ":dist", "p_main_party", ":center_no"),
            (lt, ":dist", 8),
            (assign, ":continue", 1),
          (try_end),
          
          (store_troop_gold, ":gold_amount", "trp_player"),
          (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
          (assign, ":num_men", 0),
          (try_for_range, ":i_stack", 0, ":num_stacks"),
            (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
            (val_add, ":num_men", ":stack_size"),
          (try_end),
          
          (try_begin),
            (eq, ":continue", 1), #too near
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$temp",0),
            (start_presentation,"prsnt_camp_screen_main"),
            (display_message,"@You cannot build your Refuge so close to a settlement.",0xFFFFAAAA), #chief anadido
          (else_try),
            (this_or_next|eq, "$lair_on", 1),
            (this_or_next|lt, ":num_men", 30), # se muestra si el player tiene por lo menos 200 hombres
            (lt, ":gold_amount", 1000),
            
            (val_add,"$g_presentations_next_presentation",1),
            (call_script, "script_texto_refuge_construir"),
            (start_presentation,"prsnt_camp_screen_main"),
          (else_try),
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$temp",0),
            (jump_to_menu, "mnu_build_refuge_new"),
          (try_end),
        (else_try),
          (eq,"$g_presentation_obj_4",":object"), #Wait here
          (str_clear,s1),
          (store_random_in_range, ":random", 0, 100),
          (assign, ":continue", 0),
          (try_begin), #options to conversation camp companions
            (ge, ":random", 80), #20%
            (call_script, "script_companions_camp_conversation"),
            (try_for_range,":current_npc",companions_begin,companions_end),
              # (ge, ":random", 80), #20%
              (main_party_has_troop,":current_npc"),
              (troop_slot_eq,":current_npc",slot_troop_companion_camp_conversation,1),
              (assign, ":continue", 1),
            (try_end),
          (try_end),
          
          (assign, ":nearby_yes", 0),
          
          (try_for_range, ":center_no", centers_begin, centers_end),
            (store_distance_to_party_from_party, ":dist", "p_main_party", ":center_no"),
            (lt, ":dist", 5),
            (assign, ":nearby_yes", 1),
          (try_end),
          
          (try_begin), #too nearby to settlement no let camping
            (eq, ":nearby_yes", 1),
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$temp",0),
            (start_presentation,"prsnt_camp_screen_main"),
            (display_message,"@These too close to a settlement for camping.",0xFFFFAAAA), #chief anadido
          (else_try),#options to conversation camp companions
            (eq, ":continue", 1),
            (assign,"$g_presentations_next_presentation",-1),
            
            (try_begin),
              (eq, "$fortified_camp", 1), #fortified ok
              (assign,":scene","scn_player_camp_fortified"), #
            (else_try),
              (assign,":scene","scn_player_camp"), #
            (try_end),
            
            (modify_visitors_at_site,":scene"),
            (reset_visitors, 0),
            (set_visitor,0,"trp_player"),
            
            (assign,":count",2),
            (try_for_range,":current_npc",companions_begin,companions_end),
              (try_begin),
                (le,":count",17),
                (main_party_has_troop,":current_npc"),
                (set_visitor,":count",":current_npc"),
              (try_end),
              (val_add,":count",1),
            (try_end),
            
            
            (assign, ":party", "p_main_party"),
            (assign,":count",18),
            (party_get_num_companion_stacks, ":num_stacks", ":party"), #1 man each troop type
            (try_for_range, ":troop_iterator", 0, ":num_stacks"),
              (party_stack_get_troop_id, ":cur_troop_id", ":party", ":troop_iterator"),
              (neg|troop_is_hero, ":cur_troop_id"),##
              (assign, ":total_valor", 0),
              (call_script, "script_count_troops_inparty", ":party", ":cur_troop_id"),
              (val_add, ":total_valor", reg0),
              
              (try_begin),
                (ge,":total_valor",4),
                (assign,":total_valor",4),
              (try_end),
              
              (try_begin),
                (le,":count",50),
                (set_visitors,":count",":cur_troop_id", ":total_valor"),
              (try_end),
              (val_add,":count",1),
            (try_end),
            
            
            (set_jump_mission,"mt_fortified_playercamp"),
            (jump_to_scene,":scene"),
            (change_screen_mission),
            # (try_end),
            ###
          (else_try),
            #new menu
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$temp",0),
            (jump_to_menu, "mnu_camp_action_rest"),
            #old
            ##			(assign,"$temp",4),
            ##			(val_add,"$g_presentations_next_presentation",1),
            ##                        (call_script, "script_texto_wait_here"),
            ##			(start_presentation,"prsnt_camp_screen_main"),
          (try_end),
          
          ##			(assign,"$temp",4),
          ##			(val_add,"$g_presentations_next_presentation",1),
          ##                        (call_script, "script_texto_wait_here"),
          ##			(start_presentation,"prsnt_camp_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_5",":object"), #Troop Tree
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (assign, "$g_presentation_obj_sliders_1_val", 0),
          (start_presentation, "prsnt_troop_tree"),
        (else_try),
          (eq,"$g_presentation_obj_6",":object"), # Second Outfit
          (call_script, "script_copy_player_troop"),
          (change_screen_equip_other, "trp_pseudo_troop_end"),
          
        (else_try),
          (eq,"$g_presentation_obj_7",":object"), # Select Book to Read
          (str_clear,s1),
          
          (try_begin),
            (eq, "$sabe_leer", 1),
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$temp",0),
            (jump_to_menu, "mnu_camp_action_read_book"),
          (else_try),
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$temp",0),
            (start_presentation,"prsnt_camp_screen_main"),
            (display_message,"@You cannot read. You can learn to do so at a monastery.",0xFFFFAAAA), #chief anadido
          (try_end),
          
        (else_try),
          (eq,"$g_presentation_obj_8",":object"), #Retire from adventuring
          (str_clear,s1),
          (assign,"$g_presentations_next_presentation",-1),
          (assign,"$temp",0),
          (jump_to_menu, "mnu_retirement_verify"),
        (else_try),
          (eq,"$g_presentation_obj_9",":object"), #Recruit prisoners
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (try_begin),
            (party_get_morale,":cur_morale","p_main_party"),
            (lt,":cur_morale",40),
            (start_presentation,"prsnt_camp_screen_main"),
            (display_message,"@Your army morale is low!",0xFFFFAAAA), #chief anadido
          (else_try),
            (troops_can_join, 1),
            (store_current_hours, ":cur_time"),
            (val_sub, ":cur_time", 24),
            (gt, ":cur_time", "$g_prisoner_recruit_last_time"),
            (try_begin),
              (gt, "$g_prisoner_recruit_last_time", 0),
              (assign, "$g_prisoner_recruit_troop_id", 0),
              (assign, "$g_prisoner_recruit_size", 0),
              (assign, "$g_prisoner_recruit_last_time", 0),
            (try_end),
            (jump_to_menu, "mnu_camp_recruit_prisoners"),
          (else_try),
            (start_presentation,"prsnt_camp_screen_main"),
            (display_message,"@No one is interested this time.",0xFFFFAAAA), #chief anadido
          (try_end),
        (else_try),
          (eq,"$g_presentation_obj_10",":object"), #Map Colour
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (start_presentation, "prsnt_colour_kingdom"),
        (else_try),
          (eq,"$g_presentation_obj_12",":object"), #take a action (options)
          (str_clear,s1),
          (assign, reg60, 0),
          (assign,"$g_presentations_next_presentation", -1),
          (start_presentation,"prsnt_vc_options"),
          (assign,"$temp",0),
          
          # (assign,"$g_presentations_next_presentation",-1),
          # (assign,"$temp",0),
          # (jump_to_menu, "mnu_camp_action"),
          
        (else_try),
          (eq,"$g_presentation_obj_13",":object"), #Visit Camp
          (store_party_size_wo_prisoners, ":party_size", "p_main_party"),
          (lt, ":party_size", 20),
          (str_clear,s1),
          (assign,"$g_presentations_next_presentation",-1),
          (assign,"$temp",0),
          
          (store_random_in_range, ":rand", 0, 15),
          (try_begin),
            (eq, ":rand", 0),
            (eq, "$hunted_today", 0),
            (set_spawn_radius, 1),
            (spawn_around_party, "p_main_party", "pt_boar_herd"),
            (assign, "$auto_enter_town", reg0),
            (presentation_set_duration, 0),
            (jump_to_menu, "mnu_auto_return_to_map"),
          (else_try),
            (set_jump_mission,"mt_small_playercamp"),
            (set_jump_entry, 0),
            (call_script, "script_setup_random_scene"),
            (change_screen_mission),
          (end_try),
          
        (else_try),
          (eq,"$g_presentation_obj_13",":object"), #Visit Camp
          (str_clear,s1),
          (assign,"$g_presentations_next_presentation",-1),
          (assign,"$temp",0),
          
          (try_begin), #player lair
            (eq, "$fortified_camp", 1), #fortified ok
            (assign, ":scene_to_use", "scn_player_camp_fortified"),
          (else_try),
            (assign, ":scene_to_use", "scn_player_camp"),#permanent camp
          (try_end),
          
          (modify_visitors_at_site,":scene_to_use"),
          (reset_visitors, 0),
          (set_visitor,0,"trp_player"),
          
          (assign,":count",2),
          (try_for_range,":current_npc",companions_begin,companions_end),
            (try_begin),
              (le,":count",16),
              (main_party_has_troop,":current_npc"),
              (set_visitor,":count",":current_npc"),
            (try_end),
            (val_add,":count",1),
          (try_end),
          
          
          (assign, ":party", "p_main_party"),
          (assign,":count",17),
          (party_get_num_companion_stacks, ":num_stacks", ":party"), #1 man each troop type
          (try_for_range, ":troop_iterator", 0, ":num_stacks"),
            (party_stack_get_troop_id, ":cur_troop_id", ":party", ":troop_iterator"),
            (neg|troop_is_hero, ":cur_troop_id"),##
            (assign, ":total_valor", 0),
            (call_script, "script_count_troops_inparty", ":party", ":cur_troop_id"),
            (val_add, ":total_valor", reg0),
            
            (try_begin),
              (ge,":total_valor",4),
              (assign,":total_valor",4),
            (try_end),
            
            (try_begin),
              (le,":count",50),
              (set_visitors,":count",":cur_troop_id", ":total_valor"),
            (try_end),
            (val_add,":count",1),
          (try_end),
          
          (set_jump_mission,"mt_fortified_playercamp"),
          (jump_to_scene,":scene_to_use"),
          (change_screen_mission),
          
        (else_try),
          (eq,"$g_presentation_obj_14",":object"), #followers
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (start_presentation, "prsnt_followers_screen_camp"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_17"),
          (assign, "$send_scouts", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_18"),
          (assign, "$foragers_a", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_19"),
          (assign, "$fortified_camp", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_20"),	#VC-2111
          (assign, "$dog_companion", 0),
        (try_end),
        
    ]),
]),

#######Siege camp screen
("camp_screen_siege",0,mesh_load_window,[
    (ti_on_presentation_load,
      [(presentation_set_duration,999999),
        (set_fixed_point_multiplier, 1000),
        
        (str_clear,s2),
        (str_clear,s3),
        (str_clear,s4),
        (str_clear,s5),
        (str_clear,s6),
        (str_clear,s7),
        (str_clear,s8),
        (str_clear,s9),
        
        (str_clear,s10),
        (str_clear,s11),
        (str_clear,s12),
        (str_clear,s13),
        (str_clear,s14),
        (str_clear,s15),
        (str_clear,s16),
        (str_clear,s17),
        (str_clear,s18),
        
        (assign, "$g_presentation_obj_18", -1),
        (assign, "$g_presentation_obj_19", -1),
        
        (create_game_button_overlay, "$g_presentation_obj_1", "@Back to Siege"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###shadow
        (create_text_overlay, reg1, "@Your Siege Camp", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xD5C7B6), #Beige
        (position_set_x, pos1, 248),
        (position_set_y, pos1, 548),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 230),
        (overlay_set_area_size, reg1, pos1),
        ####
        (create_text_overlay, reg1, "@Your Siege Camp", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xFFFFFF), #White se ve bien
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        
        (create_text_overlay, reg1, "@You are besieging the enemy.^Here you can manage your camp's resources.", tf_center_justify),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 510),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        (create_text_overlay, reg1, "@Send Foragers:", 0),
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 440),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@^Send men to forage nearby. They return with extra food every half day.", tf_scrollable),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 70),
        (overlay_set_area_size, reg1, pos1),
        
        (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
        (assign, ":num_men", 0),
        (try_for_range, ":i_stack", 0, ":num_stacks"),
          (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
          (val_add, ":num_men", ":stack_size"),
        (try_end),
        (try_begin),
          (lt, ":num_men", 40), # se muestra si el player tiene por lo menos 40 hombres
          (create_text_overlay, reg1, "@Forty men are needed.", 0),
          (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
          #(overlay_set_color, reg1, 0xDDDDDD),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 440),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
        (else_try),
          (create_check_box_overlay, "$g_presentation_obj_18", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 440),
          (overlay_set_position, "$g_presentation_obj_18", pos1),
          (overlay_set_val, "$g_presentation_obj_18", "$foragers_a"),
        (try_end),
        
        (create_text_overlay, reg1, "@Fortify Camp:", 0),
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 325),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@^Fortify your camp with basic defences. The men engaged in this difficult work will need a reward of 200 peningas, or you could face troubles.", tf_scrollable),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 255),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 70),
        (overlay_set_area_size, reg1, pos1),
        
        (try_begin),
          (lt, ":num_men", 60), # se muestra si el player tiene por lo menos 60 hombres
          (create_text_overlay, reg1, "@Sixty men are needed.", 0),
          (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
          #(overlay_set_color, reg1, 0xDDDDDD),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 325),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
        (else_try),
          (create_check_box_overlay, "$g_presentation_obj_19", "mesh_checkbox_off", "mesh_checkbox_on"),
          (position_set_x, pos1, 300),
          (position_set_y, pos1, 325),
          (overlay_set_position, "$g_presentation_obj_19", pos1),
          (overlay_set_val, "$g_presentation_obj_19", "$fortified_camp"),
        (try_end),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        #
        (try_begin),
          (ge,"$g_presentations_next_presentation",-1),
          #Troop tree info
          (create_game_button_overlay,"$g_presentation_obj_5","@Troop Tree",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_5", pos1),
          #Recruit prisoners
          (create_game_button_overlay,"$g_presentation_obj_9","@Recruit Prisoners",tf_center_justify),
          ##			(position_set_x, pos1, 500),
          ##			(position_set_y, pos1, 700),
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_9", pos1),
          ###Take a action
          ##			(create_game_button_overlay,"$g_presentation_obj_12","@Options",tf_center_justify),
          ##			(position_set_x, pos1, 340),
          ##			(position_set_y, pos1, 700),
          ##			(overlay_set_position, "$g_presentation_obj_12", pos1),
          # Followers
          (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
          (assign, ":num_men", 0),
          (try_for_range, ":i_stack", 0, ":num_stacks"),
            (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
            (val_add, ":num_men", ":stack_size"),
          (try_end),
          
          (try_begin), #
            (eq,"$followers_on",1),
            (ge, ":num_men", 280), #player has less than 200 men or no access to followers
            (create_game_button_overlay,"$g_presentation_obj_14","@Followers' Camp",tf_center_justify),
            (position_set_x, pos1, 500),
            (position_set_y, pos1, 700),
            ##			(position_set_x, pos1, 820),
            ##			(position_set_y, pos1, 700),
            (overlay_set_position, "$g_presentation_obj_14", pos1),
          (try_end),
        (try_end),
        ###
        (try_begin),
          (eq,"$g_presentations_next_presentation",-1),
          (call_script, "script_texto_global_camp_info"),
          (create_text_overlay,"$g_presentation_obj_15",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_15",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_15", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_15", pos1),
          #Visit fortified camp
          (eq, "$fortified_camp", 1), #fortified ok
          (create_game_button_overlay,"$g_presentation_obj_13","@Visit Camp",tf_center_justify),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 25),
          (overlay_set_position, "$g_presentation_obj_13", pos1),
        (else_try),
          (ge,"$g_presentations_next_presentation",0),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_16", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_16", pos1),
        (else_try),
          (eq,"$g_presentations_next_presentation",-2),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_left_align),
          (position_set_x,pos1,600),
          (position_set_y,pos1,130),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
        (try_end),
        
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        
        
        (try_begin),
          (eq,"$g_presentation_obj_1",":object"), #Exit
          (str_clear,s1),
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          #(assign, "$fortified_camp", 0),
          #(assign,"$temp",6),
          (change_screen_return),
        (else_try),
          (eq,"$g_presentation_obj_5",":object"), #Troop Tree
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (assign, "$g_presentation_obj_sliders_1_val", 0),
          (start_presentation, "prsnt_troop_tree"),
        (else_try),
          (eq,"$g_presentation_obj_9",":object"), #Recruit prisoners
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (try_begin),
            (troops_can_join, 1),
            (store_current_hours, ":cur_time"),
            (val_sub, ":cur_time", 24),
            (gt, ":cur_time", "$g_prisoner_recruit_last_time"),
            (try_begin),
              (gt, "$g_prisoner_recruit_last_time", 0),
              (assign, "$g_prisoner_recruit_troop_id", 0),
              (assign, "$g_prisoner_recruit_size", 0),
              (assign, "$g_prisoner_recruit_last_time", 0),
            (try_end),
            (jump_to_menu, "mnu_camp_recruit_prisoners"),
          (else_try),
            (start_presentation,"prsnt_camp_screen_siege"),
            (display_message,"@No one is interested this time.",0xFFFFAAAA), #chief anadido
          (try_end),
          ##		(else_try),
          ##			(eq,"$g_presentation_obj_12",":object"), #take a action
          ##                         (str_clear,s1),
          ##			(assign,"$g_presentations_next_presentation",-1),
          ##			(start_presentation,"prsnt_vc_options"),
          ##			(assign,"$temp",0),
          ##                     #   (jump_to_menu, "mnu_camp_action"),
        (else_try),
          (eq,"$g_presentation_obj_13",":object"), #Visit Camp
          (str_clear,s1),
          (assign,"$g_presentations_next_presentation",-1),
          (assign,"$temp",0),
          
          #	(set_jump_mission,"mt_fortified_playercamp"),
          (assign, ":scene_to_use", "scn_player_camp_fortified"),
          (modify_visitors_at_site,":scene_to_use"),
          (reset_visitors, 0),
          (set_visitor,0,"trp_player"),
          
          (assign,":count",2),
          (try_for_range,":current_npc",companions_begin,companions_end),
            (try_begin),
              (le,":count",16),
              (main_party_has_troop,":current_npc"),
              (set_visitor,":count",":current_npc"),
            (try_end),
            (val_add,":count",1),
          (try_end),
          
          
          (assign, ":party", "p_main_party"),
          (assign,":count",17),
          (party_get_num_companion_stacks, ":num_stacks", ":party"), #1 man each troop type
          (try_for_range, ":troop_iterator", 0, ":num_stacks"),
            (party_stack_get_troop_id, ":cur_troop_id", ":party", ":troop_iterator"),
            (neg|troop_is_hero, ":cur_troop_id"),##
            (assign, ":total_valor", 0),
            (call_script, "script_count_troops_inparty", ":party", ":cur_troop_id"),
            (val_add, ":total_valor", reg0),
            
            (try_begin),
              (ge,":total_valor",4),
              (assign,":total_valor",4),
            (try_end),
            
            (try_begin),
              (le,":count",50),
              (set_visitors,":count",":cur_troop_id", ":total_valor"),
            (try_end),
            (val_add,":count",1),
          (try_end),
          
          (set_jump_mission,"mt_fortified_playercamp"),
          (jump_to_scene,":scene_to_use"),
          (change_screen_mission),
        (else_try),
          (eq,"$g_presentation_obj_14",":object"), #followers
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (start_presentation, "prsnt_followers_screen_camp"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_18"),
          (assign, "$foragers_a", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_19"),
          (assign, "$fortified_camp", ":value"),
        (try_end),
        
    ]),
]),
############

#Camp screen camp sea

("camp_screen_sea",0,mesh_load_window,[
    (ti_on_presentation_load,
      [(presentation_set_duration,999999),
        (set_fixed_point_multiplier, 1000),
        
        (str_clear,s2),
        (str_clear,s3),
        (str_clear,s4),
        (str_clear,s5),
        (str_clear,s6),
        (str_clear,s7),
        (str_clear,s8),
        (str_clear,s9),
        
        (str_clear,s10),
        (str_clear,s11),
        (str_clear,s12),
        (str_clear,s13),
        (str_clear,s14),
        (str_clear,s15),
        (str_clear,s16),
        (str_clear,s17),
        (str_clear,s18),
        
        (assign, "$g_presentation_obj_1", -1),
        (assign, "$g_presentation_obj_3", -1),
        (assign, "$g_presentation_obj_5", -1),
        (assign, "$g_presentation_obj_7", -1),
        (assign, "$g_presentation_obj_8", -1),
        (assign, "$g_presentation_obj_9", -1),
        (assign, "$g_presentation_obj_12", -1),
        (assign, "$g_presentation_obj_13", -1),
        
        (create_game_button_overlay, "$g_presentation_obj_1", "@Resume Traveling"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###shadow
        (create_text_overlay, reg1, "@Your Sea Camp", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xD5C7B6), #Beige
        (position_set_x, pos1, 248),
        (position_set_y, pos1, 548),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 230),
        (overlay_set_area_size, reg1, pos1),
        ####
        (create_text_overlay, reg1, "@Your Sea Camp", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xFFFFFF), #White se ve bien
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        
        (create_text_overlay, reg1, "@The ship is at the mercy of the wind when you stop to rest.^Here you can manage your camp's resources.", tf_center_justify),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        #New: Weather report
        (try_begin),
          (le, "$beaufort", 0),
          (str_store_string, s7, "@Calm^^The sails, like the sea, are flat."),
        (else_try),
          (le, "$beaufort", 3),
          (str_store_string, s7, "@Light breeze^^On the sea, you notice some small wavelets.^The sails swell a little."),
        (else_try),
          (le, "$beaufort", 4),
          (str_store_string, s7, "@Moderate breeze^^Small waves with breaking crests are rolling on the sea.^The sails fill with wind."),
        (else_try),
          (le, "$beaufort", 6),
          (str_store_string, s7, "@Strong breeze^^Moderate waves begin to form larger ones.^The sails are swollen tight and will need to be reefed soon."),
        (else_try),
          (le, "$beaufort", 7),
          (str_store_string, s7, "@High wind^^There are many breaking waves visible. The sails are reefed.^There is some chance now that ships will be damaged."),
        (else_try),
          (le, "$beaufort", 9),
          (str_store_string, s7, "@Gale^^The sea is violent. The sails are almost completely reefed.^There is a high risk of a damaged hull."),
        (else_try),
          (str_store_string, s7, "@Storm^^The waves toss about the ships, which threaten to capsize."),
        (end_try),
        
        (create_text_overlay, reg1, s7, tf_center_justify),
        (overlay_set_color, reg1, 0x000000),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        #sailors
        (assign, reg5, 0),
        (assign, reg6, 0),
        # (party_get_num_companion_stacks, ":num", "p_main_party"),
        # (try_for_range, ":stack_no", 0, ":num"),
        # (party_stack_get_troop_id, ":party_troop", "p_main_party", ":stack_no"),
        # (eq, ":party_troop", "trp_regular_sailors"),
        # (assign, ":num", 0), #loop breaker
        # (party_stack_get_size, ":size", "p_main_party", ":stack_no"),
        # (party_stack_get_num_wounded, ":wounded", "p_main_party", ":stack_no"),
        # (val_sub, ":size", ":wounded"),
        # (ge, ":size", 1),
        # (assign, reg5, ":size"),
        # (store_div, ":total_movement", ":size", 10),
        # (val_min, ":total_movement", 20),
        # (assign, reg6, ":total_movement"),
        # #(str_store_string, s1, "@Sailors Number: {reg5} ^ Speed extra added: {reg6}"),
        # (try_end),
        # new changes for VC-805:
        (try_begin),
          # (store_party_size_wo_prisoners, ":party_size", "p_main_party"),
          # (gt, ":party_size", 0),
          # (party_count_members_of_type, ":num_sailors", "p_main_party", "trp_regular_sailors"),
          # (assign, reg5, ":num_sailors"),
          # (val_mul, ":num_sailors", 80),
          # (store_div, reg6, ":num_sailors", ":party_size"),
          # (val_min, reg6, 40),	# sailor speed limit cap of 40% VC-2124
          (call_script, "script_calculate_party_speed_water", "p_main_party"),
        (try_end),
        #info
        
        (create_text_overlay, reg1, "@Number of sailors:", 0),
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 330),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@{reg5}", 0),
        (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 310),
        (position_set_y, pos1, 330),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        
        (create_text_overlay, reg1, "@Speed from sailors:", 0),
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 280),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@{reg6}%", 0),
        (overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 310),
        (position_set_y, pos1, 280),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        #
        (try_begin),
          (ge,"$g_presentations_next_presentation",-1),
          #Ship
          (create_game_button_overlay,"$g_presentation_obj_3","@Fleet",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_3", pos1),
          #Wait Here 		#No camping in sea
          # (create_game_button_overlay,"$g_presentation_obj_4","@Wait Here",tf_center_justify),
          # (position_set_x, pos1, 340),
          # (position_set_y, pos1, 700),
          # (overlay_set_position, "$g_presentation_obj_4", pos1),
          #Troop tree info
          (create_game_button_overlay,"$g_presentation_obj_5","@Troop Tree",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_5", pos1),
          #Read Book
          (create_game_button_overlay,"$g_presentation_obj_7","@Read Book",tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_7", pos1),
          # Retire action
          (create_game_button_overlay,"$g_presentation_obj_8","@Retire",tf_center_justify),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_8", pos1),
          
          #Recruit prisoners
          (create_game_button_overlay,"$g_presentation_obj_9","@Recruit Prisoners",tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_9", pos1),
          #Take a action
          (create_game_button_overlay,"$g_presentation_obj_12","@Options",tf_center_justify),
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_12", pos1),
          ###
          ###Wait here
          ##	           (try_begin), #
          ##		     (eq,"$temp",4),
          ##			(create_game_button_overlay,"$g_presentation_obj_11","str_give_order",tf_center_justify), #Centers info
          ##			(position_set_x, pos1, 850),
          ##			(position_set_y, pos1, 200),
          ##			(overlay_set_position, "$g_presentation_obj_11", pos1),
          ##		   (try_end),
        (try_end),
        ###
        (try_begin),
          (eq,"$g_presentations_next_presentation",-1),
          (call_script, "script_texto_global_camp_info2"),
          (create_text_overlay,"$g_presentation_obj_15",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_15",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_15", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_15", pos1),
        (else_try),
          (ge,"$g_presentations_next_presentation",0),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_16", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_16", pos1),
        (else_try),
          (eq,"$g_presentations_next_presentation",-2),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_left_align),
          (position_set_x,pos1,600),
          (position_set_y,pos1,130),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
        (try_end),
        
        (create_game_button_overlay,"$g_presentation_obj_13","@Check Location",tf_center_justify),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_13", pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        #   (store_trigger_param_2, ":value"),
        (try_begin),
          (eq,"$g_presentation_obj_1",":object"), #Exit
          (str_clear,s1),
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          #(assign, "$fortified_camp", 0),
          (assign,"$temp",6),
          (change_screen_return),
        (else_try),
          (eq,"$g_presentation_obj_3",":object"), #ship
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (assign, "$vc_menu_active", "prsnt_vc_submenu_ships"),
          (assign, "$ship_menu_state", 1),
          (assign, "$current_town", "p_main_party"),	# maybe dangerous...
          (assign, "$current_landed_ships_party", -1),	#new for VC-1658
          (set_jump_mission,"mt_camp_on_sea"),
          (jump_to_scene,"scn_camp_on_sea"),
          (change_screen_mission),
          ##		(else_try),
          ##			(eq,"$g_presentation_obj_4",":object"), #Wait here
          ##                        (str_clear,s1),
          ##			(assign,"$temp",4),
          ##			(val_add,"$g_presentations_next_presentation",1),
          ##                        (call_script, "script_texto_wait_here"),
          ##			(start_presentation,"prsnt_camp_screen_sea"),
        (else_try),
          (eq,"$g_presentation_obj_5",":object"), #Troop Tree
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (assign, "$g_presentation_obj_sliders_1_val", 0),
          (start_presentation, "prsnt_troop_tree"),
        (else_try),
          (eq,"$g_presentation_obj_7",":object"), # Select Book to Read
          (str_clear,s1),
          
          (try_begin),
            (eq, "$sabe_leer", 1),
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$temp",0),
            (jump_to_menu, "mnu_camp_action_read_book"),
          (else_try),
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$temp",0),
            (start_presentation,"prsnt_camp_screen_sea"),
            (display_message,"@You cannot read. You can learn to do so at a monastery.",0xFFFFAAAA), #chief anadido
          (try_end),
          
        (else_try),
          (eq,"$g_presentation_obj_8",":object"), #Retire from adventuring
          (str_clear,s1),
          (assign,"$g_presentations_next_presentation",-1),
          (assign,"$temp",0),
          (jump_to_menu, "mnu_retirement_verify"),
        (else_try),
          (eq,"$g_presentation_obj_9",":object"), #Recruit prisoners
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (try_begin),
            (troops_can_join, 1),
            (store_current_hours, ":cur_time"),
            (val_sub, ":cur_time", 24),
            (gt, ":cur_time", "$g_prisoner_recruit_last_time"),
            (try_begin),
              (gt, "$g_prisoner_recruit_last_time", 0),
              (assign, "$g_prisoner_recruit_troop_id", 0),
              (assign, "$g_prisoner_recruit_size", 0),
              (assign, "$g_prisoner_recruit_last_time", 0),
            (try_end),
            (jump_to_menu, "mnu_camp_recruit_prisoners"),
          (else_try),
            (start_presentation,"prsnt_camp_screen_sea"),
            (display_message,"@No one is interested this time.",0xFFFFAAAA), #chief anadido
          (try_end),
        (else_try),
          (eq,"$g_presentation_obj_12",":object"), #take a action (Options)
          (str_clear,s1),
          
          (assign, reg60, 0),
          (assign,"$g_presentations_next_presentation", -1),
          (start_presentation,"prsnt_vc_options"),
          (assign,"$temp",0),
          
        (else_try),
          (eq,"$g_presentation_obj_13",":object"), #test drive
          (str_clear,s1),
          (assign, reg60, 0),
          (assign,"$g_presentations_next_presentation", -1),
          (assign,"$temp",0),
          #
          (call_script, "script_prepare_party_ships_for_team", "p_main_party", 1),
          (call_script, "script_setup_random_sea_scene"),
          (set_jump_mission, "mt_ship_test"),
          (change_screen_mission),
          
          
          # (assign,"$g_presentations_next_presentation",-1),
          # (assign,"$temp",0),
          # (jump_to_menu, "mnu_camp_action"),
          ##		(else_try),
          ##			(eq,"$g_presentation_obj_11",":object"), #Wait here
          ##                        (str_clear,s1),
          ##			(assign,"$g_presentations_next_presentation",-1),
          ##			(presentation_set_duration,0),
          ##                        (assign,"$g_camp_mode", 1),
          ##                        (assign, "$g_infinite_camping", 0),
          ##
          ##                    (rest_for_hours_interactive, 24 * 365, 5, 1), #rest while attackable
          ##    			       (assign,"$temp",6), #Obliga descanso al salir
          ##                               (change_screen_return),
        (try_end),
        
    ]),
]),


###followers screen
("followers_screen_camp",0,mesh_load_window,[
    (ti_on_presentation_load,
      [(presentation_set_duration,999999),
        (set_fixed_point_multiplier, 1000),
        
        (str_clear,s2),
        (str_clear,s3),
        (str_clear,s4),
        (str_clear,s5),
        (str_clear,s6),
        (str_clear,s7),
        (str_clear,s8),
        (str_clear,s9),
        
        (str_clear,s10),
        (str_clear,s11),
        (str_clear,s12),
        (str_clear,s13),
        (str_clear,s14),
        (str_clear,s15),
        (str_clear,s16),
        (str_clear,s17),
        (str_clear,s18),
        
        
        
        (create_game_button_overlay, "$g_presentation_obj_1", "str_back"),
        (position_set_x, pos1, 825),
        (position_set_y, pos1, 85),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###shadow
        (create_text_overlay, reg1, "@Followers Camp", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xD5C7B6), #Beige
        (position_set_x, pos1, 248),
        (position_set_y, pos1, 548),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 230),
        (overlay_set_area_size, reg1, pos1),
        ####
        (create_text_overlay, reg1, "@Followers Camp", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xFFFFFF), #White se ve bien
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        
        (str_store_string, s8, "@Your army is accompanied by followers from diverse backgrounds.^^" +
          "Followers allow you to access important services quickly and provide moral support, but have the disadvantage of making your army advance more slowly.^^" +
          "You can drive away followers any time, but doing so will have an impact on the morale of your army.^^" +
          "You can increase the number of your followers with people you meet in your travels, assigning them to groups such as priests, women and others. You may assign troops from your army to the group of followers by talking with them from your army menu.^^" +
        "If you decide to reduce the size of your army below 300 men or if your army suffers high losses or a serious defeat, followers may abandon you."),
        (create_text_overlay, reg1, s8,tf_double_space|tf_scrollable|tf_center_justify),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 10),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 480),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro1b"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        #
        (try_begin),
          (ge,"$g_presentations_next_presentation",-1),
          #Smith
          (create_game_button_overlay,"$g_presentation_obj_3","@Smith",tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_3", pos1),
          #Priest
          (create_game_button_overlay,"$g_presentation_obj_4","@Priest",tf_center_justify),
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_4", pos1),
          #Healer
          (create_game_button_overlay,"$g_presentation_obj_5","@Healer",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_5", pos1),
          #Mules
          (create_game_button_overlay,"$g_presentation_obj_7","@Mules",tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_7", pos1),
          #Slave Merchant
          (create_game_button_overlay,"$g_presentation_obj_8","@Slave Trader",tf_center_justify),
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_8", pos1),
          
          #Remove Followers
          (create_game_button_overlay,"$g_presentation_obj_9","@Dismiss",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_9", pos1),
        (try_end),
        ###
        (try_begin),
          #(eq,"$g_presentations_next_presentation",-1),
          (call_script, "script_texto_followers_info"),
          (create_text_overlay,"$g_presentation_obj_15",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_15",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_15", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_15", pos1),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        #   (store_trigger_param_2, ":value"),
        (try_begin),
          (eq,"$g_presentation_obj_1",":object"), #Back
          (str_clear,s1),
          (assign,"$temp",0),
          (presentation_set_duration,0),
          (change_screen_return),
        (else_try),
          (eq,"$g_presentation_obj_3",":object"), #Smith
          (str_clear,s1),
          (assign,"$temp",0),
          (modify_visitors_at_site,"scn_conversation3people_scene"),#player entry point 16, and then 17, 18, 19 for NPC's, opposite the player. 17 must be g_talk troop
          (reset_visitors), #entry points #reparar para que funcione conversacion a varios
          (set_visitor,0,"trp_player"),
          (set_visitor,17,"trp_town_31_weaponsmith"),
          (set_jump_mission,"mt_conversation_encounter"),
          (jump_to_scene,"scn_conversation3people_scene"),
          (change_screen_map_conversation, "trp_town_31_weaponsmith"),
        (else_try),
          (eq,"$g_presentation_obj_4",":object"), #Priest
          (str_clear,s1),
          (assign,"$temp",0),
          (modify_visitors_at_site,"scn_conversation3people_scene"),#player entry point 16, and then 17, 18, 19 for NPC's, opposite the player. 17 must be g_talk troop
          (reset_visitors), #entry points #reparar para que funcione conversacion a varios
          (try_begin),
            (eq, "$g_player_faith", 2), #player pagano
            (assign,":troops_talk","trp_norse_priest"),
          (else_try),
            (assign,":troops_talk","trp_saxon_priest"),
          (try_end),
          (set_visitor,0,"trp_player"),
          (set_visitor,17,":troops_talk"),
          (set_jump_mission,"mt_conversation_encounter"),
          (jump_to_scene,"scn_conversation3people_scene"),
          (change_screen_map_conversation, ":troops_talk"),
        (else_try),
          (eq,"$g_presentation_obj_5",":object"), #Healer
          (str_clear,s1),
          (assign,"$temp",0),
          (modify_visitors_at_site,"scn_conversation3people_scene"),#player entry point 16, and then 17, 18, 19 for NPC's, opposite the player. 17 must be g_talk troop
          (reset_visitors), #entry points #reparar para que funcione conversacion a varios
          (set_visitor,0,"trp_player"),
          (set_visitor,17,"trp_town_30_healer"),
          (set_jump_mission,"mt_conversation_encounter"),
          (jump_to_scene,"scn_conversation3people_scene"),
          (change_screen_map_conversation, "trp_town_30_healer"),
        (else_try),
          (eq,"$g_presentation_obj_7",":object"), # Inventory
          (str_clear,s1),
          (assign,"$temp",0),
          (modify_visitors_at_site,"scn_conversation3people_scene"),#player entry point 16, and then 17, 18, 19 for NPC's, opposite the player. 17 must be g_talk troop
          (reset_visitors), #entry points #reparar para que funcione conversacion a varios
          (set_visitor,0,"trp_player"),
          (set_visitor,17,"trp_mule_troop"),
          (set_jump_mission,"mt_conversation_encounter"),
          (jump_to_scene,"scn_conversation3people_scene"),
          (change_screen_map_conversation, "trp_mule_troop"),
          
          #			(change_screen_loot, "trp_household_possessions2"),
        (else_try),
          (eq,"$g_presentation_obj_8",":object"), # Slave Merchant
          (str_clear,s1),
          (assign,"$temp",0),
          (modify_visitors_at_site,"scn_conversation3people_scene"),#player entry point 16, and then 17, 18, 19 for NPC's, opposite the player. 17 must be g_talk troop
          (reset_visitors), #entry points #reparar para que funcione conversacion a varios
          (set_visitor,0,"trp_player"),
          (set_visitor,17,"trp_ransom_broker_20"),
          (set_jump_mission,"mt_conversation_encounter"),
          (jump_to_scene,"scn_conversation3people_scene"),
          (change_screen_map_conversation, "trp_ransom_broker_20"),
        (else_try),
          (eq,"$g_presentation_obj_9",":object"), #Remove Followers
          (str_clear,s1),
          (assign,"$temp",0),
          (jump_to_menu, "mnu_followers_remove"),
        (try_end),
        
    ]),
  
  (ti_on_presentation_run,
     [(try_begin),
        (key_clicked, key_pad_rright),
        (str_clear,s1),
        (assign,"$temp",0),
        (presentation_set_duration,0),
        (change_screen_return),
      (try_end),
    ]),
]),
##############

#Faction screen
("faction_screen_main",0,0,[
    (ti_on_presentation_load,
      [(presentation_set_duration,999999),
        (set_fixed_point_multiplier, 1000),
        
        (str_clear,s2),
        (str_clear,s3),
        (str_clear,s4),
        (str_clear,s5),
        (str_clear,s6),
        (str_clear,s7),
        (str_clear,s8),
        (str_clear,s9),
        
        (str_clear,s10),
        (str_clear,s11),
        (str_clear,s12),
        (str_clear,s13),
        (str_clear,s14),
        (str_clear,s15),
        (str_clear,s16),
        (str_clear,s17),
        (str_clear,s18),
        
        (assign, "$g_presentation_obj_12", -1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_character"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        
        (create_game_button_overlay, "$g_presentation_obj_1", "str_done"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###shadow
        # (str_store_troop_name, s0, "trp_player"),
        # (try_begin),
        # (eq, "$players_kingdom_name_set", 1),
        # (str_store_faction_name, s2, "fac_player_supporters_faction"),
        # (else_try),
        # (str_store_string, s2, "str_default_kingdom_name"),
        # (try_end),
        
        (create_text_overlay, reg1, "@Kingdom Report", tf_center_justify), #arriba centrado
        (overlay_set_color, reg1, 0xD5C7B6), #Beige
        (position_set_x, pos1, 176),
        (position_set_y, pos1, 549),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        # (position_set_x, pos1, 200),
        # (position_set_y, pos1, 230),
        # (overlay_set_area_size, reg1, pos1),
        ####
        (create_text_overlay, reg1, "@Kingdom Report", tf_center_justify), #arriba centrado
        # (overlay_set_color, reg1, 0x996633), #saddle brown, se ve bien
        # (overlay_set_color, reg1, 0xB7AA9C), #sandstone, demasiado grisaceo
        #(overlay_set_color, reg1, 0xA28A56), #tan
        #(overlay_set_color, reg1, 0xE12126), #Atomic Red muy leible
        #(overlay_set_color, reg1, 0xD5D3B6), #Fawn se ve poco
        #  (overlay_set_color, reg1, 0x9ACD32), #Yellow green se ve regular
        #(overlay_set_color, reg1, 0xFFDD21), #Primrose Yellow se ve bien
        ##        (overlay_set_color, reg1, 0xD5C7B6), #Beige se ve poco
        ##        (overlay_set_color, reg1, 0x0x777777), #Traffic Grey se ve bien
        (overlay_set_color, reg1, 0xFFFFFF), #White se ve bien
        #        (overlay_set_color, reg1, 0x0x000000), #Black se ve bien
        (position_set_x, pos1, 175),
        (position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        
        ##        (create_text_overlay, reg1, "@Kingdom:", 0),
        ##        #(overlay_set_color, reg1, 0xDDDDDD),
        ##        (position_set_x, pos1, 140),
        ##        (position_set_y, pos1, 430),
        ##        (overlay_set_position, reg1, pos1),
        ##        (position_set_x, pos1, 800),
        ##        (position_set_y, pos1, 800),
        ##        (overlay_set_size, reg1, pos1),
        ##        (create_text_overlay, reg1, "@{!}{s2}", tf_center_justify),
        ##        (position_set_x, pos1, 800),
        ##        (position_set_y, pos1, 800),
        ##        (overlay_set_size, reg1, pos1),
        ##        (position_set_x, pos1, 340),
        ##        (position_set_y, pos1, 430),
        ##        (overlay_set_position, reg1, pos1),
        ##        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        ##       #  (overlay_set_color, reg1, 0x996633), #saddle brown, se ve bien
        
        (create_text_overlay, reg1, "@{reg59?Queen:King}:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@{!}{playername}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 410),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #  (overlay_set_color, reg1, 0x996633), #saddle brown, se ve bien
        
        
        #faction basic
        ###places of the player, personal propierty
        (assign, ":num_ptowns", 0),
        (assign, ":num_pcastles", 0),
        (assign, ":num_pvillages", 0),
        (try_for_range, ":center_no", centers_begin, centers_end),
          (party_get_slot, ":type", ":center_no", slot_party_type),
          (try_begin),
            (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
            (try_begin),
              (eq, ":type", spt_town),
              (val_add, ":num_ptowns", 1),
            (else_try),
              (eq, ":type", spt_castle),
              (val_add, ":num_pcastles", 1),
            (else_try),
              (val_add, ":num_pvillages", 1),
            (try_end),
          (try_end),
        (try_end),
        ####
        
        (create_text_overlay, reg1, "@{reg59?Queen:King}'s Towns:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":num_ptowns"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 390),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        
        (create_text_overlay, reg1, "@{reg59?Queen:King}'s Forts:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":num_pcastles"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 370),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        
        (create_text_overlay, reg1, "@{reg59?Queen:King}'s Villages:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 340),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":num_pvillages"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 340),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        #    (overlay_set_color, reg1, 0xFF0000), #rojo
        ### player propierties end
        ###kingdom propierties
        # for current line_faction count lords and centers
        (assign, ":num_lords", 0),
        (assign, ":num_caravans", 0),
        (assign, ":num_towns", 0),
        (assign, ":num_castles", 0),
        (assign, ":num_villages", 0),
        (assign, ":unassigned_centers", 0),
        (try_for_parties, ":cur_party"),
          (store_faction_of_party, ":cur_faction", ":cur_party"),
          (eq, ":cur_faction", "fac_player_supporters_faction"),
          
          (try_begin),
            (party_slot_eq, ":cur_party", slot_party_type, spt_kingdom_hero_party),
            (val_add, ":num_lords", 1),
          (else_try),
            (party_slot_eq, ":cur_party", slot_party_type, spt_kingdom_caravan),
            (val_add, ":num_caravans", 1),
          (else_try),
            (party_slot_eq, ":cur_party", slot_party_type, spt_town),
            (val_add, ":num_towns", 1),
            (try_begin),
              (party_slot_eq, ":cur_party", slot_town_lord, stl_unassigned),
              (val_add, ":unassigned_centers", 1),
            (try_end),
          (else_try),
            (party_slot_eq, ":cur_party", slot_party_type, spt_castle),
            (val_add, ":num_castles", 1),
            (try_begin),
              (party_slot_eq, ":cur_party", slot_town_lord, stl_unassigned),
              (val_add, ":unassigned_centers", 1),
            (try_end),
          (else_try),
            (party_slot_eq, ":cur_party", slot_party_type, spt_village),
            (val_add, ":num_villages", 1),
            (try_begin),
              (party_slot_eq, ":cur_party", slot_town_lord, stl_unassigned),
              (val_add, ":unassigned_centers", 1),
            (try_end),
          (try_end),
        (try_end), # end of parties loop
        
        
        (create_text_overlay, reg1, "@Lords:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 320),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":num_lords"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 320),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        
        (create_text_overlay, reg1, "@Caravans:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":num_caravans"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        
        (create_text_overlay, reg1, "@Kingdom Towns:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 270),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":num_towns"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 270),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        
        
        (create_text_overlay, reg1, "@Kingdom Forts:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 250),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":num_castles"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 250),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        
        
        (create_text_overlay, reg1, "@Kingdom Villages:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 230),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":num_villages"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 230),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        
        (create_text_overlay, reg1, "@Places without Lord:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 200),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":unassigned_centers"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 200),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0xFF0000), #rojo
        
        #### Prisoners
        # Count prisoners
        (assign, ":prisoners", 0),
        (try_for_range, ":lord_id", active_npcs_begin, active_npcs_end),
          (troop_slot_eq, ":lord_id", slot_troop_occupation, slto_kingdom_hero),
          (troop_slot_ge, ":lord_id", slot_troop_prisoner_of_party, 0),
          (store_troop_faction, ":lord_faction", ":lord_id"),
          (eq, ":lord_faction", "fac_player_supporters_faction"),
          (val_add, ":prisoners", 1),
        (try_end),
        
        
        (create_text_overlay, reg1, "@Prisoner Lords:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (assign, reg0,":prisoners"),
        (create_text_overlay, reg1, "@{!}{reg0}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0xE12126), #red
        
        #minister
        (create_text_overlay, reg1, "@Minister:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 160),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (try_begin),
          (gt, "$g_player_minister", 0),
          (str_store_troop_name, s3, "$g_player_minister"),
        (else_try),
          (str_store_string,s3,"str_none"),
        (try_end),
        (create_text_overlay, reg1, "@{!}{s3}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 160),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        ##
        ###tax control
        (create_text_overlay, reg1, "@Tax Enforcement:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 130),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (try_begin),
          (eq, "$control_tax", 1),  #tax control active
          (str_store_string,s4,"@Yes (costs 3000 peningas/week)"),
        (else_try),
          (str_store_string,s4,"@No (tax revenue lower)"),
        (try_end),
        (create_text_overlay, reg1, "@{!}{s4}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 130),
        (overlay_set_position, reg1, pos1),
        (try_begin),
          (eq, "$control_tax", 1),  #tax control active
          (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        (else_try),
          (overlay_set_color, reg1, 0xE12126), #red
        (try_end),
        ###
        (create_text_overlay, reg1, "@{reg59?Queen:King}'s Army Size:", 0),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 140),
        (position_set_y, pos1, 110),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (store_party_size_wo_prisoners,":army_size","p_main_party"),
        (assign, reg26, ":army_size"),
        (create_text_overlay, reg1, "@{!}{reg26}", tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 110),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x006400), #verde oscuro se ve bien
        
        ###faction banner
        ##        (troop_get_slot, ":selected_banner_spr", "trp_player", slot_troop_banner_scene_prop),
        ##         (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", ":selected_banner_spr"),
        (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_player"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 550),
        (overlay_set_size, "$jq_portrait", pos1),
        (position_set_x, pos1, 300),
        (position_set_y, pos1, 440),
        (overlay_set_position, "$jq_portrait", pos1),
        ##    ###mesh de fondo
        ##      (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        ##      (position_set_x, pos1, -1),
        ##      (position_set_y, pos1, -1),
        ##      (overlay_set_position, reg0, pos1),
        ##      (position_set_x, pos1, 1002),
        ##      (position_set_y, pos1, 1002),
        ##      (overlay_set_size, reg0, pos1),
        #
        (try_begin),
          (ge,"$g_presentations_next_presentation",-1),
          #Faction global Orders ok
          (create_game_button_overlay,"$g_presentation_obj_3","@Royal Decree",tf_center_justify),
          (position_set_x, pos1, 820),
          ##			(position_set_y, pos1, 700),
          ##			(position_set_x, pos1, 180),
          (position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_3", pos1),
          #Faction global info ok
          (create_game_button_overlay,"$g_presentation_obj_4","@Summary",tf_center_justify),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, 650),
          ##			(position_set_x, pos1, 340),
          ##			(position_set_y, pos1, 700),
          ##			(position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_4", pos1),
          #Kingdom Lords army Info  ok
          (create_game_button_overlay,"$g_presentation_obj_5","@Lords",tf_center_justify),
          (position_set_x, pos1, 500),
          # (position_set_x, pos1, 660),
          (position_set_y, pos1, 700),
          ##			(position_set_x, pos1, 340),
          ##			(position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_5", pos1),
          #Economic info ok
          ##          (create_game_button_overlay,"$g_presentation_obj_6","@Economy",tf_center_justify),
          ##          (position_set_x, pos1, 340),
          ##          (position_set_y, pos1, 700),
          ##          ##			(position_set_x, pos1, 180),
          ##          ##			(position_set_y, pos1, 650),
          ##          (overlay_set_position, "$g_presentation_obj_6", pos1),
          #Factions diplomacy global info
          (create_game_button_overlay,"$g_presentation_obj_7","@Diplomacy",tf_center_justify),
          (position_set_x, pos1, 820),
          (position_set_y, pos1, 700),
          ##			(position_set_x, pos1, 500),
          ##			(position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_7", pos1),
          # Kingdom strengh ok
          (create_game_button_overlay,"$g_presentation_obj_8","@Armies",tf_center_justify),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 650),
          ##			(position_set_x, pos1, 660),
          ##			(position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_8", pos1),
          
          #Centers info
          (create_game_button_overlay,"$g_presentation_obj_9","@Centers",tf_center_justify), #Centers info
          (position_set_x, pos1, 340),
          (position_set_y, pos1, 650),
          ##			(position_set_x, pos1, 500),
          ##			(position_set_y, pos1, 650),
          (overlay_set_position, "$g_presentation_obj_9", pos1),
          #Kingdom rename
          ##		    (try_begin), #
          ##		     (eq,"$g_no_some_options",0), #no in dialogs
          (create_game_button_overlay,"$g_presentation_obj_10","@Rename",tf_center_justify), #
          (position_set_x, pos1, 180),
          (position_set_y, pos1, 650),
          ##			(position_set_x, pos1, 500),
          ##			(position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_10", pos1),
          #Kingdom recolour
          (create_game_button_overlay,"$g_presentation_obj_11","@Map Colour",tf_center_justify), #
          (position_set_x, pos1, 180),
          (position_set_y, pos1, 700),
          (overlay_set_position, "$g_presentation_obj_11", pos1),
          ##		     (try_end),
          #factions orders
        (try_end),
        
        (try_begin), #show when factions orders is ok
          (eq,"$temp",3),
          
          (create_text_overlay, reg1, "@Make a Royal Decree:^^Changing orders will take a few hours,^as messengers need time to reach your vassals.^Once you select your order click DONE for confirmation.", tf_center_justify),
          #  (overlay_set_color, reg1, 0xDDDDDD),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 520),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          
          (try_begin),
            (eq, "$player_marshal_ai_state", sfai_gathering_army),
            (str_store_string,s4,"@Gather Our Forces"),
          (else_try),
            (eq, "$player_marshal_ai_state", sfai_default),
            (str_store_string,s4,"@Defend the Kingdom"),
          (else_try),
            (str_store_string,s4,"str_none"),
          (try_end),
          (create_text_overlay, reg1, "@Current decree: {s4}", tf_center_justify),
          #  (overlay_set_color, reg1, 0xDDDDDD),
          (position_set_x, pos1, 650),
          (position_set_y, pos1, 450),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          
          # Orders
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 400),
          (create_combo_button_overlay, "$g_presentation_obj_12"),
          (overlay_set_position, "$g_presentation_obj_12", pos1),
          (overlay_add_item, "$g_presentation_obj_12", "str_none"),
          (overlay_add_item, "$g_presentation_obj_12", "@Gather Our Forces"),
          (overlay_add_item, "$g_presentation_obj_12", "@Defend the Kingdom"),
          #    (overlay_add_item, "$g_presentation_obj_12", "@Call to the Kingdom Fyrd!"),
          (try_begin),
            (eq, "$factionorders_type", factionorders_no),
            (overlay_set_val, "$g_presentation_obj_12", 0),
          (else_try),
            (eq, "$factionorders_type", factionorders_commonarmy),
            (overlay_set_val, "$g_presentation_obj_12", 1),
          (else_try),
            (eq, "$factionorders_type", factionorders_deffense),
            (overlay_set_val, "$g_presentation_obj_12", 2),
            ##		    (else_try),
            ##		       (eq, "$factionorders_type", factionorders_fyrd),
            ##		       (overlay_set_val, "$g_presentation_obj_12", 3),
          (try_end),
          
          (create_text_overlay,"$g_presentation_obj_13",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_13",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 300),
          (overlay_set_area_size, "$g_presentation_obj_13", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_13", pos1),
          
        (else_try),
          (eq,"$g_presentations_next_presentation",-1),
          (call_script, "script_texto_faction_orders"),
          (create_text_overlay,"$g_presentation_obj_15",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_15",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_15", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_15", pos1),
        (else_try),
          (ge,"$g_presentations_next_presentation",0),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_double_space|tf_scrollable|tf_center_justify),
          (position_set_x, pos1, 530),
          (position_set_y, pos1, 120),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
          (position_set_x, pos1, 400),
          (position_set_y, pos1, 430),
          (overlay_set_area_size, "$g_presentation_obj_16", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_16", pos1),
          ##
          ##			(create_game_button_overlay,"$g_presentation_obj_10",s5,tf_center_justify),
          ##			(position_set_x,pos1,870),
          ##			(position_set_y,pos1,25),
          ##			(overlay_set_position,"$g_presentation_obj_10",pos1),
        (else_try),
          (eq,"$g_presentations_next_presentation",-2),
          (create_text_overlay,"$g_presentation_obj_16",s1,tf_left_align),
          (position_set_x,pos1,600),
          (position_set_y,pos1,130),
          (overlay_set_position,"$g_presentation_obj_16",pos1),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        (try_begin),
          (eq,"$g_presentation_obj_1",":object"), #Done
          (str_clear,s1),
          
          (try_begin),
            (eq, "$factionorders_type", factionorders_commonarmy),
            ###No FYRD, Only lords with their armies
            (this_or_next|neg|faction_slot_ge, "$players_kingdom", slot_faction_marshal, active_npcs_begin),
            (eq, "$players_kingdom", "fac_player_supporters_faction"),
            (this_or_next|faction_slot_eq, "$players_kingdom", slot_faction_ai_state, sfai_default),
            (faction_slot_eq, "$players_kingdom", slot_faction_ai_state, sfai_feast),
            (faction_get_slot, ":old_marshall", "$players_kingdom", slot_faction_marshal),
            (try_begin),
              (ge, ":old_marshall", 0),
              (troop_get_slot, ":old_marshall_party", ":old_marshall", slot_troop_leaded_party),
              (party_is_active, ":old_marshall_party"),
              (party_set_marshal, ":old_marshall_party", 0),
            (try_end),
            (faction_set_slot, "$players_kingdom", slot_faction_marshal, "trp_player"),
            
            (assign, "$player_marshal_ai_state", sfai_gathering_army),
            (assign, "$player_marshal_ai_object", "p_main_party"),
            (assign, "$g_recalculate_ais", 1),
            (display_message, "@You order the lords to present themselves with their household armies."),
          (try_end),
          ###
          (try_begin),
            (eq, "$factionorders_type", factionorders_deffense),
            (neg|faction_slot_eq, "$players_kingdom", slot_faction_ai_state, sfai_default),
            (neg|faction_slot_eq, "$players_kingdom", slot_faction_ai_state, sfai_feast),
            (assign, "$player_marshal_ai_state", sfai_default),
            (assign, "$player_marshal_ai_object", -1),
            (assign, "$g_recalculate_ais", 1),
            (display_message, "@You order the kingdom to be defended."),
          (try_end),
          
          # (assign, "$g_no_some_options", 0),  #usable, always finish in 0
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          (assign,"$temp",0),
          (try_begin),
            (eq, "$g_no_some_options", 1),  #usable, always finish in 0
            (assign, "$g_no_some_options", 0),  #usable, always finish in 0
            (assign,"$temp2",0),
            (set_trigger_result, 1),
          (else_try),
            (set_trigger_result,1),
            (start_presentation,"prsnt_character_screen_main"),
          (try_end),
          
          ##			   (try_begin),
          ##			      (eq,"$temp2",1),
          ##			       (assign,"$temp2",0),
          ##                               (change_screen_return),
          ##		(set_trigger_result,1),
          ##		(start_presentation,"prsnt_character_screen_main"),
          ##		           (else_try),
          ##                                 (set_trigger_result, 1),
          ####                                (finish_mission,0),
          ##		           (try_end),
        (else_try),
          (eq,"$g_presentation_obj_3",":object"), #factions orders
          (str_clear,s1),
          (assign,"$temp",3), #active options - orders
          (val_add,"$g_presentations_next_presentation",1),
          # (call_script, "script_texto_faction_orders"),
          (start_presentation,"prsnt_faction_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_4",":object"), #faction info
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (start_presentation,"prsnt_faction_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_5",":object"), #Kingdom lords info
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_kingdomlords_info"),
          (start_presentation,"prsnt_faction_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_6",":object"), # Economia
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1), #kingdom economy
          (call_script, "script_texto_kingdom_economy"),
          (start_presentation,"prsnt_faction_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_7",":object"), # Factions diplomacy info peding
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1),
          (assign, ":faction_no", fac_player_supporters_faction),
          (call_script, "script_texto_factions_diplomacy_player_andglobal", ":faction_no"),
          (start_presentation,"prsnt_faction_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_8",":object"), #kingdom strengh
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1), #kingdom strengh
          (call_script, "script_texto_kingdom_armies"),
          (start_presentation,"prsnt_faction_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_9",":object"), #centers info
          (str_clear,s1),
          (assign,"$temp",0),
          (val_add,"$g_presentations_next_presentation",1), #
          (call_script, "script_texto_kingdom_centerinfo"),
          (start_presentation,"prsnt_faction_screen_main"),
        (else_try),
          (eq,"$g_presentation_obj_10",":object"), #kingdom rename
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (try_begin),
            (eq, "$players_kingdom_name_set", 1),
            (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_active),
            (troop_get_slot, ":spouse", "trp_player", slot_troop_spouse),
            (this_or_next|faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
            (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, ":spouse"), #wife can change kingdom name
            (presentation_set_duration,0),
            (start_presentation,"prsnt_name_kingdom"),
          (else_try),
            (start_presentation,"prsnt_faction_screen_main"),
            (display_message,"@You cannot do this now.",0xFFFFAAAA), #chief anadido
          (try_end),
        (else_try),
          (eq,"$g_presentation_obj_11",":object"), #kingdom color
          (str_clear,s1),
          (assign,"$temp",0),
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          (start_presentation,"prsnt_colour_kingdom"),
        (else_try),
          (eq,"$g_presentation_obj_12",":object"), # FEAST
          (str_clear,s1),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$factionorders_type", factionorders_no),
          (else_try),
            (eq, ":value", 1),
            (assign, "$factionorders_type", factionorders_commonarmy),
          (else_try),
            (eq, ":value", 2),
            (assign, "$factionorders_type", factionorders_deffense),
          (else_try),
            (eq, ":value", 3),
            (assign, "$factionorders_type", factionorders_fyrd),
          (try_end),
          (val_add,"$g_presentations_next_presentation",1),
          (call_script, "script_texto_factions_orders2"),
          (start_presentation,"prsnt_faction_screen_main"),
        (try_end),
        
    ]),
]),
#############################################

#fatiga stamina chief
###fatigue fatiga bar chief

("staminabar", prsntf_read_only|prsntf_manual_end_only, 0, [
    (ti_on_presentation_load, [
        (set_fixed_point_multiplier, 1000),
        
        (str_clear, s12),
        
        (create_text_overlay, "$stamina_bar", "@Stamina:", tf_center_justify),
        (overlay_set_color, "$stamina_bar", 0xDDDDDD),
        (position_set_x, pos1, 889),
        (position_set_y, pos1, 40),
        (overlay_set_position, "$stamina_bar", pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$stamina_bar", pos1),
        ##
        (get_player_agent_no,":player_agent"),
        (agent_is_active, ":player_agent"),
        (agent_is_alive,":player_agent"), #  test for alive players.
        (agent_is_human, ":player_agent"),
        (agent_get_slot, ":basic_stamina_i", ":player_agent", slot_agent_fatiga_inicial),
        (store_div, ":stamine_div10", ":basic_stamina_i", 10), #10 #
        (store_div, ":stamine_div2", ":basic_stamina_i", 2), #50%
        (store_mul, ":stamine_div3o4", ":basic_stamina_i", 3), #3/4
        (val_div, ":stamine_div3o4", 4),
        
        (agent_get_slot, ":basic_stamina", ":player_agent", slot_agent_fatiga),
        # (assign, reg0,":basic_stamina"),
        
        (try_begin),
          (lt, ":basic_stamina", 5),
          (str_store_string,s12,"@Exhausted"),
        (else_try),
          (lt, ":basic_stamina", ":stamine_div10"),
          (str_store_string,s12,"@Very Tired"),
        (else_try),
          (lt, ":basic_stamina", ":stamine_div2"),
          (str_store_string,s12,"@Tired"),
        (else_try),
          (lt, ":basic_stamina", ":stamine_div3o4"),
          (str_store_string,s12,"@Normal"),
        (else_try),
          (str_store_string,s12,"@High"),
        (try_end),
        
        (create_text_overlay, reg1, s12, tf_center_justify),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 949),
        (position_set_y, pos1, 40),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0x0000bb), #azul
        
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run,
      [
    ]),
]),
#fatiga stamina acaba
#Lair custom player name Player lair
("set_playerlair_name",0,0,[
    (ti_on_presentation_load,
      [(set_fixed_point_multiplier, 1000),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_troop_trees"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        
        (str_store_string, s1, "@What name would you like to give to your refuge?"),
        (create_text_overlay, reg1, s1, tf_center_justify),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, s1),
        (create_simple_text_box_overlay, "$g_presentation_obj_name_kingdom_1"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_1", pos1),
        (str_store_party_name, s7, "$current_town"),
        (overlay_set_text, "$g_presentation_obj_name_kingdom_1", s7),
        
        (create_button_overlay, "$g_presentation_obj_name_kingdom_2", "str_continue"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_2", pos1),
        
        (str_store_party_name, s5, "$current_town"),
        (create_button_overlay, reg1, "@Save it as: {s5}."),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 250),
        (overlay_set_position, reg1, pos1),
        
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_name_kingdom_1"),
          (str_store_string, s7, s0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_name_kingdom_2"),
          (party_set_name, "$current_town", s7),
          (presentation_set_duration, 0),
        (else_try),
          (store_add, ":overlay", "$g_presentation_obj_name_kingdom_2", 1),
          (eq, ":overlay", ":object"),
          (party_set_name, "$current_town", s5),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),
#lair custom name chief acaba

#chief presentacion game_troop_tree moto
#INPUT: reg0 selected troop
("game_troop_tree", 0, 0, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (assign, ":troop", reg0),
        
        ###mesh de fondo MOTO must do it this way or won't allow party screen to reappear
        (create_mesh_overlay, reg0, "mesh_load_window"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        #Message first part
        
        #screen top
        (create_text_overlay, reg1, "@Troop Tree", tf_center_justify),
        (position_set_x, pos1, Screen_Width/2),
        (position_set_y, pos1, Screen_Title_Height),
        (overlay_set_position, reg1, pos1),
        
        #write the trees
        (call_script, "script_troop_tree_precurse", ":troop", 1, 1),
        (store_div, "$troop_tree_pic_width", Troop_Tree_Area_Width, reg0),
        (store_div, "$troop_tree_pic_height", Troop_Tree_Area_Height, reg1),
        
        (store_div, ":x_pos", "$troop_tree_pic_width", 2),
        (val_add, ":x_pos", Screen_Border_Width),
        (store_mul, ":y_pos", "$troop_tree_pic_height", -1),
        (val_add, ":y_pos", Screen_Title_Height-2*Screen_Text_Height),
        (call_script, "script_troop_tree_recurse", ":troop", ":x_pos", ":y_pos"),
        
        #screen bottom
        (create_game_button_overlay, "$presentation_leave_button", "str_done", tf_center_justify),
        (position_set_x, pos1, Screen_Width/2),
        (position_set_y, pos1, Screen_Border_Width),
        (overlay_set_position, "$presentation_leave_button", pos1),
    ]),
    
    (ti_on_presentation_run, [
        (try_begin),
          (this_or_next|key_clicked, key_escape),
          (key_clicked, key_pad_start),
          (presentation_set_duration, 0),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":object"),
        (eq, ":object", "$presentation_leave_button"),
        (presentation_set_duration, 0),
    ]),
]), #end troop tree

#chief presentacion troop_tree moto
("troop_tree", 0, 0, [
    (ti_on_presentation_load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        #pic
        (create_mesh_overlay, reg0, "mesh_pic_troop_trees"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        #screen top
        (create_text_overlay, reg1, "@Troop Tree", tf_center_justify),
        (position_set_x, pos1, Screen_Width/2),
        (position_set_y, pos1, Screen_Title_Height),
        (overlay_set_position, reg1, pos1),
        
        (overlay_set_display, reg1, 0),
        (assign, "$troop_tree_counter", -1),
        
        (create_text_overlay, reg1, "@From Troop: ", tf_right_align),
        (position_set_x, pos1, Screen_Width/2-75),
        #(position_set_y, pos1, Screen_Title_Height-Screen_Text_Height),
        (position_set_y, pos1, 700),
        
        (overlay_set_position, reg1, pos1),
        
        (create_combo_button_overlay, "$g_presentation_obj_sliders_1"),
        (position_set_x, pos1, Screen_Width/2 + 80),
        #(position_set_y, pos1, Screen_Title_Height-Screen_Text_Height-5),
        (position_set_y, pos1, 690),
        
        (overlay_set_position, "$g_presentation_obj_sliders_1", pos1),
        
        # (overlay_set_additional_render_height, reg1, 20), #float over report MOTO doesn't help
        
        (store_add, ":last_culture", "fac_culture_scotch", 1),
        (try_for_range, ":culture", "fac_culture_norse", ":last_culture"),
          #       (str_store_faction_name, s1, ":culture"),
          (faction_get_slot, ":troop", ":culture", slot_faction_tier_1_troop),
          (str_store_troop_name, s1, ":troop"),
          #       (str_store_string, s1, "@{s1} {s2}"),
          (overlay_add_item, "$g_presentation_obj_sliders_1", s1),
        (try_end),
        
        #others
        (str_store_troop_name, s1, "trp_frisian_basic"),
        (overlay_add_item, "$g_presentation_obj_sliders_1", s1),
        
        (str_store_troop_name, s1, "trp_refugee"),
        (str_store_troop_name, s2, "trp_peasant_woman"),
        (str_store_string, s1, "@{s1} or {s2}"),
        (overlay_add_item, "$g_presentation_obj_sliders_1", s1),
        
        (str_store_troop_name, s1, "trp_farmer"),
        (str_store_troop_name, s2, "trp_townsman"),
        (str_store_string, s1, "@{s1} or {s2}"),
        (overlay_add_item, "$g_presentation_obj_sliders_1", s1),
        
        (str_store_troop_name, s1, "trp_looter"),
        (overlay_add_item, "$g_presentation_obj_sliders_1", s1),
        
        (str_store_troop_name, s1, "trp_manhunter"),
        (str_store_troop_name, s2, "trp_slave_driver"),
        (str_store_string, s1, "@{s1} or {s2}"),
        (overlay_add_item, "$g_presentation_obj_sliders_1", s1),
        
        (overlay_set_val, "$g_presentation_obj_sliders_1", "$g_presentation_obj_sliders_1_val"),
        
        #write the trees
        (store_add, ":culture", "fac_culture_norse", "$g_presentation_obj_sliders_1_val"),
        
        (try_begin),
          (lt, ":culture", ":last_culture"),
          (faction_get_slot, ":troop", ":culture", slot_faction_tier_1_troop),
          (call_script, "script_troop_tree_precurse", ":troop", 1, 1),
          (store_div, "$troop_tree_pic_width", Troop_Tree_Area_Width, reg0),
          (store_div, "$troop_tree_pic_height", Troop_Tree_Area_Height, reg1),
          
        (else_try),
          (store_sub, ":extra", ":culture", ":last_culture"),
          
          (eq, ":extra", 0),
          (assign, ":troop", "trp_frisian_basic"),
          (call_script, "script_troop_tree_precurse", ":troop", 1, 1),
          (store_div, "$troop_tree_pic_width", Troop_Tree_Area_Width, reg0),
          (store_div, "$troop_tree_pic_height", Troop_Tree_Area_Height, reg1),
          
        (else_try),
          (eq, ":extra", 1),
          (assign, ":troop", "trp_peasant_woman"),
          (call_script, "script_troop_tree_precurse", ":troop", 1, 1),
          (store_div, "$troop_tree_pic_width", Troop_Tree_Area_Width, reg0),
          (store_div, "$troop_tree_pic_height", Troop_Tree_Area_Height, reg1),
          
        (else_try),
          (eq, ":extra", 2),
          (assign, ":troop", "trp_farmer"),
          (call_script, "script_troop_tree_precurse", ":troop", 1, 1),
          (store_div, "$troop_tree_pic_width", Troop_Tree_Area_Width, reg0),
          (store_div, "$troop_tree_pic_height", Troop_Tree_Area_Height, reg1),
          
        (else_try),
          (eq, ":extra", 3),
          (assign, ":troop", "trp_looter"),
          (call_script, "script_troop_tree_precurse", ":troop", 1, 1),
          (store_div, "$troop_tree_pic_width", Troop_Tree_Area_Width, reg0),
          (store_div, "$troop_tree_pic_height", Troop_Tree_Area_Height, reg1),
          
        (else_try),
          (eq, ":extra", 4),
          (assign, ":troop", "trp_manhunter"),
          (call_script, "script_troop_tree_precurse", ":troop", 1, 1),
          (store_div, "$troop_tree_pic_width", Troop_Tree_Area_Width, reg0),
          (store_div, "$troop_tree_pic_height", Troop_Tree_Area_Height, reg1),
        (try_end),
        
        (store_div, ":x_pos", "$troop_tree_pic_width", 2),
        (val_add, ":x_pos", Screen_Border_Width),
        (store_mul, ":y_pos", "$troop_tree_pic_height", -1),
        (val_add, ":y_pos", Screen_Title_Height-2*Screen_Text_Height),
        (call_script, "script_troop_tree_recurse", ":troop", ":x_pos", ":y_pos"),
        
        #screen bottom
        (create_game_button_overlay, "$presentation_leave_button", "str_done", tf_center_justify),
        (position_set_x, pos1, Screen_Width/2),
        (position_set_y, pos1, Screen_Border_Width),
        (overlay_set_position, "$presentation_leave_button", pos1),
        
        # Alert that click opens detail
        (create_text_overlay, reg1, "@(Click on a unit for details)", tf_right_align),
        (position_set_x, 1, 950),(position_set_y, 1, 25),
        (overlay_set_position, reg1, 1),
        (position_set_x, pos1, 1750/2),(position_set_y, pos1, 1750/2),
        (overlay_set_size, reg1, pos1),
        (overlay_set_color, reg1, 0x0000FF),
        
    ]),
    
    (ti_on_presentation_run, [
        (try_begin),
          (this_or_next|key_clicked, key_escape),
          (key_clicked, key_pad_start),
          (presentation_set_duration, 0),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_sliders_1"),
          (assign, "$g_presentation_obj_sliders_1_val", ":value"),
          (start_presentation, "prsnt_troop_tree"),
          
        (else_try),
          (eq, ":object", "$presentation_leave_button"),
          (presentation_set_duration, 0),
        (try_end),
    ]),
    
    (ti_on_presentation_mouse_press, [
        (store_trigger_param_1, ":object_id"),
        #(store_trigger_param_2, ":obj_value"),
        (try_begin),
          
          (assign, ":end_loop", 0),
          (store_add, ":end_loop", "$troop_tree_counter", 1),
          
          (try_for_range, ":slot_no", 0, ":end_loop"),
            (troop_get_slot, ":unused", "trp_temp_array_a", ":slot_no"),
            (troop_slot_eq, "trp_temp_array_a", ":slot_no", ":object_id"),
            (troop_get_slot, ":troop_id", "trp_temp_array_b", ":slot_no"),
            (assign, "$temp_troop", ":troop_id"),
            (assign, ":end_loop", 0),
            (assign, "$temp", 1),
            (start_presentation, "prsnt_troop_detail"),
          (try_end),
        (try_end),
    ]),
]), #end troop tree
#moto troop tree chief acaba
# #chief presentacion troop_tree moto
# ("game_escape", prsntf_read_only, 0, [
# (ti_on_presentation_load, [
# (try_begin),
# (eq, "$campaign_type", camp_storyline),
# (neq, "$first_encuentro", -1),  #tutorial in progress
# (change_screen_options),
# (else_try),
# # (change_screen_options),  #takes to the save/quit screen, buttons invisible, but work
# (change_screen_controls), #takes to the save/quit screen, ESC to options
# # (change_screen_quit), #does nothing
# (try_end),
# ]),

# (ti_on_presentation_run, [
# (presentation_set_duration, 0),
# (try_begin),
# (this_or_next|key_clicked, key_escape),
# (key_clicked, key_pad_start),
# (presentation_set_duration, 0),
# (try_end),
# ]),
# ]),

###	PHAIAK chief begin (
###	PHAIAK begin (
("naval_ui", prsntf_read_only,0,[
    (ti_on_presentation_load,
      [
        (set_fixed_point_multiplier, 1000),
        
        (init_position, pos23),
        (try_begin),
          ### Ship + FRAME + SPEED
          (create_mesh_overlay, "$g_presentation_naval_ship_a", "mesh_nvl_ui_ship_a"),
          (create_mesh_overlay, "$g_presentation_naval_ship_a_sail", "mesh_nvl_ui_ship_a_sail"),
          (create_mesh_overlay, "$g_presentation_naval_flag", "mesh_nvl_flag"),
          (create_mesh_overlay, "$g_presentation_naval_frame", "mesh_nvl_frame"),
          (create_mesh_overlay, "$g_presentation_naval_up_arrow", "mesh_nvl_arrow_up_1"),
          (create_mesh_overlay, "$g_presentation_naval_up_arrow_2", "mesh_nvl_arrow_up_2"),
          (create_mesh_overlay, "$g_presentation_naval_down_arrow", "mesh_nvl_arrow_down_1"),
          (create_mesh_overlay, "$g_presentation_naval_right_arrow", "mesh_nvl_arrow_right_1"),
          (create_mesh_overlay, "$g_presentation_naval_right_arrow_2", "mesh_nvl_arrow_right_2"),
          (create_mesh_overlay, "$g_presentation_naval_left_arrow", "mesh_nvl_arrow_left_1"),
          (create_mesh_overlay, "$g_presentation_naval_left_arrow_2", "mesh_nvl_arrow_left_2"),
          (create_text_overlay, "$g_presentation_naval_speed", "@0", tf_single_line|tf_center_justify),	#|tf_with_outline
          (overlay_set_color, "$g_presentation_naval_speed", 0xFFFFFF), #color in RGB format like 0xRRGGBB (put hexadecimal values for RR GG and BB parts)
          (try_begin),
            (game_in_multiplayer_mode),
            (position_set_x, pos23, 800),
          (else_try),
            (position_set_x, pos23, 950),
          (try_end),
          (position_set_y, pos23, 680),
          (overlay_set_position, "$g_presentation_naval_ship_a", pos23),
          (overlay_set_position, "$g_presentation_naval_ship_a_sail", pos23),
          (overlay_set_position, "$g_presentation_naval_flag", pos23),
          (overlay_set_position, "$g_presentation_naval_frame", pos23),
          (overlay_set_position, "$g_presentation_naval_up_arrow", pos23),
          (overlay_set_position, "$g_presentation_naval_up_arrow_2", pos23),
          (overlay_set_position, "$g_presentation_naval_down_arrow", pos23),
          (overlay_set_position, "$g_presentation_naval_right_arrow", pos23),
          (overlay_set_position, "$g_presentation_naval_right_arrow_2", pos23),
          (overlay_set_position, "$g_presentation_naval_left_arrow", pos23),
          (overlay_set_position, "$g_presentation_naval_left_arrow_2", pos23),
          (position_move_y, pos23, -1),
          (overlay_set_position, "$g_presentation_naval_speed", pos23),
          (position_move_y, pos23, 1),
        (end_try),
        (presentation_set_duration, 999999),
    ]),
    
    (ti_on_presentation_run,
      [
        (set_fixed_point_multiplier, 1000),
        ### SWITCH OFF
        (overlay_set_alpha, "$g_presentation_naval_ship_a", 0),
        (overlay_set_alpha, "$g_presentation_naval_ship_a_sail", 0),
        (overlay_set_alpha, "$g_presentation_naval_flag", 0),
        (overlay_set_alpha, "$g_presentation_naval_frame", 0),
        (overlay_set_alpha, "$g_presentation_naval_speed", 0),
        (overlay_set_alpha, "$g_presentation_naval_up_arrow", 0),
        (overlay_set_alpha, "$g_presentation_naval_up_arrow_2", 0),
        (overlay_set_alpha, "$g_presentation_naval_down_arrow", 0),
        (overlay_set_alpha, "$g_presentation_naval_left_arrow", 0),
        (overlay_set_alpha, "$g_presentation_naval_left_arrow_2", 0),
        (overlay_set_alpha, "$g_presentation_naval_right_arrow", 0),
        (overlay_set_alpha, "$g_presentation_naval_right_arrow_2", 0),
        ### IF PLAYER HAS SHIP:
        (try_begin),
          (game_in_multiplayer_mode),
          (get_player_agent_no,":agent"),
          (this_or_next|eq,"$player_ship_number",-1),
          (this_or_next|neg|agent_is_active,"$player_ship_captain"),
          (this_or_next|neg|agent_is_alive,"$player_ship_captain"),
          (neq,":agent","$player_ship_captain"),
          (presentation_set_duration,0),
        (else_try),
          (neq, "$player_ship_number", -1),
          (scene_prop_get_instance, ":ship_instance", "spr_dyn_ship_substrate", "$player_ship_number"),
          ### SHOW
          #(overlay_set_alpha, "$g_presentation_naval_ship_a", 0xA0),
          (overlay_set_alpha, "$g_presentation_naval_ship_a", 0xFF),
          (overlay_set_alpha, "$g_presentation_naval_flag", 0xFF),
          (overlay_set_alpha, "$g_presentation_naval_frame", 0xFF),
          (overlay_set_alpha, "$g_presentation_naval_up_arrow", 0x10),
          (overlay_set_alpha, "$g_presentation_naval_down_arrow", 0x10),
          (overlay_set_alpha, "$g_presentation_naval_left_arrow", 0x10),
          (overlay_set_alpha, "$g_presentation_naval_right_arrow", 0x10),
          
          #(overlay_set_alpha, "$g_presentation_naval_speed", 0x80),
          (overlay_set_alpha, "$g_presentation_naval_speed", 0xFF),
          
          
          ### FLAG (WIND)
          (init_position, pos10),
          (position_rotate_x, pos10, -60),
          (get_player_agent_no, ":agent"),
          (agent_is_active, ":agent"),
          (agent_get_look_position, pos8, ":agent"),
          (position_get_rotation_around_z, ":rotation", pos8),
          (val_mul, ":rotation", -1),
          (position_rotate_z, pos10, ":rotation"),
          (copy_position, pos8, pos10),#save position, will be used below
          
          (try_begin),
            (game_in_multiplayer_mode),
            (position_set_x, pos23, 850),
            (assign, ":wind_angle1", "$WindDirection_variable"),
          (else_try),
            (prop_instance_get_position, pos2, "$wind_spr"),
            (position_get_rotation_around_z, ":wind_angle1", pos2),
          (try_end),
          
          (position_rotate_z, pos10, ":wind_angle1"),
          (position_rotate_z, pos10, 90),		# correct
          (overlay_set_mesh_rotation, "$g_presentation_naval_flag", pos10),
          
          ### MAIN UI
          (copy_position, pos10, pos8),
          (prop_instance_get_position, pos9, ":ship_instance"),
          (position_get_rotation_around_z, ":rotation", pos9),
          (position_rotate_z, pos10, ":rotation"),
          (position_rotate_z, pos10, -90),		# correct
          (overlay_set_mesh_rotation, "$g_presentation_naval_ship_a", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_ship_a_sail", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_frame", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_up_arrow", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_up_arrow_2", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_down_arrow", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_left_arrow", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_left_arrow_2", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_right_arrow", pos10),
          (overlay_set_mesh_rotation, "$g_presentation_naval_right_arrow_2", pos10),
          
          
          ### SAIL
          (scene_prop_get_slot, ":ship_sail", ":ship_instance", scene_prop_sail),
          (try_begin),
            (eq, ":ship_sail", 1),
            #(overlay_set_alpha, "$g_presentation_naval_ship_a_sail", 0x90),
            (overlay_set_alpha, "$g_presentation_naval_ship_a_sail", 0xFF),
          (try_end),
          
          ### ROWING COMMAND
          (scene_prop_get_slot, ":rowing", ":ship_instance", scene_prop_rowing),
          (try_begin),
            (eq, ":rowing", 100),
            (overlay_set_alpha, "$g_presentation_naval_up_arrow", 0xFF),
            (overlay_set_alpha, "$g_presentation_naval_up_arrow_2", 0xFF),
          (else_try),
            (eq, ":rowing", 50),
            (overlay_set_alpha, "$g_presentation_naval_up_arrow", 0xFF),
          (else_try),
            (eq, ":rowing", -50),
            (overlay_set_alpha, "$g_presentation_naval_down_arrow", 0xFF),
          (end_try),
          
          ### RUDDER COOMAND
          (scene_prop_get_slot, ":rudder", ":ship_instance", scene_prop_rudder),
          (try_begin),
            (eq, ":rudder", -100),
            (overlay_set_alpha, "$g_presentation_naval_right_arrow", 0xFF),
            (overlay_set_alpha, "$g_presentation_naval_right_arrow_2", 0xFF),
          (else_try),
            (eq, ":rudder", -50),
            (overlay_set_alpha, "$g_presentation_naval_right_arrow", 0xFF),
          (else_try),
            (eq, ":rudder", 50),
            (overlay_set_alpha, "$g_presentation_naval_left_arrow", 0xFF),
          (else_try),
            (eq, ":rudder", 100),
            (overlay_set_alpha, "$g_presentation_naval_left_arrow", 0xFF),
            (overlay_set_alpha, "$g_presentation_naval_left_arrow_2", 0xFF),
          (end_try),
          
          ### SPEED			# calculating speed in knots
          (scene_prop_get_slot, reg2, ":ship_instance", scene_prop_last_speed),
          (scene_prop_get_slot, ":ship_max_speed", ":ship_instance", scene_prop_max_speed),
          (scene_prop_get_slot, ":ship_quality", ":ship_instance", scene_prop_quality),
          (val_mul, reg2, ":ship_max_speed"),	# max speed in knots
          (val_mul, reg2, ":ship_quality"),		# low quality makes ship slower
          (val_div, reg2, 10000),
          (overlay_set_text, "$g_presentation_naval_speed", "@{reg2}"),
          
        (try_end),
    ]),
]),

# ("auto_save", 0, 0,
  # [
    # (ti_on_presentation_load,
      # [
        # (presentation_set_duration, 999999),
        # (set_fixed_point_multiplier, 1000),
        
        # (create_mesh_overlay, reg0, "mesh_mp_score_b"),
        # (position_set_x, pos1, 150),
        # (position_set_y, pos1, 165),
        # (overlay_set_position, reg0, pos1),
        # (position_set_x, pos1, 900),
        # (position_set_y, pos1, 700),
        # (overlay_set_size, reg0, pos1),
        
        # (create_text_overlay, reg0, "@Do you want to save your progress in Viking Conquest Campaign?", tf_double_space|tf_scrollable|tf_center_justify),
        # (overlay_set_color, reg0, 0xFFFFFF),
        # (position_set_x, pos1, 190),
        # (position_set_y, pos1, 260),
        # (overlay_set_position, reg0, pos1),
        # (position_set_x, pos1, 1200),
        # (position_set_y, pos1, 1200),
        # (overlay_set_size, reg0, pos1),
        # (position_set_x, pos1, 630),
        # (position_set_y, pos1, 210),
        # (overlay_set_area_size, reg0, pos1),
        
        # ##        ##plane
        # ##        (create_image_button_overlay, "$g_battle_report_plane", "mesh_white_plane", "mesh_white_plane"),
        # ##        (overlay_set_color, "$g_battle_report_plane", 0),
        # ##        (position_set_x, pos1, 15500),
        # ##        (position_set_y, pos1, 6000),
        # ##        (overlay_set_size, "$g_battle_report_plane", pos1),
        # ##        (position_set_x, pos1, 340),
        # ##        (position_set_y, pos1, 410),
        # ##        (overlay_set_position, "$g_battle_report_plane", pos1),
        # ##       # (overlay_set_alpha, "$g_battle_report_plane", 0x88),
        # ##         (overlay_set_alpha, "$g_battle_report_plane", 0x10),
        # ##       #  (overlay_set_color, "$g_battle_report_plane", 0x1166BB),#fondo azulado
        # ##         (overlay_set_color, "$g_battle_report_plane", 0xA28A56), #tan
        
        
        # ##		(try_begin),
        # ##		  (create_text_overlay, reg1, "@Do you want to save?", tf_center_justify),
        # ##		  (position_set_x, pos1, 500),
        # ##		  (position_set_y, pos1, 500),
        # ##		  (overlay_set_position, reg1, pos1),
        # ##		  (overlay_set_color, reg1, 0xFFFFFF), #White se ve bien
        # ##		  (position_set_x, pos1, 1100),
        # ##		  (position_set_y, pos1, 1100),
        # ##		  (overlay_set_size, reg1, pos1),
        # ##		(end_try),
        
        # # BUTTONS:
        # (create_button_overlay, "$save_game_yes", "@Yes.", tf_center_justify),
        # (position_set_x, pos1, 450),
        # (position_set_y, pos1, 215),
        # (overlay_set_position, "$save_game_yes", pos1),
        # (overlay_set_color, "$save_game_yes", 0xFFFFFF), #White se ve bien
        # (position_set_x, pos1, 950),
        # (position_set_y, pos1, 950),
        # (overlay_set_size, "$save_game_yes", pos1),
        # (create_button_overlay, "$save_game_no", "@No.", tf_center_justify),
        # (position_set_x, pos1, 550),
        # (position_set_y, pos1, 215),
        # (overlay_set_position, "$save_game_no", pos1),
        # (overlay_set_color, "$save_game_no", 0xFFFFFF), #White se ve bien
        # (position_set_x, pos1, 950),
        # (position_set_y, pos1, 950),
        # (overlay_set_size, "$save_game_no", pos1),
        
    # ]),
    
    # (ti_on_presentation_event_state_change,
      # [
        # (store_trigger_param_1, ":object"),
        
        # (try_begin),
          # (eq, ":object", "$save_game_yes"),
          # #(auto_save),
        # (end_try),
        # (presentation_set_duration, 0),
        
    # ]),
# ]),

##Read leer yes or no
("read_yesorno", 0, 0,
  [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        (create_mesh_overlay, reg0, "mesh_mp_score_b"),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 165),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 700),
        (overlay_set_size, reg0, pos1),
        
        (create_text_overlay, reg0, "@On several occasions throughout your life, you have seen the strange Latin letters. You quickly learn to read. Perhaps, in time, you will also learn to write!^^" +
        "This will require you to stay a week at the monastery. Do you still want to learn to read?", tf_double_space|tf_scrollable|tf_center_justify),
        (overlay_set_color, reg0, 0xFFFFFF),
        (position_set_x, pos1, 190),
        (position_set_y, pos1, 290),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1100),
        (position_set_y, pos1, 1100),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 630),
        (position_set_y, pos1, 210),
        (overlay_set_area_size, reg0, pos1),
        
        ##        (create_mesh_overlay, reg0, "mesh_mp_ui_welcome_panel"),
        ##            (position_set_x, pos1, 200),
        ##            (position_set_y, pos1, 400),
        ##            (overlay_set_position, reg0, pos1),
        ##      #   (overlay_set_color, reg0, 0xA28A56), #tan
        ####            (position_set_x, pos1, 1000),
        ####            (position_set_y, pos1, 1000),
        ####            (overlay_set_size, reg0, pos1),
        ##
        ##            (create_simple_text_box_overlay, reg0),
        ##            (position_set_x, pos1, 210),
        ##            (position_set_y, pos1, 400),
        ##            (overlay_set_position, reg0, pos1),
        ##            (position_set_x, pos1, 550),
        ##            (position_set_y, pos1, 150),
        ##           # (overlay_set_area_size, reg0, pos1),
        ##           (overlay_set_size, reg0, pos1),
        
        ##        (create_text_overlay, reg0, "@On several occasions throughout your life, you have seen the strange Latin letters, and therefore quickly learn how to read. Perhaps in time you will also learn how to write!^^ This will force you to stay a week at the monastery. You want to learn to read?", tf_scrollable),
        ##        (overlay_set_color, reg0, 0xFFFFFF),
        ##        (position_set_x, pos1, 230),
        ##        (position_set_y, pos1, 425), #of 425 to 445
        ##        (overlay_set_position, reg0, pos1),
        ##		  (position_set_x, pos1, 1000),
        ##		  (position_set_y, pos1, 1000),
        ##		  (overlay_set_size, reg0, pos1),
        ##        (position_set_x, pos1, 540),
        ##        (position_set_y, pos1, 150),
        ##        (overlay_set_area_size, reg0, pos1),
        
        # BUTTONS:
        (create_button_overlay, "$read_game_yes", "@Yes.", tf_center_justify),
        (position_set_x, pos1, 450),
        (position_set_y, pos1, 215),
        (overlay_set_position, "$read_game_yes", pos1),
        (overlay_set_color, "$read_game_yes", 0xFFFFFF), #White se ve bien
        (position_set_x, pos1, 950),
        (position_set_y, pos1, 950),
        (overlay_set_size, "$read_game_yes", pos1),
        (create_button_overlay, "$read_game_no", "@No.", tf_center_justify),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 215),
        (overlay_set_position, "$read_game_no", pos1),
        (overlay_set_color, "$read_game_no", 0xFFFFFF), #White se ve bien
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$read_game_no", pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        
        (try_begin),
          (eq, ":object", "$read_game_yes"),
          (rest_for_hours, 24 * 7, 40, 0), #rest while no attackable x20 speed
          (assign, "$sabe_leer", 1),
          (troop_remove_gold, "trp_player", 4000),
          (assign, "$read_game_no", -1),  #signal learning
        (end_try),
        (presentation_set_duration, 0),
        
    ]),
]),

###random events solution
#for juices
("random_event_solution", 0, mesh_load_window,
  [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        (create_mesh_overlay, reg0, "mesh_mp_score_b"),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 165),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 700),
        (overlay_set_size, reg0, pos1),
        
        (create_text_overlay, reg0, "@{s1}", tf_double_space|tf_scrollable|tf_center_justify),
        (overlay_set_color, reg0, 0xFFFFFF),
        (position_set_x, pos1, 190),
        (position_set_y, pos1, 290),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1100),
        (position_set_y, pos1, 1100),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 630),
        (position_set_y, pos1, 210),
        (overlay_set_area_size, reg0, pos1),
        
        
        # BUTTONS:
        (create_button_overlay,"$g_presentation_obj_4","str_continue",tf_right_align),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 215),
        (overlay_set_position, "$g_presentation_obj_4", pos1),
        (overlay_set_color, "$g_presentation_obj_4", 0xFFFFFF), #White se ve bien
        (position_set_x, pos1, 950),
        (position_set_y, pos1, 950),
        (overlay_set_size, "$g_presentation_obj_4", pos1),
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_4"),
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          (str_clear,s1),
          (assign, "$g_permitted_to_center",0),
          (change_screen_return,0),
          #  (change_screen_map),
        (try_end),
    ]),
]),
("random_event_normalsolution", 0, mesh_load_window,
  [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        (create_mesh_overlay, reg0, "mesh_mp_score_b"),
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 165),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 700),
        (overlay_set_size, reg0, pos1),
        
        (create_text_overlay, reg0, "@{s1}", tf_double_space|tf_scrollable|tf_center_justify),
        (overlay_set_color, reg0, 0xFFFFFF),
        (position_set_x, pos1, 190),
        (position_set_y, pos1, 290),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1100),
        (position_set_y, pos1, 1100),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 630),
        (position_set_y, pos1, 210),
        (overlay_set_area_size, reg0, pos1),
        
        
        # BUTTONS:
        (create_button_overlay,"$g_presentation_obj_4","str_continue",tf_right_align),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 215),
        (overlay_set_position, "$g_presentation_obj_4", pos1),
        (overlay_set_color, "$g_presentation_obj_4", 0xFFFFFF), #White se ve bien
        (position_set_x, pos1, 950),
        (position_set_y, pos1, 950),
        (overlay_set_size, "$g_presentation_obj_4", pos1),
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_4"),
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          (str_clear,s1),
          #(change_screen_return, 0),
          #  (change_screen_map),
          (jump_to_menu,"mnu_random_normal_events2"),
        (try_end),
    ]),
]),
#############

###phaiak chief town menu begin
("vc_menu", 0, 0,
  [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        # CONDITIONS
        (try_begin),
          (party_slot_eq,"$current_town",slot_party_type, spt_village),
          (call_script, "script_check_village_menu_conditions"),
        (else_try),
          (call_script, "script_check_town_menu_conditions"),
        (end_try),
        
        # BOARD
        (create_mesh_overlay, reg1, "mesh_vc_menu_board"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),
        
        # LOCATION INFO TEXT
        #(create_mesh_overlay, reg2, "mesh_mp_score_b"),
        (create_mesh_overlay, reg2, "mesh_white_plane"),
        (overlay_set_color, reg2, 0x000000),
        (overlay_set_alpha, reg2, 0xB0),
        
        (create_text_overlay, reg1, s30, tf_scrollable|tf_double_space|tf_center_justify),	#tf_with_outline|
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 850),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 660 * 50),
        #(position_set_y, pos1, 250 * 50),
        (position_set_y, pos1, 137 * 50),
        (overlay_set_size, reg2, pos1),
        (position_set_x, pos1, 660),
        #(position_set_y, pos1, 250),
        (position_set_y, pos1, 132),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 20),
        #(position_set_y, pos1, 470),
        (position_set_y, pos1, 600),
        (overlay_set_position, reg2, pos1),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0xDDDDDD),
        
        # LOCATION NAME
        (try_begin),
          (str_store_party_name, s2, "$current_town"),
          (create_text_overlay, reg1, s2, tf_with_outline|tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 660),
          (overlay_set_position, reg1, pos1),
          (overlay_set_color, reg1, 0xDDDDDD),
          (position_set_x, pos1, 1500),
          (position_set_y, pos1, 1500),
          (overlay_set_size, reg1, pos1),
        (end_try),
        
        # VC-1746:
        (assign, ":button_distance", 40),
        (assign, ":no_of_mno", 0),
        (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
          (quest_slot_ge, "qst_vc_menu", ":menu_slot", 1),
          (val_add, ":no_of_mno", 1),
          (ge, ":no_of_mno", 15),
          (val_sub, ":button_distance", 1),
        (end_try),
        
        # BUTTONS:
        (assign, ":button_y_position", 600),
        (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
          (quest_slot_ge, "qst_vc_menu", ":menu_slot", 1),
          (str_store_string_reg, s1,":menu_slot"),
          (create_button_overlay, reg1, s1, tf_center_justify),
          (quest_set_slot, "qst_vc_menu", ":menu_slot", reg1),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", ":button_distance"),
          (overlay_set_position, reg1, pos1),
        (end_try),
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        
        (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
          (quest_slot_eq, "qst_vc_menu", ":menu_slot", ":object"),
          (try_begin),
            # SUBMENU SHIPS
            (this_or_next|party_slot_eq,"$current_town",slot_party_type, spt_town),
            (party_slot_eq,"$current_town",slot_party_type, spt_castle),
            (eq, ":menu_slot", slot_quest_menu_town_port),		# = port
            (assign, "$ship_menu_state", 1),
            (assign, "$vc_menu_active", "prsnt_vc_submenu_ships"),
            (start_presentation, "$vc_menu_active"),
          (else_try),
            # SUBMENU RECRUITS in TOWNS AND CASTLES - LORDS PERMISSION
            (this_or_next|party_slot_eq,"$current_town",slot_party_type, spt_town),
            (party_slot_eq,"$current_town",slot_party_type, spt_castle),
            (eq, ":menu_slot", slot_quest_menu_town_recruit),		# = recruiting
            (assign, "$vc_menu_active", "prsnt_vc_submenu_recruits2"),
            (start_presentation, "$vc_menu_active"),
            (assign, "$hide_cam_move_with_black_screen", 1),
          (else_try),
            # SUBMENU RECRUITS
            (party_slot_eq,"$current_town",slot_party_type, spt_village),
            (eq, ":menu_slot", slot_quest_menu_village_recruit),	# = recruiting
            (assign, "$vc_menu_active", "prsnt_vc_submenu_recruits"),
            (start_presentation, "$vc_menu_active"),
            (assign, "$hide_cam_move_with_black_screen", 1),
          (else_try),
            # restore saved cam mode for all other mno's
            (set_camera_in_first_person, "$cam_first_person_mode"),

            # SCENE VISIT
            (assign, ":block", 0),
            (try_begin),
              (party_slot_eq,"$current_town",slot_party_type, spt_town),
              (eq, ":menu_slot", slot_quest_menu_town_visit),
            (else_try),
              (party_slot_eq,"$current_town",slot_party_type, spt_castle),
              (eq, ":menu_slot", slot_quest_menu_castle_visit),
            (else_try),
              (party_slot_eq,"$current_town",slot_party_type, spt_village),
              (eq, ":menu_slot", slot_quest_menu_village_visit),		# = visit center
              (neq, "$current_town", "p_village_150"),	# to avoid problems with the main story
            (else_try),
              (assign, ":block", 1),
            (end_try),
            (eq, ":block", 0),
            (mission_cam_set_mode, 0, 0, 0),
            (assign, "$vc_menu_active", 0),
            (presentation_set_duration, 0),
            (assign, "$hide_cam_move_with_black_screen", 1),
          (else_try),
            # SET SAIL
            (party_slot_eq,"$current_town",slot_party_type, spt_town),
            (eq, ":menu_slot", slot_quest_menu_town_sail),		# = set sail
            (try_begin),
              (call_script, "script_cf_crew_fit_in_ships", "$current_town"),
              (assign, "$vc_menu_active", 0),
              (assign, "$vc_menu_result", ":menu_slot"),
              (assign,"$g_leave_town",0),
              (finish_mission, 0),
            (else_try),
              (display_message, "str_cant_set_sail"),
            (end_try),
          (else_try),
            # ALL OTHERS
            (assign, "$vc_menu_active", 0),
            (assign, "$vc_menu_result", ":menu_slot"),
            (assign,"$g_leave_town",0),
            (finish_mission, 0),
          (end_try),
        (end_try),
    ]),
]),
####towns y castles
("vc_submenu_recruits2", 0, 0, #reclutar
  [
    (ti_on_presentation_load,
      [
        ### DELETE OLD VARIABLES
        (assign, "$vc_submenu_recruits_1", 0),
        (assign, "$vc_submenu_recruits_2", 0),
        (assign, "$vc_submenu_recruits_3", 0),
        (assign, "$vc_submenu_recruits_4", 0),
        #(assign, "$vc_submenu_recruits_mercs", 0),
        # JuJu70 - make it more realistic
        (troop_get_slot, ":religion","trp_player", slot_troop_religion),
        (party_get_slot, ":center_culture", "$current_town", slot_center_culture),
        (troop_get_slot, ":player_renown", "trp_player", slot_troop_renown), #renown
        (party_get_slot, ":center_relation", "$current_town", slot_center_player_relation),
        (party_get_slot, ":faith", "$current_town", slot_center_faithratio),
        ###
        (try_begin),
          (this_or_next|party_slot_eq, "$current_town", slot_town_lord, "trp_player"),	#chief add for recruit need to permission
          (party_slot_eq, "$current_town", recruit_permission_need, 0), 				#chief add for recruit need to permission
          (assign, ":block_recruiting", 0),
          
          (store_random_in_range, ":random_no", 0, 9),
          (assign, ":extra_vol", 1),
          ##renown adjustment
          (assign, ":upper_limit", 6),
          (try_begin),
            (ge, ":player_renown", 100),
            (store_sub, ":renown_bonus", ":player_renown", 100),
            (val_div, ":renown_bonus", 100),
            (val_add, ":upper_limit", ":renown_bonus"),
          (try_end),
          (try_begin),
            (party_slot_eq, "$current_town", slot_town_lord, "trp_player"), #player is lord
            (val_add, ":upper_limit", 2),
          (try_end),
          ## religious adjustment
          (try_begin),
            (eq, ":religion", 1),
            (val_mul, ":upper_limit", ":faith"),
            (val_div, ":upper_limit", 100),
            (val_add, ":upper_limit", 1),
          (else_try),
            (eq, ":religion", 2),
            (store_sub, ":p_faith", 100, ":faith"),
            (val_mul, ":upper_limit", ":p_faith"),
            (val_div, ":upper_limit", 100),
            (val_add, ":upper_limit", 1),
          (try_end),
          ## charisma adjustment
          (store_attribute_level, ":charisma", "trp_player", ca_charisma),
          (val_div, ":charisma", 10),
          (val_add, ":upper_limit", ":charisma"),
          (store_skill_level, ":leadership", "skl_leadership", "trp_player"),
          (val_div, ":leadership", 5),
          (val_add, ":upper_limit", ":leadership"),
          ## relation adjustment
          (try_begin),
            (ge, ":center_relation", 20), #chief change to 20
            (store_div, ":rec_bonus", ":center_relation", 20),
            (val_add, ":upper_limit", ":rec_bonus"),
          (else_try),
            (lt, ":center_relation", 0),
            (assign, ":upper_limit", 0),
          (try_end),
          
          
          
          
          # (try_begin),
          # (gt, ":center_relation", 60),
          # (val_add, ":extra_vol", 4),
          # (else_try),
          # (gt, ":center_relation", 30),
          # (val_add, ":extra_vol", 2),
          # (else_try),
          ##                   (gt, ":center_relation", 30),
          # (val_add, ":extra_vol", 0),
          # (try_end),
          
          (try_begin),
            (this_or_next|lt, ":center_relation", 0),
            (le, ":random_no", 1), #40% possibilites nobody want to join
            (assign, ":volunteer_amount", ":extra_vol"), #chief chage from 0 to 1 for frank request
          (else_try),
            (store_random_in_range, ":random_no2", 1, ":upper_limit"), #max 14 men, they are warband (old english werod) with a leader + standarbearer or horned + warriors
            (try_begin),
              (party_slot_eq,"$current_town",slot_party_type, spt_town),
              (party_get_slot, ":prosperity", "$current_town", slot_town_prosperity),
              (val_div, ":prosperity", 25),
              (val_add, ":random_no2", ":prosperity"),
            (try_end),
            (val_add, ":random_no2", ":extra_vol"),
            
            (assign, ":volunteer_amount", ":random_no2"),
          (try_end),
          
          (store_random_in_range, ":ram_troop", 0, 7),
          (try_begin),
            (gt, ":center_relation", 30),
            (eq, ":ram_troop", 1),
            (faction_get_slot, ":volunteer_troop", ":center_culture", slot_faction_tier_3_troop),
          (else_try),
            (gt, ":center_relation", 30),
            (eq, ":ram_troop", 2),
            (faction_get_slot, ":volunteer_troop", ":center_culture", slot_faction_tier_2_troop),
            (troop_get_upgrade_troop, ":upgrade_troop_no", ":volunteer_troop", 1),
            (try_begin),
              (le, ":upgrade_troop_no", 0),
              (troop_get_upgrade_troop, ":upgrade_troop_no", ":volunteer_troop", 0),
            (try_end),
            (gt, ":upgrade_troop_no", 0),
            (assign, ":volunteer_troop", ":upgrade_troop_no"),
          (else_try),
            (faction_get_slot, ":volunteer_troop", ":center_culture", slot_faction_tier_2_troop),
          (try_end),
        (try_end),
        
        (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
        (store_troop_gold, ":gold", "trp_player"),
        
        (store_character_level, ":troop_level", ":volunteer_troop"), #cost = level * 4 . Common: troop level 23 = 92 peningas, but player save time to upgrade and upgrade cost
        (val_mul, ":troop_level", 4),
        (assign, ":wage", ":troop_level"),
        #		  (call_script, "script_cost_per_village_recruit"),  #MOTO variable cost
        #		  (store_div, ":gold_capacity", ":gold", reg0),#10 peningas per man MOTO variable cost
        (store_div, ":gold_capacity", ":gold", ":wage"),
        (assign, ":party_capacity", ":free_capacity"),
        (val_min, ":party_capacity", ":gold_capacity"),
        (try_begin),
          (gt, ":party_capacity", 0),
          (val_min, ":volunteer_amount", ":party_capacity"),
        (try_end),
        (assign, reg5, ":volunteer_amount"),
        (assign, reg7, 0),
        (try_begin),
          (gt, ":volunteer_amount", ":gold_capacity"),
          (assign, reg7, 1), #not enough money
        (try_end),
        (try_begin),
          (eq, ":volunteer_amount", 0),
          (str_store_string, s18, "@No one here wants to join your party."),
          #(str_store_string, s19, "@But"),
        (else_try),
          (store_mul, reg6, ":volunteer_amount", ":wage"),
          (assign, "$temp", ":volunteer_amount"), #troop chief
          (assign, "$temp2", ":volunteer_troop"), #troop chief
          (str_store_troop_name_by_count, s3, ":volunteer_troop", ":volunteer_amount"),
          (try_begin),
            (eq, reg5, 1),
            (str_store_string, s18, "@One {s3} is willing to follow you."),
          (else_try),
            (str_store_string, s18, "@{reg5} {s3} are willing to follow you."),
          (try_end),
          #(str_store_string, s19, "@Also"),
          #(set_background_mesh, "mesh_pic_recruits"),
          # mnu_recruit_volunteers ends
        # (else_try),
          # (str_store_string, s18, "@You need to get the permission of the lord of this place to recruit here."),
          # #(str_store_string, s19, "@But"),
          # (party_get_slot, ":center_culture", "$current_town", slot_center_culture),
          # (faction_get_slot, ":volunteer_troop", ":center_culture", slot_faction_tier_2_troop),
          # (assign, ":volunteer_amount", 0),
          # (assign, reg7, 0),#
          # (assign, reg5, 1),#
          # (assign, ":block_recruiting", 1),
        (end_try),
        
        # (try_begin),		# change s18 if there are mercs in the tavern
        # (party_slot_eq,"$current_town",slot_party_type, spt_town),
        # (this_or_next|eq,"$entry_to_town_forbidden",0),
        # (eq, "$sneaked_into_town",1),
        # (party_get_slot, ":mercenary_troop", "$current_town", slot_center_mercenary_troop_type),
        # (party_get_slot, ":mercenary_amount", "$current_town", slot_center_mercenary_troop_amount),
        # (gt, ":mercenary_troop", 0),
        # (gt, ":mercenary_amount", 0),
        # (str_store_string, s18, "@{s18} {s19} there are leaderless men in the mead hall that can be hired."),
        # (end_try),
        
        # make recruits visible
        #		(try_begin),
        #			(gt, ":volunteer_amount", 0),
        (add_visitors_to_current_scene, 18, ":volunteer_troop",":volunteer_amount"),
        
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        #		(try_end),
        
        ### BOARD
        (create_mesh_overlay, reg1, "mesh_vc_menu_board"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),
        
        ### EXTRA BOARD
        (create_mesh_overlay, reg1, "mesh_vc_menu_board_addition"),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, 17),
        (overlay_set_position, reg1, pos1),
        (overlay_set_alpha, reg1, 0xA0),
        
        ### PLAYER MONEY
        (store_troop_gold, reg1, "trp_player"),
        (create_text_overlay, reg1, "str_reg1_denars", tf_center_justify),		#, tf_with_outline|tf_center_justify
        (position_set_x, pos1, 80),
        (position_set_y, pos1, 60),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (overlay_set_alpha, reg1, 0xA0),
        
        ### PLAYER PARTY CAPACITY
        (create_text_overlay, reg3, "str_in_your_party", tf_center_justify),
        (store_party_size_wo_prisoners, reg1, "p_main_party"),
        (call_script, "script_game_get_party_companion_limit"),
        (create_text_overlay, reg2, "@{!}{reg1}/{reg0}", tf_center_justify),
        (position_set_x, pos1, 80),
        (position_set_y, pos1, 40),
        (overlay_set_position, reg3, pos1),
        (position_set_y, pos1, 20),
        (overlay_set_position, reg2, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg3, pos1),
        (overlay_set_size, reg2, pos1),
        (overlay_set_alpha, reg3, 0xA0),
        (overlay_set_alpha, reg2, 0xA0),
        
        # LOCATION INFO TEXT
        (create_text_overlay, reg1, s18, tf_with_outline|tf_scrollable|tf_double_space|tf_center_justify),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 660),
        (position_set_y, pos1, 250),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 20),
        (position_set_y, pos1, 470),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0xDDDDDD),
        
        # BUTTONS:
        (assign, ":button_y_position", 600),
        
        (try_begin),
          (eq, reg7, 1),#
          (create_button_overlay, "$vc_submenu_recruits_1", "str_i_dont_have_enough_money", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 40),
          (overlay_set_position, "$vc_submenu_recruits_1", pos1),
        (end_try),
        (try_begin),
          (eq, reg7, 0),#
          (eq, reg5, 0),# No men
          (create_button_overlay, "$vc_submenu_recruits_2", "str_continue", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 40),
          (overlay_set_position, "$vc_submenu_recruits_2", pos1),
        (end_try),
        (try_begin),
          (eq, reg7, 0),#
          (gt, reg5, 0),#
          (eq, ":block_recruiting", 0),
          (create_button_overlay, "$vc_submenu_recruits_3", "@Recruit them ({reg6} peningas).", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 40),
          (overlay_set_position, "$vc_submenu_recruits_3", pos1),
        (end_try),
        ##		(try_begin),		# New hire Mercs MNO now here
        ##		  (party_slot_eq,"$current_town",slot_party_type, spt_town),
        ##		  (this_or_next|eq,"$entry_to_town_forbidden",0),
        ##		  (eq, "$sneaked_into_town",1),
        ##		  (party_get_slot, ":mercenary_troop", "$current_town", slot_center_mercenary_troop_type),
        ##		  (party_get_slot, ":mercenary_amount", "$current_town", slot_center_mercenary_troop_amount),
        ##		  (gt, ":mercenary_troop", 0),
        ##		  (gt, ":mercenary_amount", 0),
        ##		  (create_button_overlay, "$vc_submenu_recruits_mercs", "@Hire leaderless men.", tf_center_justify),
        ##		  (position_set_x, pos1, 850),
        ##		  (position_set_y, pos1, ":button_y_position"),
        ##		  (val_sub, ":button_y_position", 40),
        ##		  (overlay_set_position, "$vc_submenu_recruits_mercs", pos1),
        ##		(end_try),
        (try_begin),
          (eq, reg7, 0),#
          (gt, reg5, 0),#
          (create_button_overlay, "$vc_submenu_recruits_4", "str_forget_it", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 40),
          (overlay_set_position, "$vc_submenu_recruits_4", pos1),
        (end_try),
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        
        (try_begin),
          (eq, ":object", "$vc_submenu_recruits_1"), #no men
          (party_set_slot, "$current_town", recruit_permission_need, 3), #no recruit possibility x time
        (else_try),
          (eq, ":object", "$vc_submenu_recruits_2"), #no men
          (party_set_slot, "$current_town", recruit_permission_need, 3), #no recruit possibility x time
        (else_try),
          (eq, ":object", "$vc_submenu_recruits_3"),
          (assign, ":volunteer_troop", "$temp2"), #troop chief
          (assign, ":volunteer_amount", "$temp"), #troop chief
          
          (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
          (val_min, ":volunteer_amount", ":free_capacity"),
          (store_troop_gold, ":gold", "trp_player"),
          (store_character_level, ":troop_level", ":volunteer_troop"), #cost = level * 4 . Common: troop level 23 = 92 peningas, but player save time to upgrade and upgrade cost
          (val_mul, ":troop_level", 4),
          (assign, ":recruit_cost", ":troop_level"),
          (store_div, ":gold_capacity", ":gold", ":recruit_cost"),#
          (val_min, ":volunteer_amount", ":gold_capacity"),
          (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
          (store_mul, ":cost", ":volunteer_amount", ":recruit_cost"),
          (troop_remove_gold, "trp_player", ":cost"),
          (party_set_slot, "$current_town", recruit_permission_need, 3), #no recruit possibility x time
        (else_try),
          (eq, ":object", "$vc_submenu_recruits_4"), #NEW!
          (party_set_slot, "$current_town", recruit_permission_need, 3), #no recruit possibility x time
          # #new begin
          # (party_get_slot, ":mercenary_troop", "$current_town", slot_center_mercenary_troop_type),
          # (party_get_slot, ":cur_scene", "$current_town", slot_town_tavern),
          # (assign, "$talk_context", tc_tavern_talk),
          # (modify_visitors_at_site,":cur_scene"),
          # (reset_visitors),
          # (set_visitor,17,"trp_player"),
          # (set_visitor,18,":mercenary_troop"),
          # (set_jump_mission,"mt_conversation_encounter"),
          # (jump_to_scene,":cur_scene"),
          # (change_screen_map_conversation, ":mercenary_troop"),
          # #new end
        (try_end),
        (assign, "$temp", 0),
        (assign, "$vc_menu_active", "prsnt_vc_menu"),
        (start_presentation, "$vc_menu_active"),
        (assign, "$hide_cam_move_with_black_screen", 1),	#new!
        # VC-1986:
        #(party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
        (try_for_agents, ":agent"),
          (agent_get_troop_id, ":troop", ":agent"),
          (eq, ":troop", "$temp2"),
          (agent_fade_out, ":agent"),
        (end_try),
        (assign, "$temp2", 0),
    ]),
]),


#########villages
("vc_submenu_recruits", 0, 0,
  [
    (ti_on_presentation_load,
      [
        
        ### DELETE OLD VARIABLES
        (assign, "$vc_submenu_recruits_1", 0),
        (assign, "$vc_submenu_recruits_2", 0),
        (assign, "$vc_submenu_recruits_3", 0),
        (assign, "$vc_submenu_recruits_4", 0),
        
        (try_begin),
          (this_or_next|party_slot_eq, "$current_town", slot_town_lord, "trp_player"),	#chief add for recruit need to permission
          (party_slot_eq, "$current_town", recruit_permission_need, 0), 				#chief add for recruit need to permission
          (assign, ":block_recruiting", 0),
          # mnu_recruit_volunteers begins
          (party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
          (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
          (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
          (store_troop_gold, ":gold", "trp_player"),
          (call_script, "script_cost_per_village_recruit"),  #MOTO variable cost
          (assign, ":basic_cost", reg0),
          (store_character_level, ":level", ":volunteer_troop"),
          (val_sub, ":level", 12),
          (val_add, ":basic_cost", ":level"),
          (store_div, ":gold_capacity", ":gold", ":basic_cost"),#10 peningas per man MOTO variable cost
          (assign, ":party_capacity", ":free_capacity"),
          (val_min, ":party_capacity", ":gold_capacity"),
          (try_begin),
            (gt, ":party_capacity", 0),
            (val_min, ":volunteer_amount", ":party_capacity"),
          (try_end),
          (assign, reg5, ":volunteer_amount"),
          (assign, reg7, 0),
          (try_begin),
            (gt, ":volunteer_amount", ":gold_capacity"),
            (assign, reg7, 1), #not enough money
          (try_end),
          (try_begin),
            (eq, ":volunteer_amount", 0),
            (str_store_string, s18, "@No one here wants to join your party."),
          (else_try),
            (store_mul, reg6, ":volunteer_amount", reg0),#10 peningas per man MOTO variable cost
            (str_store_troop_name_by_count, s3, ":volunteer_troop", ":volunteer_amount"),
            (try_begin),
              (eq, reg5, 1),
              (str_store_string, s18, "@One {s3} volunteers to follow you."),
            (else_try),
              (str_store_string, s18, "@{reg5} {s3} volunteer to follow you."),
            (try_end),
            #(set_background_mesh, "mesh_pic_recruits"),
          (try_end),
          # mnu_recruit_volunteers ends
        (else_try),
          (str_store_string, s18, "@You need to get the permission of the village leader to recruit here."),
          (party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
          (assign, ":volunteer_amount", 0),
          (assign, reg7, 0),#
          (assign, reg5, 1),#
          (assign, ":block_recruiting", 1),
        (end_try),
        
        # make recruits visible
        #		(try_begin),
        #			(gt, ":volunteer_amount", 0),
        (add_visitors_to_current_scene, 9, ":volunteer_troop",":volunteer_amount"),
        
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        #		(try_end),
        
        ### BOARD
        (create_mesh_overlay, reg1, "mesh_vc_menu_board"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),
        
        ### EXTRA BOARD
        (create_mesh_overlay, reg1, "mesh_vc_menu_board_addition"),
        (position_set_x, pos1, 175),
        (position_set_y, pos1, 17),
        (overlay_set_position, reg1, pos1),
        (overlay_set_alpha, reg1, 0xA0),
        
        ### PLAYER MONEY
        (store_troop_gold, reg1, "trp_player"),
        (create_text_overlay, reg1, "str_reg1_denars", tf_center_justify),		#, tf_with_outline|tf_center_justify
        (position_set_x, pos1, 80),
        (position_set_y, pos1, 60),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (overlay_set_alpha, reg1, 0xA0),
        
        ### PLAYER PARTY CAPACITY
        (create_text_overlay, reg3, "str_in_your_party", tf_center_justify),
        (store_party_size_wo_prisoners, reg1, "p_main_party"),
        (call_script, "script_game_get_party_companion_limit"),
        (create_text_overlay, reg2, "@{!}{reg1}/{reg0}", tf_center_justify),
        (position_set_x, pos1, 80),
        (position_set_y, pos1, 40),
        (overlay_set_position, reg3, pos1),
        (position_set_y, pos1, 20),
        (overlay_set_position, reg2, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg3, pos1),
        (overlay_set_size, reg2, pos1),
        (overlay_set_alpha, reg3, 0xA0),
        (overlay_set_alpha, reg2, 0xA0),
        
        # LOCATION INFO TEXT
        (create_text_overlay, reg1, s18, tf_with_outline|tf_scrollable|tf_double_space|tf_center_justify),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 660),
        (position_set_y, pos1, 250),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 20),
        (position_set_y, pos1, 470),
        (overlay_set_position, reg1, pos1),
        (overlay_set_color, reg1, 0xDDDDDD),
        
        # BUTTONS:
        (assign, ":button_y_position", 600),
        
        (try_begin),
          (eq, reg7, 1),#
          (create_button_overlay, "$vc_submenu_recruits_1", "str_i_dont_have_enough_money", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 40),
          (overlay_set_position, "$vc_submenu_recruits_1", pos1),
        (end_try),
        (try_begin),
          (eq, reg7, 0),#
          (eq, reg5, 0),#
          (create_button_overlay, "$vc_submenu_recruits_2", "str_continue", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 40),
          (overlay_set_position, "$vc_submenu_recruits_2", pos1),
        (end_try),
        (try_begin),
          (eq, reg7, 0),#
          (gt, reg5, 0),#
          (eq, ":block_recruiting", 0),
          (create_button_overlay, "$vc_submenu_recruits_3", "@Recruit them ({reg6} peningas).", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 40),
          (overlay_set_position, "$vc_submenu_recruits_3", pos1),
        (end_try),
        (try_begin),
          (eq, reg7, 0),#
          (gt, reg5, 0),#
          (create_button_overlay, "$vc_submenu_recruits_4", "str_forget_it", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 40),
          (overlay_set_position, "$vc_submenu_recruits_4", pos1),
        (end_try),
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        
        (try_begin),
          (eq, ":object", "$vc_submenu_recruits_2"),
          (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
        (else_try),
          (eq, ":object", "$vc_submenu_recruits_3"),
          (call_script, "script_village_recruit_volunteers_recruit"),
          #		(else_try),
          #		  (eq, ":object", "$vc_submenu_recruits_4"),
          #		  (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
        (try_end),
        #(quest_set_slot, "qst_vc_menu", slot_quest_menu_village_recruit, 0),	# so you cannot go to recruit menu again
        (assign, "$vc_menu_active", "prsnt_vc_menu"),
        (start_presentation, "$vc_menu_active"),
        (assign, "$hide_cam_move_with_black_screen", 1),	#new!
        # VC-1986:
        (party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
        (try_for_agents, ":agent"),
          (agent_get_troop_id, ":troop", ":agent"),
          (eq, ":troop", ":volunteer_troop"),
          (agent_fade_out, ":agent"),
        (end_try),
    ]),
]),

("vc_submenu_ships", 0, 0,
  [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 100),
        
        ### IN PORT?
        (try_begin),
          (store_current_scene, ":cur_scene"),
          (eq, ":cur_scene", "scn_camp_on_sea"),
          (assign, ":in_port", 0),
        (else_try),
          (assign, ":in_port", 1),
        (end_try),
        
        ### DELETE OLD VARIABLES
        (assign, "$g_presentation_obj_ship_menu_my_ships", -1),
        (assign, "$g_presentation_obj_ship_menu_port_ships", -1),
        (assign, "$g_presentation_obj_ship_menu_move_up", -1),
        (assign, "$g_presentation_obj_ship_menu_repair", -1),
        (assign, "$g_presentation_obj_ship_menu_customize", -1),
        (assign, "$g_presentation_obj_ship_menu_buy", -1),
        (assign, "$g_presentation_obj_ship_menu_leave_ship", -1),
        (assign, "$g_presentation_obj_ship_menu_next", -1),
        (assign, "$g_presentation_obj_ship_menu_back", -1),
        (assign, "$g_presentation_obj_ship_menu_cheat", -1),
        (assign, "$g_presentation_obj_1", -1),
        (assign, "$g_presentation_obj_2", -1),
        
        ### SWITCH
        (try_begin),
          (eq, ":in_port", 1),
          (neq, "$g_encountered_party", "p_yourlair"),	#VC-1878
          (party_slot_eq, "$current_town", slot_party_1_ship_type, 0),
          (eq, "$ship_menu_state", 1),
          (assign, "$ship_menu_state", 8),
          (start_presentation, "prsnt_vc_submenu_ships"),
        (end_try),
        
        ### GET DATA OF CURRENT SHIP (TYPE, NAME, QUALITY)
        (store_sub, ":ship_menu_state_minus_one", "$ship_menu_state", 1),
        (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_type),
        (party_get_slot, "$ship_menu_current_ship_type", "$current_town", ":calculated_slot"),
        (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_name),
        (party_get_slot, "$ship_menu_current_ship_name", "$current_town", ":calculated_slot"),
        (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_quality),
        (party_get_slot, "$ship_menu_current_ship_quality", "$current_town", ":calculated_slot"),
        (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_propertys),
        (party_get_slot, "$ship_menu_current_ship_propertys", "$current_town", ":calculated_slot"),
        
        
        
        ### CALCULATE CAM DISTANCE
        (try_begin),
          (gt, "$ship_menu_current_ship_type", 0),
          (call_script, "script_get_ship_properties", "$ship_menu_current_ship_type"),
          (store_mul, "$vc_submenu_cam_distance", reg4, -150),
          (val_div, "$vc_submenu_cam_distance", 100),
        (else_try),
          (assign, "$vc_submenu_cam_distance", -1500),
        (end_try),
        
        (set_fixed_point_multiplier, 1000),
        
        ### BOARD
        (create_mesh_overlay, reg1, "mesh_vc_menu_board"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),
        
        ### GO TO MY SHIPS/ GO TO PORT SHIPS
        (try_begin),
          (eq, ":in_port", 1),
          (neq, "$g_encountered_party", "p_yourlair"),	#VC-1878
          (neg|party_slot_eq, "$current_town", slot_party_1_ship_type, 0),
          #(neg|party_slot_eq, "$current_town", slot_party_8_ship_type, 0),
          (try_begin),
            (is_between, "$ship_menu_state", 1, 8),
            (create_image_button_overlay, "$g_presentation_obj_ship_menu_my_ships", "mesh_ship_menu_tab2", "mesh_ship_menu_tab2"),
            (create_image_button_overlay, "$g_presentation_obj_ship_menu_port_ships", "mesh_ship_menu_tab1", "mesh_ship_menu_tab2"),
          (else_try),
            (create_image_button_overlay, "$g_presentation_obj_ship_menu_my_ships", "mesh_ship_menu_tab1", "mesh_ship_menu_tab2"),
            (create_image_button_overlay, "$g_presentation_obj_ship_menu_port_ships", "mesh_ship_menu_tab2", "mesh_ship_menu_tab2"),
          (end_try),
          (create_text_overlay, reg1, "@My Boats"),
          (create_text_overlay, reg2, "@Boats for Sale"),
          (position_set_x, pos1, 370),
          (position_set_y, pos1, 370),
          (overlay_set_size, "$g_presentation_obj_ship_menu_my_ships", pos1),
          (overlay_set_size, "$g_presentation_obj_ship_menu_port_ships", pos1),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 700),
          (overlay_set_size, reg1, pos1),
          (overlay_set_size, reg2, pos1),
          (overlay_set_alpha, "$g_presentation_obj_ship_menu_my_ships", 0xB0),
          (overlay_set_alpha, "$g_presentation_obj_ship_menu_port_ships", 0xB0),
          
          (position_set_x, pos1, 770),
          #(position_set_y, pos1, 720),
          (position_set_y, pos1, 715),
          (overlay_set_position, "$g_presentation_obj_ship_menu_my_ships", pos1),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 851),
          #(position_set_y, pos1, 720),
          (position_set_y, pos1, 715),
          (overlay_set_position, "$g_presentation_obj_ship_menu_port_ships", pos1),
          (overlay_set_position, reg2, pos1),
          (try_begin),
            (ge, "$ship_menu_state", 8),
            (overlay_set_alpha, reg1, 0xF0),
          (else_try),
            (overlay_set_alpha, reg2, 0xF0),
          (end_try),
        (end_try),
        ###
        
        (try_begin),
          # If there is no ship...
          (eq, "$ship_menu_current_ship_type", 0),
          (create_text_overlay, reg1, "@No ships for sale^in this town.", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 400),
          (overlay_set_position, reg1, pos1),
        (else_try),
          # If there are ships...
          
          ### SHIP NAME
          (try_begin),
            (is_between, "$ship_menu_current_ship_name", "trp_pseudo_troop_01", "trp_pseudo_troop_end"),
            (str_store_troop_name, s1, "$ship_menu_current_ship_name"),
          (else_try),
            (str_store_string, s1, "$ship_menu_current_ship_name"),
          (end_try),
          
          (try_begin),
            (str_is_empty, s1),
            (str_store_string, s1, "@No Name"),
          (end_try),
          
          (try_begin),
            (create_text_overlay, reg2, s1, tf_with_outline|tf_center_justify),	#tf_vertical_align_center
            (overlay_set_color, reg2, 0xDDDDDD),
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 660),
            (overlay_set_position, reg2, pos1),
            (position_set_x, pos1, 1500),
            (position_set_y, pos1, 1500),
            (overlay_set_size, reg2, pos1),
          (end_try),
          
          ### SHIP NUMBER/MOVE UP
          (try_begin),
            (lt, "$ship_menu_state", 8),	#only for player ships
            (assign, reg7, "$ship_menu_state"),
            (try_begin),
              (gt, "$ship_menu_state", 1),
              (str_store_string, s2, "@{reg7}. Ship"),
            (else_try),
              (str_store_string, s2, "@Flagship"),
            (end_try),
            (create_button_overlay, "$g_presentation_obj_ship_menu_move_up", s2, tf_center_justify),	#tf_vertical_align_center
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 580),
            (overlay_set_position, "$g_presentation_obj_ship_menu_move_up", pos1),
            (eq, "$ship_menu_state", 1),	# transparency for flagship
            (overlay_set_alpha, "$g_presentation_obj_ship_menu_move_up", 0x88),
          (end_try),
          
          ### SHIP Properties
          # CONDITION
          (try_begin),
            (gt, "$ship_menu_current_ship_quality", 80),
            (str_store_string, s1, "@Very Good"),
          (else_try),
            (gt, "$ship_menu_current_ship_quality", 60),
            (str_store_string, s1, "@Good"),
          (else_try),
            (gt, "$ship_menu_current_ship_quality", 40),
            (str_store_string, s1, "@Acceptable"),
          (else_try),
            (gt, "$ship_menu_current_ship_quality", 20),
            (str_store_string, s1, "@Bad"),
          (else_try),
            (gt, "$ship_menu_current_ship_quality", 5),
            (str_store_string, s1, "@Very Bad"),
          (else_try),
            (str_store_string, s1, "@Dangerous"),
          (end_try),
          
          # WOOD
          (call_script, "script_decode_value", "$ship_menu_current_ship_propertys"),
          (assign, ":ship_wood", reg1),
          (try_begin),
            (eq, ":ship_wood", 1),
            (str_store_string, s6, "str_ship_wood_1"),
          (else_try),
            (eq, ":ship_wood", 2),
            (str_store_string, s6, "str_ship_wood_2"),
          (else_try),
            (str_store_string, s6, "str_ship_wood_3"),
          (end_try),
          
          # PRICES etc.
          (call_script, "script_calculate_ship_value", "$ship_menu_current_ship_type", "$ship_menu_current_ship_quality", ":ship_wood"),
          (assign, "$ship_menu_current_ship_price", reg0),
          (call_script, "script_calculate_ship_value", "$ship_menu_current_ship_type", 100, ":ship_wood"),
          (store_sub, "$ship_menu_current_ship_repair_costs", reg0, "$ship_menu_current_ship_price"),
          (assign, reg8, "$ship_menu_current_ship_repair_costs"),
          (try_begin),
            (eq, ":in_port", 1),
            (gt, "$ship_menu_current_ship_repair_costs", 0),
            (str_store_string, s2, "@Repair: {reg8} peningas"),
          (else_try),
            (str_clear, s2),
          (end_try),
          (party_get_skill_level, ":trade_skill", "p_main_party", "skl_trade"),
          (try_begin),
            (ge, "$ship_menu_state", 8),	# to guarantee: buying price > selling price
            (store_sub, ":price_in_percent_plus_calculated_trade_penalty", 120, ":trade_skill"),
          (else_try),
            (store_add, ":price_in_percent_plus_calculated_trade_penalty", 80, ":trade_skill"),
            (val_div, ":price_in_percent_plus_calculated_trade_penalty", 3),	#new: to avoid exploit with ship selling
          (end_try),
          (val_mul, "$ship_menu_current_ship_price", ":price_in_percent_plus_calculated_trade_penalty"),
          (val_div, "$ship_menu_current_ship_price", 100),
          (val_div, "$ship_menu_current_ship_price", 100), # make price look better
          (val_mul, "$ship_menu_current_ship_price", 100),
          (call_script,  "script_get_ship_properties", "$ship_menu_current_ship_type"),
          (str_store_string, s7, reg7), #type_name
          (assign, reg7, "$ship_menu_current_ship_price"),
          (create_text_overlay, reg0, "@Type: {s7}^Wood: {s6}^Condition: {s1}^Speed: {reg1} knots^Crew: {reg6} men^Price: {reg7} peningas^{s2}", tf_double_space),
          (position_set_x, pos1, 725),
          (position_set_y, pos1, 320),
          (overlay_set_position, reg0, pos1),
          (overlay_set_alpha, reg0, 0x88),
          
          ### REPAIR
          (try_begin),
            (eq, ":in_port", 1),
            (is_between, "$ship_menu_state", 1, 8),
            (store_sub, ":ship_menu_state_minus_one", "$ship_menu_state", 1),
            (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_quality),
            (neg|party_slot_eq, "$current_town", ":calculated_slot", 100),	#no repair button if ship is 100%
            (create_button_overlay, "$g_presentation_obj_ship_menu_repair", "@Repair Ship", tf_center_justify),
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 210),
            (overlay_set_position, "$g_presentation_obj_ship_menu_repair", pos1),
          (end_try),
          
          ### CUSTOMIZE
          (try_begin),
            (eq, ":in_port", 1),
            (neq, "$g_encountered_party", "p_yourlair"),	#VC-1878
            (is_between, "$ship_menu_state", 1, 8),
            (create_button_overlay, "$g_presentation_obj_ship_menu_customize", "@Customize Ship", tf_center_justify),
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 170),
            (overlay_set_position, "$g_presentation_obj_ship_menu_customize", pos1),
          (end_try),
          
          ### BUY/SELL 1
          (try_begin),
            (eq, ":in_port", 1),
            (neq, "$g_encountered_party", "p_yourlair"),	#VC-1878
            (try_begin),
              (is_between, "$ship_menu_state", 1, 8),
              (str_store_string, s1, "@Sell Ship"),
            (else_try),
              (str_store_string, s1, "@Buy Ship"),
            (end_try),
            (create_button_overlay, "$g_presentation_obj_1", s1, tf_center_justify),
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 130),
            (overlay_set_position, "$g_presentation_obj_1", pos1),
          (end_try),
          
          # WARNING
          (create_text_overlay, "$g_presentation_obj_2", "@Are you sure you want to do this transaction?", tf_with_outline|tf_scrollable|tf_double_space|tf_center_justify),
          (position_set_x, pos1, 1000),
          (position_set_y, pos1, 1000),
          (overlay_set_size, "$g_presentation_obj_2", pos1),
          (position_set_x, pos1, 660),
          (position_set_y, pos1, 250),
          (overlay_set_area_size, "$g_presentation_obj_2", pos1),
          (position_set_x, pos1, 20),
          (position_set_y, pos1, 470),
          (overlay_set_position, "$g_presentation_obj_2", pos1),
          (overlay_set_color, "$g_presentation_obj_2", 0xDDDDDD),
          (overlay_set_display, "$g_presentation_obj_2", 0),
          
          ### BUY/SELL 2
          (try_begin),
            (eq, ":in_port", 1),
            (neq, "$g_encountered_party", "p_yourlair"),	#VC-1878
            (try_begin),
              (is_between, "$ship_menu_state", 1, 8),
              (str_store_string, s1, "@Sell Ship"),
            (else_try),
              (str_store_string, s1, "@Buy Ship"),
            (end_try),
            (create_button_overlay, "$g_presentation_obj_ship_menu_buy", s1, tf_center_justify),
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 130),
            (overlay_set_position, "$g_presentation_obj_ship_menu_buy", pos1),
            (overlay_set_display, "$g_presentation_obj_ship_menu_buy", 0),
          (end_try),
          
          ### LEAVE SHIP (SPLIT FLEET)
          (try_begin),
            (eq, ":in_port", 0),
            (neq, "$g_encountered_party", "p_yourlair"),	#VC-1878
            (str_store_string, s1, "@Leave ship at the shore"),
            (create_button_overlay, "$g_presentation_obj_ship_menu_leave_ship", s1, tf_center_justify),
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 130),
            (overlay_set_position, "$g_presentation_obj_ship_menu_leave_ship", pos1),
          (end_try),
          
          ### NEXT
          (create_button_overlay, "$g_presentation_obj_ship_menu_next", "@Next ship", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 90),
          (overlay_set_position, "$g_presentation_obj_ship_menu_next", pos1),
          (party_get_slot, ":ship_slot_2_type", "$current_town", slot_party_2_ship_type),
          (party_get_slot, ":ship_slot_9_type", "$current_town", slot_party_9_ship_type),
          (try_begin),
            (eq, "$ship_menu_state", 1),
            (eq, ":ship_slot_2_type", 0),
            (overlay_set_alpha,"$g_presentation_obj_ship_menu_next", 0x88), #alpha in A format like 0xAA
          (else_try),
            (eq, "$ship_menu_state", 8),
            (eq, ":ship_slot_9_type", 0),
            (overlay_set_alpha,"$g_presentation_obj_ship_menu_next", 0x88),
          (end_try),
          
          ### EXTRA BOARD
          (create_mesh_overlay, reg1, "mesh_vc_menu_board_addition"),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, 17),
          (overlay_set_position, reg1, pos1),
          (overlay_set_alpha, reg1, 0xA0),
          
          ### PLAYER MONEY
          (store_troop_gold, reg1, "trp_player"),
          (create_text_overlay, reg1, "str_reg1_denars", tf_center_justify),		#, tf_with_outline|tf_center_justify
          (position_set_x, pos1, 80),
          (position_set_y, pos1, 60),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (overlay_set_alpha, reg1, 0xA0),
          
          ### PLAYER FLEET CAPACITY
          (try_begin),
            (try_begin),
              (call_script, "script_cf_crew_fit_in_ships", "$current_town"),
            (try_end),
            (create_text_overlay, reg3, "@Fleet Capacity:", tf_center_justify),		#, tf_right_align|tf_with_outline|
            (create_text_overlay, reg0, "@{reg1}/{reg2}", tf_center_justify),
            (position_set_x, pos1, 80),
            (position_set_y, pos1, 40),
            (overlay_set_position, reg3, pos1),
            (position_set_y, pos1, 20),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg3, pos1),
            (overlay_set_size, reg0, pos1),
            (overlay_set_alpha, reg3, 0xA0),
            (overlay_set_alpha, reg0, 0xA0),
            (try_begin),
              (gt, reg1, reg2),
              (overlay_set_color, reg0, 0xAA0000),
            (try_end),
          (try_end),
          
        (end_try),
        
        ### CHEAT
        (try_begin),
          (eq, "$cheat_mode", 1),
          (eq, ":in_port", 1),
          (create_button_overlay, "$g_presentation_obj_ship_menu_cheat", "@{!}CHEAT: New Ships.", tf_center_justify),
          (position_set_x, pos1, 100),
          (position_set_y, pos1, 130),
          (overlay_set_position, "$g_presentation_obj_ship_menu_cheat", pos1),
        (end_try),
        
        ### BACK
        (create_button_overlay, "$g_presentation_obj_ship_menu_back", "str_back", tf_center_justify),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 50),
        (overlay_set_position, "$g_presentation_obj_ship_menu_back", pos1),
        
    ]),
    
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        #(store_trigger_param_2, ":value"),
        (try_begin),
          
          ### NEXT
          (eq, ":object", "$g_presentation_obj_ship_menu_next"),
          
          # Check if there is a second ship
          (assign, ":no_second_ship", 0),
          (party_get_slot, ":ship_slot_2_type", "$current_town", slot_party_2_ship_type),
          (party_get_slot, ":ship_slot_9_type", "$current_town", slot_party_9_ship_type),
          (try_begin),
            (eq, "$ship_menu_state", 1),
            (eq, ":ship_slot_2_type", 0),
            (assign, ":no_second_ship", 1),
          (else_try),
            (eq, "$ship_menu_state", 8),
            (eq, ":ship_slot_9_type", 0),
            (assign, ":no_second_ship", 1),
          (end_try),
          
          # Check if next ship slot is empty
          (store_add, ":next_slot", slot_party_player_ships_type_begin, "$ship_menu_state"),
          (party_get_slot, ":next_ship_type", "$current_town", ":next_slot"),
          
          (try_begin),
            (eq, ":no_second_ship", 0),
            (neq, ":next_ship_type", 0),
            (this_or_next|is_between, "$ship_menu_state", 1, 7),
            (is_between, "$ship_menu_state", 8, 10),
            (val_add, "$ship_menu_state", 1),
          (else_try),
            (is_between, "$ship_menu_state", 1, 8),
            #(eq, ":next_ship_type", 0),
            (assign, "$ship_menu_state", 1),
          (else_try),
            #(this_or_next|eq, "$ship_menu_state", 10),
            #(eq, ":next_ship_type", 0),
            (assign, "$ship_menu_state", 8),
          (try_end),
          #(presentation_set_duration, 0),
          (start_presentation, "prsnt_vc_submenu_ships"),
          
        (else_try),
          ### GO TO MY SHIPS
          (eq, ":object", "$g_presentation_obj_ship_menu_my_ships"),
          
          (is_between, "$ship_menu_state", 8, 11),
          (assign, "$ship_menu_state", 1),
          (presentation_set_duration, 0),
          (start_presentation, "prsnt_vc_submenu_ships"),
          
        (else_try),
          ### GO TO PORT SHIPS
          (eq, ":object", "$g_presentation_obj_ship_menu_port_ships"),
          
          (is_between, "$ship_menu_state", 1, 8),
          (assign, "$ship_menu_state", 8),
          (presentation_set_duration, 0),
          (start_presentation, "prsnt_vc_submenu_ships"),
          
        (else_try),
          ### MOVE UP
          (eq, ":object", "$g_presentation_obj_ship_menu_move_up"),
          (gt, "$ship_menu_state", 1),	#first ship cant be moved up
          #
          (store_sub, ":ship_menu_state_minus_two", "$ship_menu_state", 2),
          (store_add, ":calculated_slot", ":ship_menu_state_minus_two", slot_party_1_ship_type),
          (party_get_slot, ":ship2_ship_type", "$current_town", ":calculated_slot"),
          (party_set_slot, "$current_town", ":calculated_slot", "$ship_menu_current_ship_type"),
          (val_add, ":calculated_slot", 1),
          (party_set_slot, "$current_town", ":calculated_slot", ":ship2_ship_type"),
          (store_add, ":calculated_slot", ":ship_menu_state_minus_two", slot_party_1_ship_name),
          (party_get_slot, ":ship2_ship_name", "$current_town", ":calculated_slot"),
          (party_set_slot, "$current_town", ":calculated_slot", "$ship_menu_current_ship_name"),
          (val_add, ":calculated_slot", 1),
          (party_set_slot, "$current_town", ":calculated_slot", ":ship2_ship_name"),
          (store_add, ":calculated_slot", ":ship_menu_state_minus_two", slot_party_1_ship_quality),
          (party_get_slot, ":ship2_ship_quality", "$current_town", ":calculated_slot"),
          (party_set_slot, "$current_town", ":calculated_slot", "$ship_menu_current_ship_quality"),
          (val_add, ":calculated_slot", 1),
          (party_set_slot, "$current_town", ":calculated_slot", ":ship2_ship_quality"),
          (store_add, ":calculated_slot", ":ship_menu_state_minus_two", slot_party_1_ship_propertys),
          (party_get_slot, ":ship2__ship_propertys", "$current_town", ":calculated_slot"),
          (party_set_slot, "$current_town", ":calculated_slot", "$ship_menu_current_ship_propertys"),
          (val_add, ":calculated_slot", 1),
          (party_set_slot, "$current_town", ":calculated_slot", ":ship2__ship_propertys"),
          #
          (store_sub, ":ship_menu_state_minus_one", "$ship_menu_state", 1),
          (scene_prop_get_num_instances, ":number_of_ships", "spr_dyn_ship_substrate"),
          (call_script, "script_move_ship_instance_from_slot_to_slot", "$ship_menu_state", 0), #new
          (try_for_range,":ship_number", 0, ":number_of_ships"),	# exchange ships if there is already one at destinantion
            (scene_prop_get_instance, ":ship_instance", "spr_dyn_ship_substrate", ":ship_number"),
            (scene_prop_slot_eq, ":ship_instance", scene_prop_ship_number, ":ship_menu_state_minus_one"),
            (call_script, "script_move_ship_instance_from_slot_to_slot", ":ship_menu_state_minus_one", "$ship_menu_state"),
          (end_try),
          (call_script, "script_move_ship_instance_from_slot_to_slot", 0, ":ship_menu_state_minus_one"),
          #
          (val_sub, "$ship_menu_state", 1),
          (start_presentation, "prsnt_vc_submenu_ships"),
          (mission_cam_set_screen_color, 0xFF000000),
          (assign, "$hide_cam_move_with_black_screen", 2),	#new!
          
        (else_try),
          ### BUY/SELL (FIRST STEP)
          (eq, ":object", "$g_presentation_obj_1"),
          
          (overlay_set_display, "$g_presentation_obj_ship_menu_buy", 1),#!
          (overlay_set_display, "$g_presentation_obj_1", 0),
          (overlay_set_display, "$g_presentation_obj_2", 1),
          
        (else_try),
          ### BUY/SELL (SECOND STEP)
          (eq, ":object", "$g_presentation_obj_ship_menu_buy"),
          
          (assign, ":no_room_left", 0),#new
          (assign, ":blocking", 0),		### CONDITIONS FOR TRANSACTION
          (try_begin),
            (is_between, "$ship_menu_state", 1, 8),						# = Player wants to SELL
            (try_begin),# improvement VC-1574
              (party_slot_ge, "$current_town", slot_party_10_ship_type, 1),
              (assign, ":no_room_left", 1),
            (end_try),
          (else_try),
            (party_get_slot, ":ship_type", "$current_town", slot_party_7_ship_type),
            (store_troop_gold,":money","trp_player"),
            
            (try_begin),
              (neq, ":ship_type", 0),
              (assign, ":blocking", 1),
              #(display_message, "@You cannot buy this boat, because you cannot have more then seven boats."),
              (display_message, "@You cannot buy this boat, as it requires a Sea-King skill to manage boats."),
            (else_try),
              (store_skill_level, ":cur_sea_king_skill", "skl_sea_king", "trp_player"),
              (le, ":cur_sea_king_skill", 0),
              (assign, ":blocking", 1),
              (display_message, "@You cannot buy this boat, because you don't have the Sea-King skill."),
            (else_try),
              #(gt, ":cur_sea_king_skill", 0),
              (val_mul, ":cur_sea_king_skill", 2),	#new skill adjust
              (val_min, ":cur_sea_king_skill", 7),	#new skill adjust
              (val_sub, ":cur_sea_king_skill", 1),
              (store_add, ":slot", slot_party_1_ship_type, ":cur_sea_king_skill"),
              (party_get_slot, ":ship_type", "$current_town", ":slot"),
              (neq, ":ship_type", 0),
              (assign, ":blocking", 1),
              (display_message, "@You cannot buy this boat, as it requires a higher Sea-King skill to manage more boats."),
            (else_try),
              (lt, ":money", "$ship_menu_current_ship_price"),
              (assign, ":blocking", 1),
              (display_message, "@You cannot buy this boat, because you don't have enough money."),
            (end_try),
          (end_try),
          
          (eq, ":blocking", 0),
          
          (try_begin),
            (is_between, "$ship_menu_state", 1, 8),						# = SELL
            (assign, ":lower_bound", slot_party_alien_ships_type_begin),
            (assign, ":upper_bound", slot_party_alien_ships_type_end),
            (troop_add_gold, "trp_player", "$ship_menu_current_ship_price"),
          (else_try),
            (assign, ":lower_bound", slot_party_player_ships_type_begin),# = BUY
            (assign, ":upper_bound", slot_party_player_ships_type_end),
            (troop_remove_gold, "trp_player", "$ship_menu_current_ship_price"),
          (end_try),
          
          (try_begin),	# Give ship to destination
            (eq, ":no_room_left", 1),	#new
            (call_script, "script_move_ship_instance_from_slot_to_nowhere", "$ship_menu_state"),
            (assign, ":destination_slot_no", 8),
          (else_try),
            (assign, ":give_ship_completed", 0),
            (try_for_range, ":current_ship_type_slot", ":lower_bound", ":upper_bound"),
              (eq, ":give_ship_completed", 0),
              (party_get_slot, ":ship_type", "$current_town", ":current_ship_type_slot"),
              (neg|is_between, ":ship_type", 1,10),
              (store_sub, ":destination_slot_no", ":current_ship_type_slot", slot_party_player_ships_type_begin),
              (val_add, ":destination_slot_no", 1),
              (party_set_slot, "$current_town", ":current_ship_type_slot", "$ship_menu_current_ship_type"),
              (store_sub, ":slot_number", ":current_ship_type_slot", slot_party_player_ships_type_begin),
              (store_add, ":current_ship_name_slot", slot_party_player_ships_name_begin, ":slot_number"),
              (party_set_slot, "$current_town", ":current_ship_name_slot", "$ship_menu_current_ship_name"),
              (store_add, ":current_ship_quality_slot", slot_party_player_ships_quality_begin, ":slot_number"),
              (party_set_slot, "$current_town", ":current_ship_quality_slot", "$ship_menu_current_ship_quality"),
              (store_add, ":current_ship_propertys_slot", slot_party_player_ships_propertys_begin, ":slot_number"),
              (party_set_slot, "$current_town", ":current_ship_propertys_slot", "$ship_menu_current_ship_propertys"),
              #
              (call_script, "script_move_ship_instance_from_slot_to_slot", "$ship_menu_state", ":destination_slot_no"),	#!!!
              #
              (assign, ":give_ship_completed", 1),
              #(display_message, "@I give ship to destination"),
            (end_try),
          (end_try),
          
          (try_begin),	# Has to be turned around now !!!
            (is_between, "$ship_menu_state", 1, 8),						# = SELL
            (assign, ":upper_bound", slot_party_player_ships_type_end),
          (else_try),
            (assign, ":upper_bound", slot_party_alien_ships_type_end),# = BUY
          (end_try),
          
          (try_begin),	# delete ship from origin
            #(this_or_next|eq, ":give_ship_completed", 1),
            #(is_between, "$ship_menu_state", 1, 8),			# If Town doesnt have enough slots to buy a ship, it is still ok
            #(assign, ":delte_ship_completed", 0),
            (store_add, ":current_ship_type_slot", slot_party_player_ships_type_begin, "$ship_menu_state"),
            (val_sub, ":current_ship_type_slot", 1), # Correction
            (party_set_slot, "$current_town", ":current_ship_type_slot", 0),
            # Now we fill the gap in the entrys
            (store_add, ":correction_begin", ":current_ship_type_slot", 1),
            (try_for_range, ":current_ship_type_slot_c", ":correction_begin", ":upper_bound"),
              (party_get_slot, ":ship_type", "$current_town", ":current_ship_type_slot_c"),
              (neq, ":ship_type", 0),
              (store_add, ":current_ship_name_slot_c", ":current_ship_type_slot_c", 10),
              (store_add, ":current_ship_qual_slot_c", ":current_ship_type_slot_c", 20),
              (store_add, ":current_ship_prop_slot_c", ":current_ship_type_slot_c", 30),
              (party_get_slot, ":ship_name", "$current_town", ":current_ship_name_slot_c"),
              (party_get_slot, ":ship_qual", "$current_town", ":current_ship_qual_slot_c"),
              (party_get_slot, ":ship_prop", "$current_town", ":current_ship_prop_slot_c"),
              
              (store_sub, ":current_ship_type_slot_c_minus_one", ":current_ship_type_slot_c", 1),
              (store_sub, ":current_ship_name_slot_c_minus_one", ":current_ship_name_slot_c", 1),
              (store_sub, ":current_ship_qual_slot_c_minus_one", ":current_ship_qual_slot_c", 1),
              (store_sub, ":current_ship_prop_slot_c_minus_one", ":current_ship_prop_slot_c", 1),
              
              (party_set_slot, "$current_town", ":current_ship_type_slot_c_minus_one", ":ship_type"),
              (party_set_slot, "$current_town", ":current_ship_name_slot_c_minus_one", ":ship_name"),
              (party_set_slot, "$current_town", ":current_ship_qual_slot_c_minus_one", ":ship_qual"),
              (party_set_slot, "$current_town", ":current_ship_prop_slot_c_minus_one", ":ship_prop"),
              
              (party_set_slot, "$current_town", ":current_ship_type_slot_c", 0),
              (party_set_slot, "$current_town", ":current_ship_name_slot_c", 0),
              (party_set_slot, "$current_town", ":current_ship_qual_slot_c", 0),
              (party_set_slot, "$current_town", ":current_ship_prop_slot_c", 0),
              # >
              (store_sub, ":destination_slot_no2", ":current_ship_type_slot_c", slot_party_player_ships_type_begin),
              (store_add, ":origin_slot_no", ":destination_slot_no2", 1),
              (call_script, "script_move_ship_instance_from_slot_to_slot", ":origin_slot_no", ":destination_slot_no2"),	#!!!
            (end_try),
            #(display_message, "@I delete ship from origin"),
          (end_try),
          
          (assign, "$ship_menu_state", ":destination_slot_no"),
          (start_presentation, "prsnt_vc_submenu_ships"),
          
          (mission_cam_set_screen_color, 0xFF000000),
          (assign, "$hide_cam_move_with_black_screen", 1),	#new!
          
        (else_try),
          ### LEAVE SHIP
          (eq, ":object", "$g_presentation_obj_ship_menu_leave_ship"),
          (try_begin),
            #block condition 1
            (eq, "$ship_menu_state", 1),
            (party_slot_eq, "$current_town", slot_party_2_ship_type, 0),
            (display_message, "@You can't leave your last ship at the shore."),
          (else_try),
            #block condition 2
            (try_begin),
              (call_script, "script_cf_crew_fit_in_ships", "$current_town"),
            (end_try),
            (assign, ":num_men", reg1),
            (assign, ":max_crew_of_all_ships", reg2),
            (call_script, "script_get_ship_properties", "$ship_menu_current_ship_type"),
            (val_sub, ":max_crew_of_all_ships", reg6),
            (gt, ":num_men", ":max_crew_of_all_ships"),
            (display_message, "@You can't leave this ship at the shore, because otherwise your crew wouldn't fit any more in the rest of the ships."),
          (else_try),
            #start!
            # 1. create a new party if player wants to leave the first ship, block the progress if that isnt possible
            (assign, ":block", 0),
            (try_begin),
              (eq, "$current_landed_ships_party", -1),
              (try_begin),
                (party_get_position, pos1, "p_main_party"),
                (map_get_land_position_around_position, pos2, pos1, 2),
                (party_set_position, "p_temp_party", pos2),
                (party_get_current_terrain, ":terrain_type", "p_temp_party"),
                (neq, ":terrain_type", 0),
                (neq, ":terrain_type", 1), #cliffs
                (neq, ":terrain_type", 7),
                (neq, ":terrain_type", 8),
                
                #(call_script, "script_get_next_land_position", 1),
                (spawn_around_party, "p_main_party", "pt_landet_ships"),
                (assign, "$current_landed_ships_party", reg0),
                (str_store_troop_name, s1, "trp_player"),
                (party_set_name, "$current_landed_ships_party", "@{s1}'s Ships"),
                (party_set_position, "$current_landed_ships_party", pos2),
              (else_try),
                (assign, ":block", 1),
                (display_message, "@You need to get closer to the shore if you want to leave ships there."),
              (end_try),
            (end_try),
            (eq, ":block", 0),
            
            #2.leave the ship
            (assign, ":give_ship_completed", 0),
            (try_for_range, ":current_ship_type_slot", slot_party_player_ships_type_begin, slot_party_player_ships_type_end),
              (eq, ":give_ship_completed", 0),
              (party_get_slot, ":ship_type", "$current_landed_ships_party", ":current_ship_type_slot"),
              (neg|is_between, ":ship_type", 1,10),
              (store_sub, ":destination_slot_no", ":current_ship_type_slot", slot_party_player_ships_type_begin),
              (val_add, ":destination_slot_no", 1),
              (party_set_slot, "$current_landed_ships_party", ":current_ship_type_slot", "$ship_menu_current_ship_type"),
              (store_sub, ":slot_number", ":current_ship_type_slot", slot_party_player_ships_type_begin),
              (store_add, ":current_ship_name_slot", slot_party_player_ships_name_begin, ":slot_number"),
              (party_set_slot, "$current_landed_ships_party", ":current_ship_name_slot", "$ship_menu_current_ship_name"),
              (store_add, ":current_ship_quality_slot", slot_party_player_ships_quality_begin, ":slot_number"),
              (party_set_slot, "$current_landed_ships_party", ":current_ship_quality_slot", "$ship_menu_current_ship_quality"),
              (store_add, ":current_ship_propertys_slot", slot_party_player_ships_propertys_begin, ":slot_number"),
              (party_set_slot, "$current_landed_ships_party", ":current_ship_propertys_slot", "$ship_menu_current_ship_propertys"),
              #
              (call_script, "script_move_ship_instance_from_slot_to_nowhere", "$ship_menu_state"),
              (assign, ":give_ship_completed", 1),
            (end_try),
            
            # delete ship from origin
            (store_add, ":current_ship_type_slot", slot_party_player_ships_type_begin, "$ship_menu_state"),
            (val_sub, ":current_ship_type_slot", 1), # Correction
            (party_set_slot, "$current_town", ":current_ship_type_slot", 0),
            # Now we fill the gap in the entrys
            (store_add, ":correction_begin", ":current_ship_type_slot", 1),
            (try_for_range, ":current_ship_type_slot_c", ":correction_begin", slot_party_player_ships_type_end),
              (party_get_slot, ":ship_type", "$current_town", ":current_ship_type_slot_c"),
              (neq, ":ship_type", 0),
              (store_add, ":current_ship_name_slot_c", ":current_ship_type_slot_c", 10),
              (store_add, ":current_ship_qual_slot_c", ":current_ship_type_slot_c", 20),
              (store_add, ":current_ship_prop_slot_c", ":current_ship_type_slot_c", 30),
              (party_get_slot, ":ship_name", "$current_town", ":current_ship_name_slot_c"),
              (party_get_slot, ":ship_qual", "$current_town", ":current_ship_qual_slot_c"),
              (party_get_slot, ":ship_prop", "$current_town", ":current_ship_prop_slot_c"),
              
              (store_sub, ":current_ship_type_slot_c_minus_one", ":current_ship_type_slot_c", 1),
              (store_sub, ":current_ship_name_slot_c_minus_one", ":current_ship_name_slot_c", 1),
              (store_sub, ":current_ship_qual_slot_c_minus_one", ":current_ship_qual_slot_c", 1),
              (store_sub, ":current_ship_prop_slot_c_minus_one", ":current_ship_prop_slot_c", 1),
              
              (party_set_slot, "$current_town", ":current_ship_type_slot_c_minus_one", ":ship_type"),
              (party_set_slot, "$current_town", ":current_ship_name_slot_c_minus_one", ":ship_name"),
              (party_set_slot, "$current_town", ":current_ship_qual_slot_c_minus_one", ":ship_qual"),
              (party_set_slot, "$current_town", ":current_ship_prop_slot_c_minus_one", ":ship_prop"),
              
              (party_set_slot, "$current_town", ":current_ship_type_slot_c", 0),
              (party_set_slot, "$current_town", ":current_ship_name_slot_c", 0),
              (party_set_slot, "$current_town", ":current_ship_qual_slot_c", 0),
              (party_set_slot, "$current_town", ":current_ship_prop_slot_c", 0),
              # >
              (store_sub, ":destination_slot_no2", ":current_ship_type_slot_c", slot_party_player_ships_type_begin),
              (store_add, ":origin_slot_no", ":destination_slot_no2", 1),
              (call_script, "script_move_ship_instance_from_slot_to_slot", ":origin_slot_no", ":destination_slot_no2"),	#!!!
            (end_try),
            ##########################
            (val_sub, "$ship_menu_state", 1),
            (val_max, "$ship_menu_state", 1),
            (start_presentation, "prsnt_vc_submenu_ships"),
            (mission_cam_set_screen_color, 0xFF000000),
            (assign, "$hide_cam_move_with_black_screen", 1),
          (end_try),
          
        (else_try),
          ### REPAIR
          (eq, ":object", "$g_presentation_obj_ship_menu_repair"),
          (store_troop_gold,":money","trp_player"),
          (try_begin),
            (lt, ":money", "$ship_menu_current_ship_repair_costs"),
            (assign, ":blocking", 1),
            (display_message, "@You cannot repair this boat, because you don't have enough money."),
          (else_try),
            # repair it!
            (play_sound, "snd_distant_worker"),
            (troop_remove_gold, "trp_player", "$ship_menu_current_ship_repair_costs"),
            (store_sub, ":ship_menu_state_minus_one", "$ship_menu_state", 1),
            (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_quality),
            (party_set_slot, "$current_town", ":calculated_slot", 100),
            (start_presentation, "prsnt_vc_submenu_ships"),
            
            (mission_cam_set_screen_color, 0xFF000000),
            (assign, "$hide_cam_move_with_black_screen", 2),	#new!
          (end_try),
          
        (else_try),
          ### CUSTOMIZE
          (eq, ":object", "$g_presentation_obj_ship_menu_customize"),
          #
          (call_script, "script_decode_value", "$ship_menu_current_ship_propertys"),
          # (, reg4, ":", ),	# ship dragon head
          (assign, "$current_ship_paint", reg3),
          (assign, "$current_ship_sail", reg2),
          (assign, "$current_ship_wood", reg1),
          (assign, "$original_ship_paint", reg3),
          (assign, "$original_ship_sail", reg2),
          #
          (scene_prop_get_num_instances, ":number_of_ships", "spr_dyn_ship_substrate"),
          (try_for_range,":ship_number", 0, ":number_of_ships"),
            (scene_prop_get_instance, ":ship_instance", "spr_dyn_ship_substrate", ":ship_number"),
            (scene_prop_slot_eq, ":ship_instance", scene_prop_ship_number, "$ship_menu_state"),
            (scene_prop_get_slot, ":ship_sail", ":ship_instance", scene_prop_boom_instance),
            (scene_prop_set_visibility, ":ship_sail", 100),
          (end_try),
          #
          (presentation_set_duration, 0),
          (assign, "$vc_menu_active", "prsnt_vc_submenu_ships_customize"),
          (start_presentation, "$vc_menu_active"),
          
          (mission_cam_set_screen_color, 0xFF000000),
          (assign, "$hide_cam_move_with_black_screen", 2),	#new!
          
        (else_try),
          ### CHEAT
          (eq, ":object", "$g_presentation_obj_ship_menu_cheat"),
          (call_script, "script_give_ships_to_towns"),
          (start_presentation, "prsnt_vc_submenu_ships"),
          
        (else_try),
          ### BACK
          (eq, ":object", "$g_presentation_obj_ship_menu_back"),
          (try_begin),
            (store_current_scene, ":curr_scene"),
            (this_or_next|eq, "$g_vc_menu_turned_off", 1),	#VC-1954
            (this_or_next|eq, ":curr_scene", "scn_port"),	#VC-1878
            (eq, ":curr_scene", "scn_camp_on_sea"),
            (assign, "$vc_menu_active", 0),
            (set_camera_in_first_person, "$cam_first_person_mode"),	#VC-2097
            (finish_mission),
          (else_try),
            (presentation_set_duration, 0),
            (assign, "$vc_menu_active", "prsnt_vc_menu"),
            (start_presentation, "$vc_menu_active"),
          (end_try),
          
        (try_end),
    ]),
]),

("vc_submenu_ships_customize", 0, 0,
  [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 100),
        
        ### DELETE OLD VARIABLES
        (assign, "$g_presentation_obj_ship_menu_my_ships", -1),
        (assign, "$g_presentation_obj_ship_menu_port_ships", -1),
        (assign, "$g_presentation_obj_ship_menu_ship_name", -1),
        (assign, "$g_presentation_obj_ship_menu_change_finish", -1),
        (assign, "$g_presentation_obj_ship_menu_change_sail", -1),
        (assign, "$g_presentation_obj_ship_menu_buy", -1),
        (assign, "$g_presentation_obj_ship_menu_next", -1),
        (assign, "$g_presentation_obj_ship_menu_back", -1),
        
        ### GET DATA OF CURRENT SHIP (TYPE, NAME, QUALITY)
        (store_sub, ":ship_menu_state_minus_one", "$ship_menu_state", 1),
        (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_type),
        (party_get_slot, "$ship_menu_current_ship_type", "$current_town", ":calculated_slot"),
        (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_name),
        (party_get_slot, "$ship_menu_current_ship_name", "$current_town", ":calculated_slot"),
        (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_quality),
        (party_get_slot, "$ship_menu_current_ship_quality", "$current_town", ":calculated_slot"),
        (store_add, ":calculated_slot", ":ship_menu_state_minus_one", slot_party_1_ship_propertys),
        (party_get_slot, "$ship_menu_current_ship_propertys", "$current_town", ":calculated_slot"),
        
        (set_fixed_point_multiplier, 1000),
        
        ### BOARD
        (create_mesh_overlay, reg1, "mesh_vc_menu_board"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),
        
        (try_begin),
          # If there is no ship...
          (eq, "$ship_menu_current_ship_type", 0),
          (create_text_overlay, reg1, "@No ships for sell^in this Town.", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 400),
          (overlay_set_position, reg1, pos1),
        (else_try),
          # If there are ships...
          
          ### SHIP NAME
          (try_begin),
            (is_between, "$ship_menu_current_ship_name", "trp_pseudo_troop_01", "trp_pseudo_troop_end"),
            (str_store_troop_name, s1, "$ship_menu_current_ship_name"),
            (create_simple_text_box_overlay, "$g_presentation_obj_ship_menu_ship_name"),
            (overlay_set_text, "$g_presentation_obj_ship_menu_ship_name", s1),
            #(assign, reg1, "$g_presentation_obj_ship_menu_ship_name"),
            # (overlay_set_color, "$g_presentation_obj_ship_menu_ship_name", 0x0D0D0D),
            # (overlay_set_hilight_color, "$g_presentation_obj_ship_menu_ship_name", 0x0D0D0D),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 660),
            (overlay_set_position, "$g_presentation_obj_ship_menu_ship_name", pos1),
            (position_set_x, pos1, 200),
            (position_set_y, pos1, 1000),
            (overlay_set_size, "$g_presentation_obj_ship_menu_ship_name", pos1),
          (else_try),
            (str_store_string, s1, "$ship_menu_current_ship_name"),
            (create_text_overlay, reg2, s1, tf_with_outline|tf_center_justify),	#tf_vertical_align_center
            (overlay_set_color, reg2, 0xDDDDDD),
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 660),
            (overlay_set_position, reg2, pos1),
            (position_set_x, pos1, 1500),
            (position_set_y, pos1, 1500),
            (overlay_set_size, reg2, pos1),
          (end_try),
          
          ### SHIP NUMBER/MOVE UP
          (try_begin),
            (lt, "$ship_menu_state", 8),	#only for player ships
            (assign, reg7, "$ship_menu_state"),
            (try_begin),
              (gt, "$ship_menu_state", 1),
              (str_store_string, s2, "@{reg7}. Ship"),
            (else_try),
              (str_store_string, s2, "@Flagship"),
            (end_try),
            (create_text_overlay, reg1, s2, tf_center_justify),	#tf_vertical_align_center
            (position_set_x, pos1, 850),
            (position_set_y, pos1, 580),
            (overlay_set_position, reg1, pos1),
            #(eq, "$ship_menu_state", 1),	# transparency for flagship
            (overlay_set_alpha, reg1, 0x88),
          (end_try),
          
          ### SHIP Properties
          # Wood
          (try_begin),
            (eq, "$current_ship_wood", 1),
            (str_store_string, s0, "str_ship_wood_1"),
          (else_try),
            (eq, "$current_ship_wood", 2),
            (str_store_string, s0, "str_ship_wood_2"),
          (else_try),
            (str_store_string, s0, "str_ship_wood_3"),
          (end_try),
          (str_store_string, s1, "@Wood: {s0}^"),
          
          # Sail
          (try_begin),
            (eq, "$current_ship_sail", 0),
            (str_store_string, s0, "@custom"),
            (assign, ":sail_price", 35),
          (else_try),
            (eq, "$current_ship_sail", 1),
            (str_store_string, s0, "@blue and white"),
            (assign, ":sail_price", 20),
          (else_try),
            (eq, "$current_ship_sail", 2),
            (str_store_string, s0, "@red and white"),
            (assign, ":sail_price", 10),
          (else_try),
            (eq, "$current_ship_sail", 3),
            (str_store_string, s0, "@rich striped"),
            (assign, ":sail_price", 25),
          (else_try),
            (eq, "$current_ship_sail", 4),
            (str_store_string, s0, "@green and yellow"),
            (assign, ":sail_price", 15),
          (else_try),
            (eq, "$current_ship_sail", 5),
            (str_store_string, s0, "@red"),
            (assign, ":sail_price", 7),
          (else_try),
            (eq, "$current_ship_sail", 6),
            (str_store_string, s0, "@blue and red"),
            (assign, ":sail_price", 10),
          (else_try),
            (eq, "$current_ship_sail", 7),
            (str_store_string, s0, "@blue and white"),
            (assign, ":sail_price", 20),
          (else_try),
            (eq, "$current_ship_sail", 8),
            (str_store_string, s0, "@green"),
            (assign, ":sail_price", 5),
          (else_try),
            #(eq, "$current_ship_sail", 9),
            (str_store_string, s0, "@blue and yellow"),
            (assign, ":sail_price", 25),
          (end_try),
          (str_store_string, s2, "@Sail: {s0}^"),
          
          # Finish
          (try_begin),
            (eq, "$current_ship_wood", 1),
            (try_begin),
              (eq, "$current_ship_paint", 1),
              (str_store_string, s0, "@tarred"),
              (assign, ":paint_price", 20),
            (else_try),
              (eq, "$current_ship_paint", 2),
              (str_store_string, s0, "@tarred and red"),
              (assign, ":paint_price", 40),
            (else_try),
              (eq, "$current_ship_paint", 3),
              (str_store_string, s0, "@varnished"),
              (assign, ":paint_price", 20),
            (else_try),
              (eq, "$current_ship_paint", 4),
              (str_store_string, s0, "@varnished and purple"),
              (assign, ":paint_price", 40),
            (else_try),
              (eq, "$current_ship_paint", 5),
              (str_store_string, s0, "@blue and red"),
              (assign, ":paint_price", 5),
            (else_try),
              (eq, "$current_ship_paint", 6),
              (str_store_string, s0, "@blue"),
              (assign, ":paint_price", 15),
            (else_try),
              (eq, "$current_ship_paint", 7),
              (str_store_string, s0, "@blue, red and green"),
              (assign, ":paint_price", 20),
            (else_try),
              (eq, "$current_ship_paint", 8),
              (str_store_string, s0, "@green"),
              (assign, ":paint_price", 10),
            (else_try),
              #(eq, "$current_ship_paint", 0),
              (str_store_string, s0, "@plain"),
              (assign, ":paint_price", 1),
            (end_try),
          (else_try),
            (str_store_string, s0, "@plain"),
          (end_try),
          (str_store_string, s3, "@Finish: {s0}^"),
          
          # Price
          (assign, "$ship_menu_current_ship_price", 0),
          (try_begin),
            (neq, "$current_ship_paint", "$original_ship_paint"),
            (val_add, "$ship_menu_current_ship_price", ":paint_price"),
          (end_try),
          (try_begin),
            (neq, "$current_ship_sail", "$original_ship_sail"),
            (val_add, "$ship_menu_current_ship_price", ":sail_price"),
          (end_try),
          (try_begin),
            (neq, "$ship_menu_current_ship_price", 0),
            (call_script, "script_calculate_ship_value", "$ship_menu_current_ship_type", 50, "$current_ship_wood"),
            (val_mul, "$ship_menu_current_ship_price", reg0),
            (val_div, "$ship_menu_current_ship_price", 100),
            (assign, reg7, "$ship_menu_current_ship_price"),
            (str_store_string, s4, "@Price: {reg7} peningas"),
          (else_try),
            (str_clear, s4),
          (end_try),
          
          (create_text_overlay, reg0, "@{s1}{s2}{s3}{s4}", tf_double_space),
          (position_set_x, pos1, 725),
          (position_set_y, pos1, 360),
          (overlay_set_position, reg0, pos1),
          (overlay_set_alpha, reg0, 0x88),
          
          ### CHANGE FINISH
          (create_button_overlay, "$g_presentation_obj_ship_menu_change_finish", "@Change Finish", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 170),
          (overlay_set_position, "$g_presentation_obj_ship_menu_change_finish", pos1),
          (try_begin),
            (neq, "$current_ship_wood", 1),
            (overlay_set_alpha, "$g_presentation_obj_ship_menu_change_finish", 0x88),
          (end_try),
          
          
          ### CHANGE SAIL
          (create_button_overlay, "$g_presentation_obj_ship_menu_change_sail", "@Change Sail", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 130),
          (overlay_set_position, "$g_presentation_obj_ship_menu_change_sail", pos1),
          
          
          ### APPLY
          (create_button_overlay, "$g_presentation_obj_ship_menu_buy", "@Apply", tf_center_justify),
          (position_set_x, pos1, 850),
          (position_set_y, pos1, 90),
          (overlay_set_position, "$g_presentation_obj_ship_menu_buy", pos1),
          (try_begin),
            (eq, "$ship_menu_current_ship_price", 0),
            (overlay_set_alpha, "$g_presentation_obj_ship_menu_buy", 0x88),
          (end_try),
          
          ### EXTRA BOARD
          (create_mesh_overlay, reg1, "mesh_vc_menu_board_addition"),
          (position_set_x, pos1, 175),
          (position_set_y, pos1, 17),
          (overlay_set_position, reg1, pos1),
          (overlay_set_alpha, reg1, 0xA0),
          
          ### PLAYER MONEY
          (store_troop_gold, reg1, "trp_player"),
          (create_text_overlay, reg1, "str_reg1_denars", tf_center_justify),		#, tf_with_outline|tf_center_justify
          (position_set_x, pos1, 80),
          (position_set_y, pos1, 60),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (overlay_set_alpha, reg1, 0xA0),
          
          ### PLAYER FLEET CAPACITY
          (try_begin),
            (try_begin),
              (call_script, "script_cf_crew_fit_in_ships", "$current_town"),
            (try_end),
            (create_text_overlay, reg3, "@Fleet Capacity:", tf_center_justify),		#, tf_right_align|tf_with_outline|
            (create_text_overlay, reg0, "@{reg1}/{reg2}", tf_center_justify),
            (position_set_x, pos1, 80),
            (position_set_y, pos1, 40),
            (overlay_set_position, reg3, pos1),
            (position_set_y, pos1, 20),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 900),
            (position_set_y, pos1, 900),
            (overlay_set_size, reg3, pos1),
            (overlay_set_size, reg0, pos1),
            (overlay_set_alpha, reg3, 0xA0),
            (overlay_set_alpha, reg0, 0xA0),
            (try_begin),
              (gt, reg1, reg2),
              (overlay_set_color, reg0, 0xAA0000),
            (try_end),
          (try_end),
          
        (end_try),
        
        ### BACK
        (create_button_overlay, "$g_presentation_obj_ship_menu_back", "str_cancel", tf_center_justify),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 50),
        (overlay_set_position, "$g_presentation_obj_ship_menu_back", pos1),
        
    ]),
    
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        #(store_trigger_param_2, ":value"),
        (try_begin),
          
          ### NAME
          (eq, ":object", "$g_presentation_obj_ship_menu_ship_name"),
          (troop_set_name, "$ship_menu_current_ship_name", s0),
          #(str_store_string, "$ship_menu_current_ship_name", s0),
          
        (else_try),
          ### CHANGE FINISH
          (eq, ":object", "$g_presentation_obj_ship_menu_change_finish"),
          (try_begin),
            (eq, "$current_ship_wood", 1),
            (mission_cam_set_screen_color, 0xD0000000),
            (mission_cam_animate_to_screen_color, 0x00000000, 200),
            (try_begin),
              (lt, "$current_ship_paint", 8),
              (val_add, "$current_ship_paint", 1),
            (else_try),
              (assign, "$current_ship_paint", 0),
            (end_try),
            (call_script, "script_decode_value", "$ship_menu_current_ship_propertys"),
            (call_script, "script_encode_values_to_reg0", reg1, "$current_ship_sail", "$current_ship_paint", reg4, reg5),
            (assign, ":ship_properties", reg0),
            (scene_prop_get_num_instances, ":number_of_ships", "spr_dyn_ship_substrate"),
            (try_for_range,":ship_number", 0, ":number_of_ships"),
              (scene_prop_get_instance, ":ship_instance", "spr_dyn_ship_substrate", ":ship_number"),
              (scene_prop_slot_eq, ":ship_instance", scene_prop_ship_number, "$ship_menu_state"),
              (call_script, "script_set_ship_materials", ":ship_instance", ":ship_properties"),
            (end_try),
            (start_presentation, "$vc_menu_active"),
          (else_try),
            (display_message, "@Only ships made of oak are considered to deserve a special finish."),
          (end_try),
          
        (else_try),
          ### CHANGE SAIL
          (eq, ":object", "$g_presentation_obj_ship_menu_change_sail"),
          (mission_cam_set_screen_color, 0xD0000000),
          (mission_cam_animate_to_screen_color, 0x00000000, 200),
          (try_begin),
            (lt, "$current_ship_sail", 9),
            (val_add, "$current_ship_sail", 1),
          (else_try),
            (assign, "$current_ship_sail", 0),
          (end_try),
          (call_script, "script_decode_value", "$ship_menu_current_ship_propertys"),
          (call_script, "script_encode_values_to_reg0", reg1, "$current_ship_sail", "$current_ship_paint", reg4, reg5),
          (assign, ":ship_properties", reg0),
          (scene_prop_get_num_instances, ":number_of_ships", "spr_dyn_ship_substrate"),
          (try_for_range,":ship_number", 0, ":number_of_ships"),
            (scene_prop_get_instance, ":ship_instance", "spr_dyn_ship_substrate", ":ship_number"),
            (scene_prop_slot_eq, ":ship_instance", scene_prop_ship_number, "$ship_menu_state"),
            (call_script, "script_set_ship_materials", ":ship_instance", ":ship_properties"),
          (end_try),
          (start_presentation, "$vc_menu_active"),
          
        (else_try),
          ### APPLY
          (eq, ":object", "$g_presentation_obj_ship_menu_buy"),
          (try_begin),
            (eq, "$ship_menu_current_ship_price", 0),
          (else_try),
            (store_troop_gold,":money","trp_player"),
            (lt, ":money", "$ship_menu_current_ship_price"),
            (display_message, "@You don't have enough money."),
          (else_try),
            (troop_remove_gold, "trp_player", "$ship_menu_current_ship_price"),
            (call_script, "script_decode_value", "$ship_menu_current_ship_propertys"),
            (call_script, "script_encode_values_to_reg0", reg1, "$current_ship_sail", "$current_ship_paint", reg4, reg5),
            (assign, ":ship_properties", reg0),
            (store_add, ":current_ship_propertys_slot", slot_party_player_ships_propertys_begin, "$ship_menu_state"),
            (val_sub, ":current_ship_propertys_slot", 1),
            (party_set_slot, "$current_town", ":current_ship_propertys_slot", ":ship_properties"),
            (presentation_set_duration, 0),
            (assign, "$vc_menu_active", "prsnt_vc_submenu_ships"),
            (start_presentation, "$vc_menu_active"),
          (end_try),
          
          (scene_prop_get_num_instances, ":number_of_ships", "spr_dyn_ship_substrate"),
          (try_for_range,":ship_number", 0, ":number_of_ships"),
            (scene_prop_get_instance, ":ship_instance", "spr_dyn_ship_substrate", ":ship_number"),
            (scene_prop_slot_eq, ":ship_instance", scene_prop_ship_number, "$ship_menu_state"),
            (scene_prop_get_slot, ":ship_sail", ":ship_instance", scene_prop_boom_instance),
            (scene_prop_set_visibility, ":ship_sail", 0),
          (end_try),
          
        (else_try),
          ### BACK
          (eq, ":object", "$g_presentation_obj_ship_menu_back"),
          #
          (scene_prop_get_num_instances, ":number_of_ships", "spr_dyn_ship_substrate"),
          (try_for_range,":ship_number", 0, ":number_of_ships"),
            (scene_prop_get_instance, ":ship_instance", "spr_dyn_ship_substrate", ":ship_number"),
            (scene_prop_slot_eq, ":ship_instance", scene_prop_ship_number, "$ship_menu_state"),
            (call_script, "script_set_ship_materials", ":ship_instance", "$ship_menu_current_ship_propertys"),
            (scene_prop_get_slot, ":ship_sail", ":ship_instance", scene_prop_boom_instance),
            (scene_prop_set_visibility, ":ship_sail", 0),
          (end_try),
          #
          (presentation_set_duration, 0),
          (assign, "$vc_menu_active", "prsnt_vc_submenu_ships"),
          (start_presentation, "$vc_menu_active"),
          
          (mission_cam_set_screen_color, 0xFF000000),
          (assign, "$hide_cam_move_with_black_screen", 2),	#new!
          
        (try_end),
    ]),
]),

###	) PHAIAK end
###	) PHAIAK end chief
####player lair hire personal presentation
("lair_hire_staff", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "@Accept"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_2", "@Dismiss Staff"),
        (position_set_x, pos1, 730),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        (create_text_overlay, reg1, "@Recruit staff for your refuge:", tf_center_justify),
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@^Hiring staff has both initial and continuing costs. A good reputation and an impressive refuge will attract a greater variety of candidates.", tf_center_justify),
        #  (overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 670),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@Description:", tf_left_align),
        #  (overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 590),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, reg1, pos1),
        
        ## ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        ## opciones personales
        (position_set_x, pos1, 150),
        (position_set_y, pos1, 550),
        (create_text_overlay, reg1, "@Captain:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 500),
        (create_text_overlay, reg1, "@Priest:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 450),
        (create_text_overlay, reg1, "@Bard:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 400),
        (create_text_overlay, reg1, "@Bottler:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 350),
        (create_text_overlay, reg1, "@Happy Widow:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        #(position_set_x, pos1, 580),
        (position_set_y, pos1, 300),
        (create_text_overlay, reg1, "@Trainer:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 250),
        (create_text_overlay, reg1, "@Smith:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 200),
        (create_text_overlay, reg1, "@Armorer:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 150),
        (create_text_overlay, reg1, "@Physician:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (position_set_y, pos1, 100),
        (create_text_overlay, reg1, "@Cook:", tf_center_justify),
        (overlay_set_position, reg1, pos1),
        
        (position_set_x, pos3, 900),
        (position_set_y, pos3, 900),
        (overlay_set_size, reg1, pos3),
        
        (assign, "$g_presentation_obj_11", -1),
        (assign, "$g_presentation_obj_12", -1),
        (assign, "$g_presentation_obj_13", -1),
        (assign, "$g_presentation_obj_14", -1),
        (assign, "$g_presentation_obj_15", -1),
        (assign, "$g_presentation_obj_16", -1),
        (assign, "$g_presentation_obj_17", -1),
        (assign, "$g_presentation_obj_18", -1),
        (assign, "$g_presentation_obj_19", -1),
        (assign, "$g_presentation_obj_20", -1),
        
        (position_set_x, pos3, 810),
        (position_set_y, pos3, 810),
        # Captain
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 550),
        
        (create_combo_button_overlay, "$g_presentation_obj_11"),
        (overlay_set_position, "$g_presentation_obj_11", pos1),
        (overlay_set_size, "$g_presentation_obj_11", pos3),
        (overlay_add_item, "$g_presentation_obj_11", "@Captain Marcus"),
        (overlay_add_item, "$g_presentation_obj_11", "@Dismiss/No Captain"),
        (try_begin),
          (eq, "$captain_ok", hire_captainok),
          (overlay_set_val, "$g_presentation_obj_11", 0),
        (else_try),
          (eq, "$captain_ok", hire_captainno),
          (overlay_set_val, "$g_presentation_obj_11", 1),
        (try_end),
        
        ## enlaces a lo que hacen:
        (party_get_slot, ":stage", "$g_encountered_party", slot_lair_improve), #improve stage permite reclutar mas
        (troop_get_slot, ":player_renown", "trp_player", slot_troop_renown), #llama renown
        
        #priest
        (position_set_y, pos1, 500),
        (try_begin),
          (ge, ":stage", 2), #imprevement stage
          (create_combo_button_overlay, "$g_presentation_obj_12"),
        (else_try),
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_12", "str_you_need_to_improve_your_refuge_first"),
        (try_end),
        (overlay_set_position, "$g_presentation_obj_12", pos1),
        (overlay_set_size, "$g_presentation_obj_12", pos3),
        (overlay_add_item, "$g_presentation_obj_12", "@Priest Beda"),
        (overlay_add_item, "$g_presentation_obj_12", "@Godi Olafr"),
        (overlay_add_item, "$g_presentation_obj_12", "@Dismiss/No Priest"),
        
        (try_begin),
          (eq, "$hire_priest1", hire_priest1),
          (overlay_set_val, "$g_presentation_obj_12", 0),
        (else_try),
          (eq, "$hire_priest1", hire_priest2),
          (overlay_set_val, "$g_presentation_obj_12", 1),
        (else_try),
          (eq, "$hire_priest1", hire_priest3),
          (overlay_set_val, "$g_presentation_obj_12", 2),
        (try_end),
        
        
        # Skald
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 450),
        (try_begin),
          (le, ":player_renown", 300), #renown
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_13", "@No bard wants to serve you."),
        (else_try),
          (lt, ":stage", 2), #imprevement stage
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_13", "str_you_need_to_improve_your_refuge_first"),
        (else_try),
          (create_combo_button_overlay, "$g_presentation_obj_13"),
        (try_end),
        
        (overlay_set_position, "$g_presentation_obj_13", pos1),
        (overlay_set_size, "$g_presentation_obj_13", pos3),
        (overlay_add_item, "$g_presentation_obj_13", "@Skald Bragi"),
        (overlay_add_item, "$g_presentation_obj_13", "@Bard Siwi"),
        (overlay_add_item, "$g_presentation_obj_13", "@Dismiss/No Bard"),
        
        (try_begin),
          (eq, "$bard_type", hire_bard1),
          (overlay_set_val, "$g_presentation_obj_13", 0),
        (else_try),
          (eq, "$bard_type", hire_bard2),
          (overlay_set_val, "$g_presentation_obj_13", 1),
        (else_try),
          (eq, "$bard_type", hire_bard3),
          (overlay_set_val, "$g_presentation_obj_13", 2),
        (try_end),
        
        # Taverkeeper
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 400),
        (try_begin),
          (ge, ":stage", 2), #imprevement stage
          (create_combo_button_overlay, "$g_presentation_obj_14"),
        (else_try),
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_14", "str_you_need_to_improve_your_refuge_first"),
        (try_end),
        (overlay_set_position, "$g_presentation_obj_14", pos1),
        (overlay_set_size, "$g_presentation_obj_14", pos3),
        (overlay_add_item, "$g_presentation_obj_14", "@Casius"),
        (overlay_add_item, "$g_presentation_obj_14", "@Dismiss/No Bottler"),
        
        (try_begin),
          (eq, "$hire_tavernkeeper1", hire_tavernkeeper1),
          (overlay_set_val, "$g_presentation_obj_14", 0),
        (else_try),
          (eq, "$hire_tavernkeeper1", hire_tavernkeeper2),
          (overlay_set_val, "$g_presentation_obj_14", 1),
        (try_end),
        
        # Whore
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 350),
        
        (try_begin),
          (le, ":player_renown", 100), #renown
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_15", "@No happy widow is available."),
        (else_try),
          (lt, ":stage", 2), #imprevement stage
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_15", "str_you_need_to_improve_your_refuge_first"),
        (else_try),
          (create_combo_button_overlay, "$g_presentation_obj_15"),
        (try_end),
        (overlay_set_position, "$g_presentation_obj_15", pos1),
        (overlay_set_size, "$g_presentation_obj_15", pos3),
        (overlay_add_item, "$g_presentation_obj_15", "@Suaibsech"), #ireland / pictish
        (overlay_add_item, "$g_presentation_obj_15", "@Tancoystl"), #briton
        (overlay_add_item, "$g_presentation_obj_15", "@Gulla"), #Norse
        (overlay_add_item, "$g_presentation_obj_15", "@Eadgyd"), #anglosaxon
        (overlay_add_item, "$g_presentation_obj_15", "@Dismiss/No Whore"), #anglosaxon
        
        (try_begin),
          (eq, "$hire_whore1", hire_whore1),
          (overlay_set_val, "$g_presentation_obj_15", 0),
        (else_try),
          (eq, "$hire_whore1", hire_whore2),
          (overlay_set_val, "$g_presentation_obj_15", 1),
        (else_try),
          (eq, "$hire_whore1", hire_whore3),
          (overlay_set_val, "$g_presentation_obj_15", 2),
        (else_try),
          (eq, "$hire_whore1", hire_whore4),
          (overlay_set_val, "$g_presentation_obj_15", 3),
        (else_try),
          (eq, "$hire_whore1", hire_whore5),
          (overlay_set_val, "$g_presentation_obj_15", 4),
        (try_end),
        
        # Trainer
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 300),
        (try_begin),
          (ge, ":stage", 2), #imprevement stage
          (create_combo_button_overlay, "$g_presentation_obj_16"),
        (else_try),
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_16", "str_you_need_to_improve_your_refuge_first"),
        (try_end),
        (overlay_set_position, "$g_presentation_obj_16", pos1),
        (overlay_set_size, "$g_presentation_obj_16", pos3),
        (overlay_add_item, "$g_presentation_obj_16", "@Trainer Harald"),
        (overlay_add_item, "$g_presentation_obj_16", "@Dismiss/No Trainer"),
        
        (try_begin),
          (eq, "$hire_trainer1", hire_trainer1),
          (overlay_set_val, "$g_presentation_obj_16", 0),
        (else_try),
          (eq, "$hire_trainer1", hire_trainer2),
          (overlay_set_val, "$g_presentation_obj_16", 1),
        (try_end),
        
        # Smith
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 250),
        (try_begin),
          (ge, ":stage", 4), #imprevement stage
          (create_combo_button_overlay, "$g_presentation_obj_17"),
        (else_try),
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_17", "str_you_need_to_improve_your_refuge_first"),
        (try_end),
        (overlay_set_position, "$g_presentation_obj_17", pos1),
        (overlay_set_size, "$g_presentation_obj_17", pos3),
        (overlay_add_item, "$g_presentation_obj_17", "@Ulfberht"),
        (overlay_add_item, "$g_presentation_obj_17", "@Dismiss/No Smith"),
        
        (try_begin),
          (eq, "$hire_smith1", hire_smith1),
          (overlay_set_val, "$g_presentation_obj_17", 0),
        (else_try),
          (eq, "$hire_smith1", hire_smith2),
          (overlay_set_val, "$g_presentation_obj_17", 1),
        (try_end),
        
        
        # Armorer
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 200),
        (try_begin),
          (ge, ":stage", 4), #imprevement stage
          (create_combo_button_overlay, "$g_presentation_obj_18"),
        (else_try),
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_18", "str_you_need_to_improve_your_refuge_first"),
        (try_end),
        (overlay_set_position, "$g_presentation_obj_18", pos1),
        (overlay_set_size, "$g_presentation_obj_18", pos3),
        (overlay_add_item, "$g_presentation_obj_18", "@Armorer 'The Hungry Hammer'"),
        (overlay_add_item, "$g_presentation_obj_18", "@Dismiss/No Armorer"),
        
        (try_begin),
          (eq, "$hire_armorer1", hire_armorer1),
          (overlay_set_val, "$g_presentation_obj_18", 0),
        (else_try),
          (eq, "$hire_armorer1", hire_armorer2),
          (overlay_set_val, "$g_presentation_obj_18", 1),
        (try_end),
        
        # Barber:
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 150),
        (try_begin),
          (le, ":player_renown", 200), #renown
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_19", "@No physicians are available."),
        (else_try),
          (lt, ":stage", 2), #imprevement stage
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_19", "str_you_need_to_improve_your_refuge_first"),
        (else_try),
          (create_combo_button_overlay, "$g_presentation_obj_19"),
        (try_end),
        
        (overlay_set_position, "$g_presentation_obj_19", pos1),
        (overlay_set_size, "$g_presentation_obj_19", pos3),
        (overlay_add_item, "$g_presentation_obj_19", "@Aurelius"), #anglosaxon
        (overlay_add_item, "$g_presentation_obj_19", "@Morgan"), #norse
        (overlay_add_item, "$g_presentation_obj_19", "@Alexander"), #briton
        (overlay_add_item, "$g_presentation_obj_19", "@Ailill"), #irish
        (overlay_add_item, "$g_presentation_obj_19", "@Dismiss/No Physician"),
        
        (try_begin),
          (eq, "$hire_barber1", hire_barber1),
          (overlay_set_val, "$g_presentation_obj_19", 0),
        (else_try),
          (eq, "$hire_barber1", hire_barber2),
          (overlay_set_val, "$g_presentation_obj_19", 1),
        (else_try),
          (eq, "$hire_barber1", hire_barber3),
          (overlay_set_val, "$g_presentation_obj_19", 2),
        (else_try),
          (eq, "$hire_barber1", hire_barber4),
          (overlay_set_val, "$g_presentation_obj_19", 3),
        (else_try),
          (eq, "$hire_barber1", hire_barber5),
          (overlay_set_val, "$g_presentation_obj_19", 4),
        (try_end),
        # Chef / cook
        (position_set_x, pos1, 370),
        (position_set_y, pos1, 100),
        (try_begin),
          (ge, ":stage", 4), #imprevement stage
          (create_combo_button_overlay, "$g_presentation_obj_20"),
        (else_try),
          (position_set_x, pos1, 245),
          (create_text_overlay, "$g_presentation_obj_20", "str_you_need_to_improve_your_refuge_first"),
        (try_end),
        (overlay_set_position, "$g_presentation_obj_20", pos1),
        (overlay_set_size, "$g_presentation_obj_20", pos3),
        (overlay_add_item, "$g_presentation_obj_20", "@Wamba"),
        (overlay_add_item, "$g_presentation_obj_20", "@Dismiss/No Cook"),
        
        (try_begin),
          (eq, "$hire_cook1", hire_cook1),
          (overlay_set_val, "$g_presentation_obj_20", 0),
        (else_try),
          (eq, "$hire_cook1", hire_cook2),
          (overlay_set_val, "$g_presentation_obj_20", 1),
        (try_end),
        
        
        ## story
        (try_begin),
          (ge, "$show_face", 1), #face description
          
          (try_begin),
            (eq, "$show_face", 1), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_lair_captain"),
          (else_try),
            (eq, "$show_face", 2), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_sacerdote_lair"),
          (else_try),
            (eq, "$show_face", 3), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_pagano_lair"),
          (else_try),
            (eq, "$show_face", 4), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_bardo_lair"),
          (else_try),
            (eq, "$show_face", 5), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_skald_lair"),
          (else_try),
            (eq, "$show_face", 6), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_town_30_tavernkeeper"),
          (else_try),
            (eq, "$show_face", 7), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_quastuosa_lair1"),
          (else_try),
            (eq, "$show_face", 8), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_quastuosa_lair2"),
          (else_try),
            (eq, "$show_face", 9), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_quastuosa_lair3"),
          (else_try),
            (eq, "$show_face", 10), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_quastuosa_lair4"),
          (else_try),
            (eq, "$show_face", 11), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_trainer_2"),
          (else_try),
            (eq, "$show_face", 12), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_town_30_weaponsmith"),
          (else_try),
            (eq, "$show_face", 13), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_town_30_armorer"),
          (else_try),
            (eq, "$show_face", 14), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_lair_barber1"),
          (else_try),
            (eq, "$show_face", 15), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_lair_barber2"),
          (else_try),
            (eq, "$show_face", 16), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_lair_barber3"),
          (else_try),
            (eq, "$show_face", 17), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_lair_barber4"),
          (else_try),
            (eq, "$show_face", 18), #face description
            (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", "trp_cook_lair"),
          (try_end),
          
          (position_set_x, pos1, 450),
          (position_set_y, pos1, 450),
          (overlay_set_size, "$jq_portrait", pos1),
          (position_set_x, pos1, 650),
          (position_set_y, pos1, 400),
          (overlay_set_position, "$jq_portrait", pos1),
          
        (try_end),
        
        (call_script, "script_texto_description_staff"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 300),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 950),
        (position_set_y, pos1, 950),
        (overlay_set_size, reg1, pos1),
        
        ##        (create_text_overlay, reg1, "@{s1}", tf_double_space|tf_scrollable),
        ##        (position_set_x, pos1, 400),
        ##        (position_set_y, pos1, 80),
        ##        (overlay_set_position, reg1, pos1),
        ##        (position_set_x, pos1, 500),
        ##        (position_set_y, pos1, 450),
        ##        (overlay_set_area_size, reg1, pos1),
        
    ]),
    
    #(ti_on_presentation_run,
    #[
    #]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        #captain
        (try_begin),
          (eq, ":object", "$g_presentation_obj_11"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$captain_ok", hire_captainok),
            (assign, "$captain_hired", 1), #contratado chief, hired
            (assign, "$show_face", 1), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$captain_ok", hire_captainno),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          #priest
        (else_try),
          (eq, ":object", "$g_presentation_obj_12"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$hire_priest1", hire_priest1),
            (assign, "$priest_hired", 1), #contratado chief, hired
            (assign, "$show_face", 2), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$hire_priest1", hire_priest2),
            (assign, "$priest_hired", 2), #contratado chief, hired
            (assign, "$show_face", 3), #face description
          (else_try),
            (eq, ":value", 2),
            (assign, "$hire_priest1", hire_priest3),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          #skald
        (else_try),
          (eq, ":object", "$g_presentation_obj_13"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$bard_type", hire_bard1),
            (assign, "$bard_hired", 1), #contratado chief, hired
            (assign, "$show_face", 4), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$bard_type", hire_bard2),
            (assign, "$bard_hired", 2), #contratado chief, hired
            (assign, "$show_face", 5), #face description
          (else_try),
            (eq, ":value", 2),
            (assign, "$bard_type", hire_bard3),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          #Taverkeeper
        (else_try),
          (eq, ":object", "$g_presentation_obj_14"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$hire_tavernkeeper1", hire_tavernkeeper1),
            (assign, "$tavernkeeper_hired", 1), #contratado chief, hired
            (assign, "$show_face", 6), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$hire_tavernkeeper1", hire_tavernkeeper2),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          #Whore
        (else_try),
          (eq, ":object", "$g_presentation_obj_15"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$hire_whore1", hire_whore1),
            (assign, "$whore_hired", 1), #contratado chief, hired
            (assign, "$show_face", 7), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$hire_whore1", hire_whore2),
            (assign, "$whore_hired", 2), #contratado chief, hired
            (assign, "$show_face", 8), #face description
          (else_try),
            (eq, ":value", 2),
            (assign, "$hire_whore1", hire_whore3),
            (assign, "$whore_hired", 3), #contratado chief, hired
            (assign, "$show_face", 9), #face description
          (else_try),
            (eq, ":value", 3),
            (assign, "$hire_whore1", hire_whore4),
            (assign, "$whore_hired", 4), #contratado chief, hired
            (assign, "$show_face", 10), #face description
          (else_try),
            (eq, ":value", 4),
            (assign, "$hire_whore1", hire_whore5),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          
          #Trainer
        (else_try),
          (eq, ":object", "$g_presentation_obj_16"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$hire_trainer1", hire_trainer1),
            (assign, "$trainer_hired", 1), #contratado chief, hired
            (assign, "$show_face", 11), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$hire_trainer1", hire_trainer2),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          # Smith
        (else_try),
          (eq, ":object", "$g_presentation_obj_17"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$hire_smith1", hire_smith1),
            (assign, "$smith_hired", 1), #contratado chief, hired
            (assign, "$show_face", 12), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$hire_smith1", hire_smith2),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          #Armorer
        (else_try),
          (eq, ":object", "$g_presentation_obj_18"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$hire_armorer1", hire_armorer1),
            (assign, "$armorer_hired", 1), #contratado chief, hired
            (assign, "$show_face", 13), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$hire_armorer1", hire_armorer2),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          #barber
        (else_try),
          (eq, ":object", "$g_presentation_obj_19"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$hire_barber1", hire_barber1),
            (assign, "$barber_hired", 1), #contratado chief, hired
            (assign, "$show_face", 14), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$hire_barber1", hire_barber2),
            (assign, "$barber_hired", 2), #contratado chief, hired
            (assign, "$show_face", 15), #face description
          (else_try),
            (eq, ":value", 2),
            (assign, "$hire_barber1", hire_barber3),
            (assign, "$barber_hired", 3), #contratado chief, hired
            (assign, "$show_face", 16), #face description
          (else_try),
            (eq, ":value", 3),
            (assign, "$hire_barber1", hire_barber4),
            (assign, "$barber_hired", 4), #contratado chief, hired
            (assign, "$show_face", 17), #face description
          (else_try),
            (eq, ":value", 4),
            (assign, "$hire_barber1", hire_barber5),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          
          #Chef / cook
        (else_try),
          (eq, ":object", "$g_presentation_obj_20"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$hire_cook1", hire_cook1),
            (assign, "$cook_hired", 1), #contratado chief, hired
            (assign, "$show_face", 18), #face description
          (else_try),
            (eq, ":value", 1),
            (assign, "$hire_cook1", hire_cook2),
            (assign, "$show_face", 0), #face description
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
          
          ##        (else_try), ## back
          ##          (eq, ":object", "$g_presentation_obj_3"),
          
        (else_try), ## Initial
          (eq, ":object", "$g_presentation_obj_2"),
          (party_get_slot, ":stage", "$g_encountered_party", slot_lair_improve), #improve stage permite reclutar mas
          
          (assign, "$show_face", 0), #face description
          ###no hired
          (assign, "$captain_hired_on", 0), # no contratado chief, hired
          (assign, "$priest_hired_on", 0), #contratado chief, hired
          (assign, "$bard_hired_on", 0), # no contratado chief, hired
          (assign, "$tavernkeeper_hired_on", 0), # no contratado chief, hired
          (assign, "$whore_hired_on", 0), #contratado chief, hired
          (assign, "$trainer_hired_on", 0), #contratado chief, hired
          
          (assign, "$smith_hired_on", 0), #contratado chief, hired
          (assign, "$armorer_hired_on", 0), #contratado chief, hired
          (assign, "$barber_hired_on", 0), #contratado chief, hired
          (assign, "$cook_hired_on", 0), #contratado chief, hired
          ###
          (assign, "$captain_ok", hire_captainno),
          (try_begin),
            (ge, ":stage", 2), #imprevement stage
            (assign, "$hire_priest1", hire_priest3),
            (assign, "$bard_type", hire_bard3),
            (assign, "$hire_tavernkeeper1", hire_tavernkeeper2),
            (assign, "$hire_whore1", hire_whore5),
            (assign, "$hire_trainer1", hire_trainer2),
            (assign, "$hire_barber1", hire_barber5),
          (try_end),
          (try_begin),
            (ge, ":stage", 4), #imprevement stage
            (assign, "$hire_smith1", hire_smith2),
            (assign, "$hire_armorer1", hire_armorer2),
            (assign, "$hire_cook1", hire_cook2),
          (try_end),
          (start_presentation, "prsnt_lair_hire_staff"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_1"),
          
          (assign, ":staff_cost_initial", 0),
          (try_begin),
            (neq, "$captain_hired", 0), #contratado chief, hired
            (neq, "$captain_hired_on", 1), #contratado chief, hired
            (eq, "$captain_ok", hire_captainok),#
            (val_add, ":staff_cost_initial", 500),
            (assign, "$captain_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss captain
            (eq, "$captain_ok", hire_captainno),#
            (assign, "$captain_hired_on", 0), # no contratado chief, hired
          (try_end),
          
          (try_begin),
            (neq, "$priest_hired", 0), #contratado chief, hired
            (neq, "$priest_hired_on", 1), #contratado chief, hired
            (eq, "$hire_priest1", hire_priest1),#
            (val_add, ":staff_cost_initial", 250),
            (assign, "$priest_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin),
            (neq, "$priest_hired", 0), #contratado chief, hired
            (neq, "$priest_hired_on", 2), #contratado chief, hired
            (eq, "$hire_priest1", hire_priest2),#
            (val_add, ":staff_cost_initial", 250),
            (assign, "$priest_hired_on", 2), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss priest
            (eq, "$hire_priest1", hire_priest3),#
            (assign, "$priest_hired_on", 0), # no contratado chief, hired
          (try_end),
          
          
          (try_begin),
            (neq, "$bard_hired", 0), #contratado chief, hired
            (neq, "$bard_hired_on", 1), #contratado chief, hired
            (eq, "$bard_type", hire_bard1),#
            (val_add, ":staff_cost_initial", 200),
            (assign, "$bard_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin),
            (neq, "$bard_hired", 0), #contratado chief, hired
            (neq, "$bard_hired_on", 2), #contratado chief, hired
            (eq, "$bard_type", hire_bard2),#
            (val_add, ":staff_cost_initial", 200),
            (assign, "$bard_hired_on", 2), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss bard
            (eq, "$bard_type", hire_bard3),#
            (assign, "$bard_hired_on", 0), # no contratado chief, hired
          (try_end),
          
          
          (try_begin),
            (neq, "$tavernkeeper_hired", 0), #contratado chief, hired
            (neq, "$tavernkeeper_hired_on", 1), #contratado chief, hired
            (eq, "$hire_tavernkeeper1", hire_tavernkeeper1),#
            (val_add, ":staff_cost_initial", 100),
            (assign, "$tavernkeeper_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss tavernkeeper
            (eq, "$hire_tavernkeeper1", hire_tavernkeeper2),#
            (assign, "$tavernkeeper_hired_on", 0), # no contratado chief, hired
          (try_end),
          
          (try_begin),
            (neq, "$whore_hired", 0), #contratado chief, hired
            (neq, "$whore_hired_on", 1), #contratado chief, hired
            (eq, "$hire_whore1", hire_whore1),#
            (val_add, ":staff_cost_initial", 300),
            (assign, "$whore_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin),
            (neq, "$whore_hired", 0), #contratado chief, hired
            (neq, "$whore_hired_on", 2), #contratado chief, hired
            (eq, "$hire_whore1", hire_whore2),#
            (val_add, ":staff_cost_initial", 300),
            (assign, "$whore_hired_on", 2), #contratado chief, hired
          (try_end),
          (try_begin),
            (neq, "$whore_hired", 0), #contratado chief, hired
            (neq, "$whore_hired_on", 3), #contratado chief, hired
            (eq, "$hire_whore1", hire_whore3),#
            (val_add, ":staff_cost_initial", 150),
            (assign, "$whore_hired_on", 3), #contratado chief, hired
          (try_end),
          (try_begin),
            (neq, "$whore_hired", 0), #contratado chief, hired
            (neq, "$whore_hired_on", 4), #contratado chief, hired
            (eq, "$hire_whore1", hire_whore4),#
            (val_add, ":staff_cost_initial", 150),
            (assign, "$whore_hired_on", 4), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss tavernkeeper
            (eq, "$hire_whore1", hire_whore5),#
            (assign, "$whore_hired_on", 0), #contratado chief, hired
          (try_end),
          
          
          (try_begin),
            (neq, "$trainer_hired", 0), #contratado chief, hired
            (neq, "$trainer_hired_on", 1), #contratado chief, hired
            (eq, "$hire_trainer1", hire_trainer1),#
            (val_add, ":staff_cost_initial", 450),
            (assign, "$trainer_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss tavernkeeper
            (eq, "$hire_trainer1", hire_trainer2),#
            (assign, "$trainer_hired_on", 0), #contratado chief, hired
          (try_end),
          
          (try_begin),
            (neq, "$smith_hired", 0), #contratado chief, hired
            (neq, "$smith_hired_on", 1), #contratado chief, hired
            (eq, "$hire_smith1", hire_smith1),
            (val_add, ":staff_cost_initial", 400),
            (assign, "$smith_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss tavernkeeper
            (eq, "$hire_smith1", hire_smith2),#
            (assign, "$smith_hired_on", 0), #contratado chief, hired
          (try_end),
          
          (try_begin),
            (neq, "$armorer_hired", 0), #contratado chief, hired
            (neq, "$armorer_hired_on", 1), #contratado chief, hired
            (eq, "$hire_armorer1", hire_armorer1),
            (val_add, ":staff_cost_initial", 400),
            (assign, "$armorer_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss tavernkeeper
            (eq, "$hire_armorer1", hire_armorer2),#
            (assign, "$armorer_hired_on", 0), #contratado chief, hired
          (try_end),
          
          (try_begin),
            (neq, "$barber_hired", 0), #contratado chief, hired
            (neq, "$barber_hired_on", 1), #contratado chief, hired
            (eq, "$hire_barber1", hire_barber1),#
            (val_add, ":staff_cost_initial", 250),
            (assign, "$barber_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin),
            (neq, "$barber_hired", 0), #contratado chief, hired
            (neq, "$barber_hired_on", 2), #contratado chief, hired
            (eq, "$hire_barber1", hire_barber2),#
            (val_add, ":staff_cost_initial", 250),
            (assign, "$barber_hired_on", 2), #contratado chief, hired
          (try_end),
          (try_begin),
            (neq, "$barber_hired", 0), #contratado chief, hired
            (neq, "$barber_hired_on", 3), #contratado chief, hired
            (eq, "$hire_barber1", hire_barber3),#
            (val_add, ":staff_cost_initial", 350),
            (assign, "$barber_hired_on", 3), #contratado chief, hired
          (try_end),
          (try_begin),
            (neq, "$barber_hired", 0), #contratado chief, hired
            (neq, "$barber_hired_on", 4), #contratado chief, hired
            (eq, "$hire_barber1", hire_barber4),#
            (val_add, ":staff_cost_initial", 250),
            (assign, "$barber_hired_on", 4), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss tavernkeeper
            (eq, "$hire_barber1", hire_barber5),#
            (assign, "$barber_hired_on", 0), #contratado chief, hired
          (try_end),
          
          (try_begin),
            (neq, "$cook_hired", 0), #contratado chief, hired
            (neq, "$cook_hired_on", 1), #contratado chief, hired
            (eq, "$hire_cook1", hire_cook1),#
            (val_add, ":staff_cost_initial", 350),
            (assign, "$cook_hired_on", 1), #contratado chief, hired
          (try_end),
          (try_begin), #dimiss tavernkeeper
            (eq, "$hire_cook1", hire_cook2),#
            (assign, "$cook_hired_on", 0), #contratado chief, hired
          (try_end),
          
          (store_troop_gold, ":gold_amount", "trp_player"),
          (try_begin),
            (ge, ":gold_amount", ":staff_cost_initial"),
            (troop_remove_gold, "trp_player", ":staff_cost_initial"),
            #(display_message, "@Staff hired!"),
            (assign, "$show_face", 0), #face description
            ###hired to zero agan
            (assign, "$captain_hired", 0), #contratado chief, hired
            (assign, "$priest_hired", 0), #contratado chief, hired
            (assign, "$bard_hired", 0), #contratado chief, hired
            (assign, "$tavernkeeper_hired", 0), #contratado chief, hired
            (assign, "$whore_hired", 0), #contratado chief, hired
            (assign, "$trainer_hired", 0), #contratado chief, hired
            (assign, "$smith_hired", 0), #contratado chief, hired
            (assign, "$armorer_hired", 0), #contratado chief, hired
            (assign, "$barber_hired", 0), #contratado chief, hired
            (assign, "$cook_hired", 0), #contratado chief, hired
            ###
            (presentation_set_duration, 0),
            (jump_to_menu, "mnu_player_lair_menus"),
          (else_try),
            (display_message, "@You do not have enough money to increase your staff this much. Please reduce the number of people to hire!"),
          (try_end),
          
        (try_end),
    ]),
]),
###
####texto story chief          (start_presentation, "prsnt_abbot_justice_1"),

#abad waiting justice abbot
("abbot_justice_1", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        #   (create_mesh_overlay, reg0, "mesh_pic_extra_intro1"),
        (create_mesh_overlay, reg0, "mesh_pic_extra_monasterio"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (create_text_overlay, reg1, "@The abbot sends for all parties to come to the chapel, so that you can hear all sides of the story.^^" +
        "For your part, you take advantage of the waiting time to observe the work of the scribes, texts ornate with gold.", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          (quest_set_slot,"qst_kennemer_mission_1",slot_quest_current_state, 2),
          (store_current_scene,":current_scene"),
          (modify_visitors_at_site,":current_scene"),
          (reset_visitors),
          (set_visitor, 41, "trp_farmer"),
          (set_visitor, 42, "trp_monjes"),
          (set_visitor, 43, "trp_abad"),
          (set_jump_entry, 0),
          
          (set_jump_mission, "mt_monasterio_interior_juicio"),
          (jump_to_scene,":current_scene"),
          (change_screen_mission),
          (start_presentation, "prsnt_abbot_justice_1"),
          ##           (presentation_set_duration, 0),
          ##          (change_screen_return),
        (try_end),
    ]),
]),
#####
#story 1
("beda_story_1", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        #   (create_mesh_overlay, reg0, "mesh_pic_extra_intro1"),
        (create_mesh_overlay, reg0, "mesh_pic_map_detail"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (call_script, "script_texto_story_beda1"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          (change_screen_return),
        (try_end),
    ]),
]),

#story 2
("beda_story_2", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_map_detail"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (call_script, "script_texto_story_beda2"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          (change_screen_return),
        (try_end),
    ]),
]),
###story 3
("beda_story_3", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_fleet"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (call_script, "script_texto_story_beda3"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          
          (jump_to_menu, "mnu_partida_ribe_fleet2"),
          #(change_screen_return),
        (try_end),
    ]),
]),

###
###story 4
("beda_story_4", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_duel_warriors"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (call_script, "script_texto_story_beda4"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          
          (jump_to_menu, "mnu_way_to_douaranenez5"),
          #(change_screen_return),
        (try_end),
    ]),
]),
######
("beda_story_finalmainquest", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro1"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (call_script, "script_texto_story_bedafinal"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          #          (presentation_set_duration, 0),
          
          (start_presentation,"prsnt_beda_story_finalmainquest2"),
          #(change_screen_return),
        (try_end),
    ]),
]),
("beda_story_finalmainquest2", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro1"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (call_script, "script_texto_story_bedafinal2"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          
          (start_presentation,"prsnt_game_credits"),
        (try_end),
    ]),
]),
############
####Siege warfare
("infiltrationandsabotage",0,mesh_load_window,[
    (ti_on_presentation_load,
      [(presentation_set_duration,999999),
        (set_fixed_point_multiplier, 1000),
        (store_faction_of_party,"$g_presentation_center_faction","$g_encountered_party"),
        (party_get_slot,":party_type","$g_encountered_party",slot_party_type),
        
        (try_begin),
          (eq,":party_type",spt_castle),
          (str_store_string,s2,"@fort"),
        (else_try),
          (eq,":party_type",spt_town),
          (str_store_string,s2,"@town"),
        (else_try),
          (eq,":party_type",spt_village),
          (str_store_string,s2,"@village"),
        (try_end),
        #
        (create_text_overlay, reg1, "@Infiltration", tf_center_justify),
        (overlay_set_color, reg1, 0xFFFF2222), #rojo
        #(overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 260),
        (position_set_y, pos1, 580),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1400),
        (position_set_y, pos1, 1400),
        (overlay_set_size, reg1, pos1),
        (create_text_overlay, reg1, "@A good way to hasten the fall of the {s2} is to infiltrate it with a group of men to damage the defences, food stores, water supplies or loyalty of the defenders. It is a difficult and risky maneuver, almost suicidal. " +
        "Those you send in have low chances of returning, but if successful, they could cause great damage to the enemy. They need 600 peningas for their troubles. What type of sabotage would you like them to cause?", tf_center_justify|tf_double_space|tf_scrollable),
        #  (overlay_set_color, reg1, 0xDDDDDD),
        (position_set_x, pos1, 80),
        (position_set_y, pos1, 180),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 340),
        (position_set_y, pos1, 340),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        #                                                            ##############  CANCEL  ###############
        ## basicos
        ##        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        ##        (position_set_x, pos1, 900),
        ##        (position_set_y, pos1, 25),
        ##        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        (assign, "$g_presentation_obj_3", -1),
        (assign, "$g_presentation_obj_4", -1),
        (assign, "$g_presentation_obj_5", -1),
        (assign, "$g_presentation_obj_6", -1),
        (assign, "$g_presentation_obj_10", -1),
        
        (create_game_button_overlay,"$g_presentation_obj_2","str_cancel",tf_center_justify),
        (position_set_x, pos1, 650),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        (try_begin),
          (ge,"$g_presentations_next_presentation",-1),
          #poison water
          (create_game_button_overlay,"$g_presentation_obj_3","@Poison the {s2}'s water.",tf_center_justify),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 330),
          (overlay_set_position, "$g_presentation_obj_3", pos1),
          (position_set_x, pos1, 290),(position_set_y, pos1, 50),
          (overlay_set_size, "$g_presentation_obj_3", pos1),
          #kill cattle
          (create_game_button_overlay,"$g_presentation_obj_4","@Kill the {s2}'s livestock.",tf_center_justify),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 260),
          (overlay_set_position, "$g_presentation_obj_4", pos1),
          (position_set_x, pos1, 290),(position_set_y, pos1, 50),
          (overlay_set_size, "$g_presentation_obj_4", pos1),
          #burn food
          (create_game_button_overlay,"$g_presentation_obj_5","@Burn the {s2}'s food.",tf_center_justify),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 190),
          (overlay_set_position, "$g_presentation_obj_5", pos1),
          (position_set_x, pos1, 290),(position_set_y, pos1, 50),
          (overlay_set_size, "$g_presentation_obj_5", pos1),
          #damage morale
          (create_game_button_overlay,"$g_presentation_obj_6","@Subvert the defenders.",tf_center_justify),
          (position_set_x, pos1, 700),
          (position_set_y, pos1, 120),
          (overlay_set_position, "$g_presentation_obj_6", pos1),
          (position_set_x, pos1, 290),(position_set_y, pos1, 50),
          (overlay_set_size, "$g_presentation_obj_6", pos1),
        (try_end),
        
        #cost
        (try_begin),
          (eq,"$g_presentations_next_presentation",-1),
          (str_store_string,s4,"@____"),
          (str_store_string,s5,"@____"),
        (else_try),
          (ge,"$g_presentations_next_presentation",0),
          (create_text_overlay,"$g_presentation_obj_9",s4,tf_center_justify|tf_double_space|tf_scrollable),
          (position_set_x,pos1,600),
          (position_set_y,pos1,240),
          (overlay_set_position,"$g_presentation_obj_9",pos1),
          (position_set_x, pos1, 350),
          (position_set_y, pos1, 300),
          (overlay_set_area_size, "$g_presentation_obj_9", pos1),
          (position_set_x, pos1, 800),
          (position_set_y, pos1, 800),
          (overlay_set_size, "$g_presentation_obj_9", pos1),
          
          (create_game_button_overlay,"$g_presentation_obj_10",s5,tf_center_justify),
          (position_set_x,pos1,870),
          (position_set_y,pos1,25),
          (overlay_set_position,"$g_presentation_obj_10",pos1),
        (else_try),
          (eq,"$g_presentations_next_presentation",-2),
          (create_text_overlay,"$g_presentation_obj_9",s4,tf_left_align),
          (position_set_x,pos1,150),
          (position_set_y,pos1,150),
          (overlay_set_position,"$g_presentation_obj_9",pos1),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (store_troop_gold,":cur_wealth","trp_player"),
        (try_begin),
          (eq,"$g_presentation_obj_2",":object"), #cancel
          (assign,"$g_presentations_next_presentation",-1),
          (assign,"$cur_choice",5),
          (presentation_set_duration,0),
        (else_try),
          (eq,"$g_presentation_obj_3",":object"), #water
          (val_add,"$g_presentations_next_presentation",1),
          (str_store_string,s5,"str_give_order"),
          (str_store_string,s4,"str_water_poison_im"),
          (assign,"$cur_choice",1),
          (start_presentation,"prsnt_infiltrationandsabotage"),
        (else_try),
          (eq,"$g_presentation_obj_4",":object"), #cattle
          (val_add,"$g_presentations_next_presentation",1),
          (str_store_string,s5,"str_give_order"),
          (str_store_string,s4,"str_cattle_kill_im"),
          (assign,"$cur_choice",2),
          (start_presentation,"prsnt_infiltrationandsabotage"),
        (else_try),
          (eq,"$g_presentation_obj_5",":object"),
          (val_add,"$g_presentations_next_presentation",1),
          (str_store_string,s5,"str_give_order"),
          (str_store_string,s4,"str_food_burn_im"),
          (assign,"$cur_choice",3),
          (start_presentation,"prsnt_infiltrationandsabotage"),
        (else_try),
          (eq,"$g_presentation_obj_6",":object"),
          (val_add,"$g_presentations_next_presentation",1),
          (str_store_string,s5,"str_give_order"),
          (str_store_string,s4,"str_people_morale_im"),
          (assign,"$cur_choice",4),
          (start_presentation,"prsnt_infiltrationandsabotage"),
        (else_try),
          (eq,"$g_presentation_obj_10",":object"),
          (try_begin),
            (ge,":cur_wealth",600),
            (try_begin),
              (eq,"$cur_choice",1),
              (party_set_slot,"$g_encountered_party",slot_center_infiltration_type,1), #water
              (assign, "$g_infiltracion_interna", 1),
              (str_store_string,s4,"@A group of chosen men will be sent to poison the water supplies.",tf_left_align),
              (troop_remove_gold,"trp_player",600),
              (assign,"$g_presentations_next_presentation",-1),
              (assign,"$cur_choice",5),
              (presentation_set_duration,0),
            (else_try),
              (eq,"$cur_choice",2), #catle
              (party_set_slot,"$g_encountered_party",slot_center_infiltration_type,2),
              (assign, "$g_infiltracion_interna", 1),
              (troop_remove_gold,"trp_player",600),
              (str_store_string,s4,"@A group of chosen men will be sent to kill the cattle.",tf_left_align),
              (assign,"$cur_choice",5),
              (assign,"$g_presentations_next_presentation",-1),
              (presentation_set_duration,0),
            (else_try),
              (eq,"$cur_choice",3), #food
              (party_set_slot,"$g_encountered_party",slot_center_infiltration_type,3),
              (troop_remove_gold,"trp_player",600),
              (assign, "$g_infiltracion_interna", 1),
              (str_store_string,s4,"@A group of chosen men will be sent to burn the granaries.",tf_left_align),
              (assign,"$cur_choice",5),
              (assign,"$g_presentations_next_presentation",-1),
              (presentation_set_duration,0),
            (else_try),
              (eq,"$cur_choice",4), #morale
              (party_set_slot,"$g_encountered_party",slot_center_infiltration_type,4),
              (str_store_string,s4,"@A group of chosen men will be sent to subvert the defenders.",tf_left_align),
              (assign, "$g_infiltracion_interna", 1),
              (troop_remove_gold,"trp_player",600),
              (assign,"$g_presentations_next_presentation",-1),
              (assign,"$cur_choice",5),
              (presentation_set_duration,0),
            (try_end),
          (else_try),
            (le,":cur_wealth",499),
            (str_store_string,s4,"@You do not have the 600 peningas to pay for this mission.",tf_left_align),
            (assign,"$g_presentations_next_presentation",-1),
            (assign,"$cur_choice",0),
            (start_presentation,"prsnt_infiltrationandsabotage"),
          (try_end),
        (try_end),
        
    ]),
]),
#############
######################## Messenger system
("messenger_system", 0, 0, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (str_clear, s1),
        (str_clear, s2),
        (str_clear, s9),
        (str_clear, s10),
        (str_clear, s15),
        (str_clear, s16),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_troop_trees"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (assign,":party_no","$message_target"),
        (store_faction_of_party, ":party_faction", ":party_no"),
        (party_stack_get_troop_id, ":leader", ":party_no", 0),
        (str_store_troop_name,s1,":leader"),
        (str_store_faction_name,s2,":party_faction"),
        (str_store_string,s9,"@{s1} of the {s2}"),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "@Send"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_2", "str_cancel"),
        (position_set_x, pos1, 730),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        (create_text_overlay, reg1, "@You are hiring a messenger.^You can do three kinds of things with a message: give Orders, change Relations and make Diplomacy.", tf_center_justify),
        (overlay_set_color, reg1, 0x000000), #Black se ve bien
        #(overlay_set_color, reg1, 0xDDDDDD), #color gris
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 680),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 950),
        (position_set_y, pos1, 950),
        (overlay_set_size, reg1, pos1),
        
        (assign,":cost",0),
        (assign,":distance",0),
        (store_distance_to_party_from_party,":distance",":party_no","p_main_party"),
        (val_add,":distance",1),
        (assign,reg2,":distance"),
        (assign,":cost",":distance"),
        (val_mul,":cost",20),
        
        (try_begin),
          (eq, "$message_type", diplomacy_sendgift),
          (val_add,":cost",2000),
        (try_end),
        (assign,reg3,":cost"),
        
        
        ## opciones text
        (position_set_x, pos1, 260),
        (position_set_y, pos1, 560),
        (create_text_overlay, reg1, "@Message Type:", tf_center_justify),
        #  (overlay_set_color, reg1, 0x00AA00), #verde
        (overlay_set_color, reg1, 0xFFFF2222), #rojo
        # (overlay_set_color, reg1, 0xFFFFAAAA), #rosa claro
        # (overlay_set_color, reg1, 0xFFFFFFFF), #blanco
        (overlay_set_position, reg1, pos1),
        
        (assign, "$g_presentation_obj_18", -1),
        (position_set_x, pos3, 930),
        (position_set_y, pos3, 930),
        (overlay_set_size, reg1, pos3),
        
        (try_begin),
          (this_or_next|eq, "$message_type", orders_gotoplace),
          (this_or_next|eq, "$message_type", orders_patrolarea),
          (eq, "$message_type", orders_besiegeplace),
          ####place
          (assign, ":choose_town", "$message_place"),
          (try_begin),
            (is_between,":choose_town", "p_town_1", "p_village_1"),
            (assign, "$g_presentation_obj_18_val", ":choose_town"),
          (else_try),
            (assign, "$g_presentation_obj_18_val", "$current_town"),
          (try_end),
          
          (create_slider_overlay, "$g_presentation_obj_18", "p_town_1", "p_castle_90"),
          (position_set_x, pos1, 250),
          (position_set_y, pos1, 200),
          (overlay_set_position, "$g_presentation_obj_18", pos1),
          (overlay_set_val, "$g_presentation_obj_18", ":choose_town"),
          
          (str_store_party_name, s1, "$g_presentation_obj_18_val"),
          (store_faction_of_party,"$g_presentation_center_faction","$g_presentation_obj_18_val"),
          (str_store_faction_name,s2,"$g_presentation_center_faction"),
          
          (create_text_overlay, "$g_presentation_obj_19", s16,tf_center_justify), #faction text
          (position_set_x, pos1, 150),
          (position_set_y, pos1, 150),
          (overlay_set_position, "$g_presentation_obj_19", pos1),
          
          (create_text_overlay, "$g_presentation_obj_22", s15,tf_center_justify), #town name
          (position_set_x, pos1, 350),
          (position_set_y, pos1, 150),
          (overlay_set_position, "$g_presentation_obj_22", pos1),
          
          (create_text_overlay,"$g_presentation_obj_23","@Select a Place for your orders:",tf_center_justify),
          (position_set_x,pos1,200),
          (position_set_y,pos1,250),
          (overlay_set_position,"$g_presentation_obj_23",pos1),
          (position_set_x,pos2,900),
          (position_set_y,pos2,900),
          (overlay_set_size,"$g_presentation_obj_23",pos2),
          
          ###place
        (try_end),
        
        
        # type orders
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 450),
        (try_begin),
          (eq, "$message_target_type", 1),  # 1 player's kingdom lord , 2 no player's kingdom lord , 3 King of other kingdom
          (create_combo_button_overlay, "$g_presentation_obj_14"),
          (overlay_set_position, "$g_presentation_obj_14", pos1),
        (else_try),
          (create_text_overlay, "$g_presentation_obj_14", "@>> Orders:^ You cannot give orders to a lord who doesn't belong to your kingdom.", tf_center_justify),
          ##             (position_set_x, pos1, 250), #area
          ##             (position_set_y, pos1, 450),
          (overlay_set_position, "$g_presentation_obj_14", pos1),
          (position_set_x, pos1, 250), #area
          (position_set_y, pos1, 400),
          (overlay_set_area_size, "$g_presentation_obj_14", pos1),
          (position_set_x, pos3, 800),
          (position_set_y, pos3, 800),
          (overlay_set_size, "$g_presentation_obj_14", pos3),
        (try_end),
        
        #orders
        (overlay_add_item, "$g_presentation_obj_14", "@Orders: None."),
        (overlay_add_item, "$g_presentation_obj_14", "@Orders: Meet and Follow You."),
        (overlay_add_item, "$g_presentation_obj_14", "@Orders: Go to a Place."),
        (overlay_add_item, "$g_presentation_obj_14", "@Orders: Patrol an Area."),
        (overlay_add_item, "$g_presentation_obj_14", "@Orders: Besiege a Place."),
        #  (overlay_add_item, "$g_presentation_obj_14", "@Orders: Raid a Area."),
        
        #  (overlay_add_item, "$g_presentation_obj_14", "@Orders: Guard a Place."),
        
        
        (try_begin),
          (eq, "$message_type", no_menssage_choosed),
          (overlay_set_val, "$g_presentation_obj_14", 0),
        (else_try),
          (eq, "$message_type", orders_follow),
          (overlay_set_val, "$g_presentation_obj_14", 1),
        (else_try),
          (eq, "$message_type", orders_gotoplace),
          (overlay_set_val, "$g_presentation_obj_14", 2),
        (else_try),
          (eq, "$message_type", orders_patrolarea),
          (overlay_set_val, "$g_presentation_obj_14", 3),
        (else_try),
          (eq, "$message_type", orders_besiegeplace),
          (overlay_set_val, "$g_presentation_obj_14", 4),
          ##        (else_try),
          ##          (eq, "$message_type", orders_raidarea),
          ##          (overlay_set_val, "$g_presentation_obj_14", 5),
        (try_end),
        
        ##        (position_set_x, pos3, 810),
        ##        (position_set_y, pos3, 810),
        ##        (overlay_set_size, "$g_presentation_obj_14", pos3),
        
        # type relation
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 380),
        (try_begin),
          (eq, "$message_target_type", 1),  # 1 player's kingdom lord , 2 no player's kingdom lord , 3 King of other kingdom
          (create_text_overlay, "$g_presentation_obj_15", "@>> Relations:^This lord belongs to your kingdom.", tf_center_justify),
          ##             (position_set_x, pos1, 250),
          ##             (position_set_y, pos1, 380),
          (overlay_set_position, "$g_presentation_obj_15", pos1),
          (position_set_x, pos1, 250), #area
          (position_set_y, pos1, 300),
          (overlay_set_area_size, "$g_presentation_obj_15", pos1),
          (position_set_x, pos3, 800),
          (position_set_y, pos3, 800),
          (overlay_set_size, "$g_presentation_obj_15", pos3),
        (else_try),
          (create_combo_button_overlay, "$g_presentation_obj_15"),
          (overlay_set_position, "$g_presentation_obj_15", pos1),
        (try_end),
        
        #        (create_combo_button_overlay, "$g_presentation_obj_15"),
        #relation
        (overlay_add_item, "$g_presentation_obj_15", "@Relations: None."),
        (overlay_add_item, "$g_presentation_obj_15", "@Relations: Insult and Provoke."),
        (overlay_add_item, "$g_presentation_obj_15", "@Relations: Send a Gift."),
        ##        (overlay_add_item, "$g_presentation_obj_15", "@Relations: Invite join to your faction."),
        
        (try_begin),
          (eq, "$message_type", no_menssage_choosed),
          (overlay_set_val, "$g_presentation_obj_15", 0),
        (else_try),
          (eq, "$message_type", diplomacy_insult),
          (overlay_set_val, "$g_presentation_obj_15", 1),
        (else_try),
          (eq, "$message_type", diplomacy_sendgift),
          (overlay_set_val, "$g_presentation_obj_15", 2),
          ##        (else_try),
          ##          (eq, "$message_type", diplomacy_invitation),
          ##          (overlay_set_val, "$g_presentation_obj_15", 3),
        (try_end),
        
        ##        (position_set_x, pos3, 810),
        ##        (position_set_y, pos3, 810),
        ##        (overlay_set_size, "$g_presentation_obj_15", pos3),
        
        
        # type diplomacy
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 290),
        (try_begin),
          (ge, "$message_target_type", 3),  # 1 player's kingdom lord , 2 no player's kingdom lord , 3 King of other kingdom
          
          (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_active),
          (troop_get_slot, ":spouse", "trp_player", slot_troop_spouse),
          (this_or_next|faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
          (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, ":spouse"), #
          (create_combo_button_overlay, "$g_presentation_obj_16"),
          (overlay_set_position, "$g_presentation_obj_16", pos1),
        (else_try),
          
          (try_begin),
            (ge, "$message_target_type", 3),  # 1 player's kingdom lord , 2 no player's kingdom lord , 3 King of other kingdom
            (create_text_overlay, "$g_presentation_obj_16", "@>>Diplomacy:^It is only possible to negotiate between faction leaders.^You aren't a king.", tf_center_justify),
          (else_try),
            (create_text_overlay, "$g_presentation_obj_16", "@>>Diplomacy:^It is only possible to negotiate between faction leaders.^{s1} isn't a king.", tf_center_justify),
          (try_end),
          
          (overlay_set_position, "$g_presentation_obj_16", pos1),
          (position_set_x, pos1, 250), #area
          (position_set_y, pos1, 300),
          (overlay_set_area_size, "$g_presentation_obj_16", pos1),
          (position_set_x, pos3, 800),
          (position_set_y, pos3, 800),
          (overlay_set_size, "$g_presentation_obj_16", pos3),
        (try_end),
        
        #(create_combo_button_overlay, "$g_presentation_obj_16"),
        #diplomacy
        (overlay_add_item, "$g_presentation_obj_16", "@Diplomacy: None."),
        (overlay_add_item, "$g_presentation_obj_16", "@Diplomacy: Suggest an Alliance."),
        (overlay_add_item, "$g_presentation_obj_16", "@Diplomacy: Suggest Peace."),
        (overlay_add_item, "$g_presentation_obj_16", "@Diplomacy: Declare War."),
        
        (try_begin),
          (eq, "$message_type", no_menssage_choosed),
          (overlay_set_val, "$g_presentation_obj_16", 0),
        (else_try),
          (eq, "$message_type", diplomacy_sugalliance),
          (overlay_set_val, "$g_presentation_obj_16", 1),
        (else_try),
          (eq, "$message_type", diplomacy_suggestpeace),
          (overlay_set_val, "$g_presentation_obj_16", 2),
        (else_try),
          (eq, "$message_type", diplomacy_declarewar),
          (overlay_set_val, "$g_presentation_obj_16", 3),
        (try_end),
        
        
        ###info
        ## Message
        (try_begin),
          # (eq, "$message_type", no_menssage_choosed),
          # (str_store_string,s10,"@No message chosen.", tf_center_justify),
          # (else_try),
          (eq, "$message_type", orders_follow),
          (str_store_string,s10,"@You want to order {s9} to meet and follow you.", tf_center_justify),
        (else_try),
          (eq, "$message_type", orders_gotoplace),
          (str_store_string,s10,"@You want to order {s9} to go to...", tf_center_justify),
        (else_try),
          (eq, "$message_type", orders_patrolarea),
          (str_store_string,s10,"@You want to order {s9} to patrol around....", tf_center_justify),
        (else_try),
          (eq, "$message_type", orders_besiegeplace),
          (str_store_string,s10,"@You want to order {s9} to besiege...", tf_center_justify),
          ##        (else_try),
          ##          (eq, "$message_type", orders_raidarea),
          ##            (str_store_string,s10,"@You want to order to {s9} raid around {s15} area.", tf_center_justify),
          ##        (else_try),
          ##          (eq, "$message_type", orders_guardplace),
          ##            (create_text_overlay, reg1, "@You want to order to {s9} garrison in {s15}.", tf_center_justify),
        (else_try),
          (eq, "$message_type", diplomacy_insult),
          (str_store_string,s10,"@You want to send a message to insult and provoke {s9}. Perhaps this will make him attack you.", tf_center_justify),
        (else_try),
          (eq, "$message_type", diplomacy_sendgift),
          (str_store_string,s10,"@You want to send a gift of rings, bracelets and other jewelry valued at 2000 peningas to {s9}, with the intention of improving your relationship.", tf_center_justify),
          ##        (else_try),
          ##          (eq, "$message_type", diplomacy_invitation),
          ##            (create_text_overlay, reg1, "@You want to invitate to {s9} to join your kingdom.", tf_center_justify),
        (else_try),
          (eq, "$message_type", diplomacy_sugalliance),
          (str_store_string,s10,"@You want to invite {s9} to make an alliance with you.", tf_center_justify),
        (else_try),
          (eq, "$message_type", diplomacy_suggestpeace),
          (str_store_string,s10,"@You want to make peace with {s9}.", tf_center_justify),
        (else_try),
          (eq, "$message_type", diplomacy_declarewar),
          #(overlay_set_val, "$g_presentation_obj_16", 11),
          (str_store_string,s10,"@You want to declare war on {s9}. Remember that declaring a war without bad relations can cause other realms discomfort with and mistrust of you, especially if your kingdom has a truce or alliance with the other kingdom.", tf_center_justify),
        (else_try),
          (str_store_string,s10,"@No message chosen.", tf_center_justify),
        (try_end),
        
        (create_mesh_overlay_with_tableau_material, "$jq_portrait", -1, "tableau_troop_note_mesh", ":leader"),
        (position_set_x, pos1, 450),
        (position_set_y, pos1, 450),
        (overlay_set_size, "$jq_portrait", pos1),
        (position_set_x, pos1, 650),
        (position_set_y, pos1, 450),
        (overlay_set_position, "$jq_portrait", pos1),
        
        (create_text_overlay, reg1, "@> You are sending a message to {s9}^^> Distance: {reg2} km.^^> Messenger services will cost {reg3} peningas.^^^> {s10}", tf_center_justify|tf_double_space|tf_scrollable),
        # (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable),
        (position_set_x, pos1, 550),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 300),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    #(ti_on_presentation_run,
    #[
    #]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_14"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$message_type", no_menssage_choosed),
          (else_try),
            (eq, ":value", 1),
            (assign, "$message_type", orders_follow),
          (else_try),
            (eq, ":value", 2),
            (assign, "$message_type", orders_gotoplace),
          (else_try),
            (eq, ":value", 3),
            (assign, "$message_type", orders_patrolarea),
          (else_try),
            (eq, ":value", 4),
            (assign, "$message_type", orders_besiegeplace),
            ##        (else_try),
            ##            (eq, ":value", 5),
            ##            (assign, "$message_type", orders_raidarea),
          (try_end),
          (start_presentation, "prsnt_messenger_system"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_15"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$message_type", no_menssage_choosed),
          (else_try),
            (eq, ":value", 1),
            (assign, "$message_type", diplomacy_insult),
          (else_try),
            (eq, ":value", 2),
            (assign, "$message_type", diplomacy_sendgift),
          (try_end),
          (start_presentation, "prsnt_messenger_system"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_16"),
          (try_begin),
            (eq, ":value", 0),
            (assign, "$message_type", no_menssage_choosed),
          (else_try),
            (eq, ":value", 1),
            (assign, "$message_type", diplomacy_sugalliance),
          (else_try),
            (eq, ":value", 2),
            (assign, "$message_type", diplomacy_suggestpeace),
          (else_try),
            (eq, ":value", 3),
            (assign, "$message_type", diplomacy_declarewar),
          (try_end),
          (start_presentation, "prsnt_messenger_system"),
        (else_try), #place
          (eq,":object","$g_presentation_obj_18"),
          (try_begin),
            (neq, "$g_presentation_obj_18_val", ":value"),
            
            ##                                 (this_or_next|eq, "$message_type", orders_patrolarea),
            ##                                 (this_or_next|eq, "$message_type", orders_besiegeplace),
            ##                                 (eq, "$message_type", orders_gotoplace),
            (store_distance_to_party_from_party, ":distance", ":value", "p_main_party"),
            (le, ":distance", 90),
            (assign, "$g_presentation_obj_18_val", ":value"),
            
            (str_store_party_name, s15, "$g_presentation_obj_18_val"),
            (store_faction_of_party,"$g_presentation_center_faction","$g_presentation_obj_18_val"),
            (str_store_faction_name,s16,"$g_presentation_center_faction"),
            (overlay_set_text,"$g_presentation_obj_22", s15,tf_center_justify),
            (overlay_set_text,"$g_presentation_obj_19", s16,tf_center_justify),
            (assign, "$message_place", "$g_presentation_obj_18_val"), #place target
          (try_end),
        (else_try), ## cancel
          (eq, ":object", "$g_presentation_obj_2"),
          (assign,"$message_target",-1), #lord
          (assign,"$message_type",-1), #type
          (assign,"$message_distance",-1), #distance
          (assign,"$message_place",-1), #place
          (party_set_slot, "p_town_1", slot_party_messenger_time, -1), #distance - time
          (assign, "$message_target_type", -1),  # 1 player's kingdom lord , 2 no player's kingdom lord , 3 King of other kingdom
          (presentation_set_duration,0),
          (set_trigger_result, 1),
          # (finish_mission,0),
          
        (else_try),
          (eq, ":object", "$g_presentation_obj_1"),
          
          (try_begin),
            
            (eq, "$message_type", no_menssage_choosed),
            (display_message, "@You have not chosen a message to send."), #chief anadido
            (start_presentation,"prsnt_messenger_system"),
          (else_try),
            (assign,":party_no","$message_target"),
            
            (try_begin), #only work if place is choosed
              (this_or_next|eq, "$message_type", orders_gotoplace),
              (this_or_next|eq, "$message_type", orders_patrolarea),
              (eq, "$message_type", orders_besiegeplace),
              (assign, ":party_place", "$message_place"),
              (store_faction_of_party, ":place_faction", ":party_place"),
              (store_relation, ":relation", ":place_faction", "$players_kingdom"),
            (try_end),
            
            (store_faction_of_party, ":party_faction", ":party_no"),
            (assign,":cost",0),
            (assign,":distance",0),
            (store_distance_to_party_from_party,":distance",":party_no","p_main_party"),
            (val_add,":distance",1),
            (assign,"$message_distance",":distance"),
            (assign,":cost",":distance"),
            (val_mul,":cost",20),
            (try_begin),
              (eq, "$message_type", diplomacy_sendgift),
              (val_add,":cost",2000),
            (try_end),
            (store_troop_gold,":messenger_cost","trp_player"),
            (try_begin),
              (eq, "$message_type", orders_besiegeplace),
              (neg|party_slot_eq, ":party_place", slot_center_is_besieged_by, -1),
              (display_message, "@This place is already besieged by another realm."), #chief anadido
              (start_presentation,"prsnt_messenger_system"),
            (else_try),
              (eq, "$message_type", orders_besiegeplace),
              (ge, ":relation", 0),
              (display_message, "@You have good relations with this kingdom. Your lord won't attack it."), #chief anadido
              (start_presentation,"prsnt_messenger_system"),
            (else_try),
              (eq, "$message_type", diplomacy_suggestpeace),
              (call_script, "script_diplomacy_faction_get_diplomatic_status_with_faction", "fac_player_supporters_faction", ":party_faction"),
              (ge, reg0, 0),  #player is at peace
              (display_message, "@You're already at peace with this kingdom. It isn't necessary to send a messenger."), #chief anadido
              (start_presentation,"prsnt_messenger_system"),
            (else_try),
              (eq, "$message_type", diplomacy_sugalliance),
              (store_relation, ":relation_fac", "fac_player_supporters_faction", ":party_faction"),
              (le, ":relation_fac", 30),
              (display_message, "@You need to improve your relationship with this kingdom before proposing an alliance."), #chief anadido
              (start_presentation,"prsnt_messenger_system"),
            (else_try),
              (eq, "$message_type", diplomacy_sugalliance),
              ##  		             (store_add, ":truce_slot", "fac_player_supporters_faction", slot_faction_truce_days_with_factions_begin),
              ##  		             (val_sub, ":truce_slot", kingdoms_begin),
              ##  		             (faction_get_slot, ":truce_days", ":party_faction", ":truce_slot"),
              ##  		              (gt, ":truce_days", truce_time), #truce time = final alliance
              (ge, reg0, 2),  #player is at alliance
              (display_message, "@You already have an alliance with this kingdom. Wait until the current alliance finishes before you send your petition."), #chief anadido
              (start_presentation,"prsnt_messenger_system"),
            (else_try),
              (eq, "$message_type", diplomacy_declarewar),
              (eq, reg0, -2),  #player is at peace
              (display_message, "@You are already at war with this kingdom."), #chief anadido
              (start_presentation,"prsnt_messenger_system"),
            (else_try),
              (eq, "$message_type", no_menssage_choosed),
              (display_message, "@You have not chosen a message to send."), #chief anadido
              (start_presentation,"prsnt_messenger_system"),
            (else_try),
              (ge,":messenger_cost",":cost"),
              #cobrar
              (troop_remove_gold,"trp_player",":cost"),
              (assign,"$message_sent",1), #message sent
              #tiempo
              (store_current_hours, ":cur_hours"),
              (party_set_slot, "p_town_1", slot_party_messenger_time, ":cur_hours"),
              
              (presentation_set_duration, 0),
              (set_trigger_result, 1),
              #   (finish_mission,0),
            (else_try),
              (display_message, "@You do not have the needed peningas to pay to messenger."), #chief anadido
              #(str_store_string,s4,"@ You do not have need peningas to pay to messenger.",tf_left_align),
              (start_presentation,"prsnt_messenger_system"),
            (try_end),
          (try_end),
        (try_end),
    ]),
]),
##########################

("invasion_respawn_info",prsntf_read_only|prsntf_manual_end_only,0,[
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier, 1000),
        (assign, "$g_multiplayer_last_round_time_counter_value", -1),
        (str_store_string,s0,"str_empty_string"),
        
        (try_begin),
          (ge,"$g_multiplayer_invasion_hardcore",2),
          (str_store_string,s0,"@This is a hardcore mode of Invasion.^^Respawn is possible only at the start of the round."),
        (try_end),
        
        (create_text_overlay, "$g_presentation_obj_flag_projection_display_1", s0, tf_center_justify|tf_with_outline),
        (overlay_set_color, "$g_presentation_obj_flag_projection_display_1", 0xFFFFFF),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, "$g_presentation_obj_flag_projection_display_1", pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 670),
        (overlay_set_position, "$g_presentation_obj_flag_projection_display_1", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_run,[
        (try_begin),
          (multiplayer_get_my_team,":team"),
          (neq,":team",0),
          (presentation_set_duration, 0),
        (else_try),
          (multiplayer_get_my_player,":player"),
          (player_is_active,":player"),
          (player_get_agent_id,":agent",":player"),
          (agent_is_active,":agent"),
          (agent_is_alive,":agent"),
          (presentation_set_duration, 0),
        (else_try),
          (lt,"$g_multiplayer_invasion_hardcore",2),
          (try_begin),
            (eq,"$g_multiplayer_invasion_wave_time",-1),
            (eq,"$g_multiplayer_invasion_wave_number",0),
            #(eq,"$g_multiplayer_invasion_wave_number",1),
            (presentation_set_duration, 0),
          (else_try),
            (neq,"$g_multiplayer_invasion_wave_time",-1),
            (store_sub,":round","$g_multiplayer_invasion_wave_number",1),
            (val_max,":round",0),
            (val_mod,":round","$g_multiplayer_invasion_respawn_rounds"),
            (eq,":round",0),
            (presentation_set_duration, 0),
          (else_try),
            (eq,"$g_multiplayer_invasion_wave_number",-1),
            (presentation_set_duration, 0),
          (try_end),
          
          (try_begin),
            (lt,"$g_multiplayer_invasion_wave_number",13),
            (store_sub,reg10,13,"$g_multiplayer_invasion_wave_number"),
            (val_mod,reg10,"$g_multiplayer_invasion_respawn_rounds"),
            (try_begin),
              (eq,reg10,0),
              (assign,reg10,"$g_multiplayer_invasion_respawn_rounds"),
            (try_end),
          (else_try),
            (store_sub,reg10,16,"$g_multiplayer_invasion_wave_number"),
          (try_end),
          (store_sub,reg11,reg10,1),
          (str_store_string, s0, "@Please wait.^Player respawn will be possible {reg11?after {reg10} rounds:next round}."),
          (overlay_set_text, "$g_presentation_obj_flag_projection_display_1", s0),
        (try_end),
    ]),
]),
("invasion_supply_box_projection", prsntf_read_only|prsntf_manual_end_only,0,[
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier,1000),
        (position_set_x,pos1,50),
        (position_set_y,pos1,50),
        
        (team_get_faction,":faction",0),
        (store_sub,":mesh",":faction","fac_culture_norse"),
        (val_add,":mesh","mesh_mp_scoreboard_team_1"),
        (create_mesh_overlay,"$g_presentation_obj_flag_projection_display_1",":mesh"),
        (overlay_set_size,"$g_presentation_obj_flag_projection_display_1",pos1),
        (overlay_set_display,"$g_presentation_obj_flag_projection_display_1",0),
        
        (scene_prop_get_num_instances,":end","spr_inv_supply_box"),
        (try_begin),
          (gt,":end",1),
          (try_for_range,":unused",1,":end"),
            (create_mesh_overlay,reg1,":mesh"),
            (overlay_set_size,reg1,pos1),
            (overlay_set_display,reg1,0),
          (try_end),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    
    (ti_on_presentation_run,[
        (scene_prop_get_num_instances,":num","spr_inv_supply_box"),
        (try_for_range,":index",0,":num"),
          (scene_prop_get_instance,":box","spr_inv_supply_box",":index"),
          (prop_instance_get_position,pos1,":box"),
          (position_move_z,pos1,120),
          (position_get_screen_projection,pos2,pos1),
          (position_get_x,":x",pos2),
          (position_get_y,":y",pos2),
          #(val_clamp,":x",30,970),
          #(val_clamp,":y",30,720),
          (position_set_x,pos2,":x"),
          (position_set_y,pos2,":y"),
          (store_add,":obj","$g_presentation_obj_flag_projection_display_1",":index"),
          (overlay_set_position,":obj",pos2),
          (overlay_set_display,":obj",1),
        (try_end),
        
        (try_begin),
          #(this_or_next|eq,"$g_multiplayer_invasion_hardcore",1),
          #(this_or_next|eq,"$g_multiplayer_invasion_hardcore",3),
          (eq,"$g_multiplayer_invasion_wave_time",-1),
          (presentation_set_duration, 0),
        (try_end),
        (try_begin),
          (store_sub,":round","$g_multiplayer_invasion_wave_number",1),
          (val_max,":round",0),
          (val_mod,":round","$g_multiplayer_invasion_respawn_rounds"),
          (neq,":round",0),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),
("invasion_commander",0,0,[
    (ti_on_presentation_load,[
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        (assign,"$cam_seeking_mouse",1),
        
        (store_add,":visible","$g_multiplayer_invasion_order_selected_class",1),
        (val_min,":visible",1),
        
        (position_set_x, pos2, 800),
        (position_set_y, pos2, 800),
        (position_set_y, pos1, 700),
        (create_combo_button_overlay,"$g_multiplayer_invasion_order_move"),
        (overlay_set_size,"$g_multiplayer_invasion_order_move", pos2),
        (position_set_x, pos1, 400),
        (overlay_set_position,"$g_multiplayer_invasion_order_move", pos1),
        (overlay_add_item,"$g_multiplayer_invasion_order_move","str_inv_command_order_charge"),
        (overlay_add_item,"$g_multiplayer_invasion_order_move","str_inv_command_order_move"),
        (overlay_set_val,"$g_multiplayer_invasion_order_move","$g_multiplayer_invasion_order_move_val"),
        (overlay_set_display,"$g_multiplayer_invasion_order_move",":visible"),
        
        (create_combo_button_overlay,"$g_multiplayer_invasion_order_weapons"),
        (overlay_set_size,"$g_multiplayer_invasion_order_weapons", pos2),
        (position_set_x, pos1, 600),
        (overlay_set_position,"$g_multiplayer_invasion_order_weapons", pos1),
        (overlay_add_item,"$g_multiplayer_invasion_order_weapons","str_inv_command_order_use_any"),
        (overlay_add_item,"$g_multiplayer_invasion_order_weapons","str_inv_command_order_use_melee"),
        (overlay_add_item,"$g_multiplayer_invasion_order_weapons","str_inv_command_order_use_ranged"),
        (overlay_set_val,"$g_multiplayer_invasion_order_weapons","$g_multiplayer_invasion_order_weapons_val"),
        (overlay_set_display,"$g_multiplayer_invasion_order_weapons",":visible"),
        
        (position_set_x,pos1,860),
        (position_set_y,pos1,320),
        (create_image_button_overlay,reg1,"mesh_white_plane","mesh_white_plane"),
        (position_set_x, pos0, 6500),
        (position_set_y, pos0, 1500),
        (overlay_set_size,reg1,pos0),
        (overlay_set_position,reg1,pos1),
        (overlay_set_color,reg1,0xFF000000),
        (overlay_set_alpha,reg1,0xaa),
        (position_set_x,pos1,920),
        (position_set_y,pos1,320),
        (create_text_overlay,reg2,"str_inv_command_class_deselect",tf_center_justify),
        (overlay_set_position,reg2,pos1),
        (overlay_set_color,reg2,0xFFFFFFFF),
        (try_begin),
          (eq,"$g_multiplayer_invasion_order_selected_class",-1),
          (overlay_set_display,reg1,0),
          (overlay_set_display,reg2,0),
        (try_end),
        
        (position_set_x,pos1,860),
        (position_set_y,pos1,550),
        (create_image_button_overlay,"$g_multiplayer_invasion_order_classes","mesh_white_plane","mesh_white_plane"),
        (position_set_x, pos0, 6500),
        (position_set_y, pos0, 1500),
        (overlay_set_size,"$g_multiplayer_invasion_order_classes",pos0),
        (overlay_set_position,"$g_multiplayer_invasion_order_classes",pos1),
        (overlay_set_color,"$g_multiplayer_invasion_order_classes",0xFF000000),
        (overlay_set_alpha,"$g_multiplayer_invasion_order_classes",0xaa),
        
        (position_set_x,pos1,920),
        (position_set_y,pos1,550),
        (create_text_overlay,reg1,"str_inv_command_class_all",tf_center_justify),
        (overlay_set_position,reg1,pos1),
        (overlay_set_color,reg1,0xFFFFFFFF),
        
        (assign,":y",500),
        (try_for_range,":unused",0,3),
          (position_set_x,pos1,860),
          (position_set_y,pos1,":y"),
          (create_image_button_overlay,reg1,"mesh_white_plane","mesh_white_plane"),
          (position_set_x, pos0, 6500),
          (position_set_y, pos0, 2000),
          (overlay_set_size,reg1,pos0),
          (overlay_set_position,reg1,pos1),
          (overlay_set_color,reg1,0xFF000000),
          (overlay_set_alpha,reg1,0xaa),
          
          (store_add,reg1,":y",5),#16
          (position_set_x,pos1,920),
          (position_set_y,pos1,reg1),
          (assign,reg1,0),
          (create_text_overlay,reg1,"str_empty_string",tf_center_justify),
          (overlay_set_position,reg1,pos1),
          (overlay_set_color,reg1,0xFFFFFFFF),
          (val_sub,":y",50),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change,[
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        (set_fixed_point_multiplier, 1000),
        (try_begin),
          (eq,"$g_multiplayer_invasion_order_move",":object"),
          (assign,"$g_multiplayer_invasion_order_move_val",":value"),
          (try_begin),
            (eq,":value",0),
            (multiplayer_send_2_int_to_server, multiplayer_event_give_order_to_class,"$g_multiplayer_invasion_order_selected_class",mordr_charge),
          (try_end),
        (else_try),
          (eq,"$g_multiplayer_invasion_order_weapons",":object"),
          (assign,"$g_multiplayer_invasion_order_weapons_val",":value"),
          (try_begin),
            (eq,":value",0),
            (multiplayer_send_2_int_to_server, multiplayer_event_give_order_to_class,"$g_multiplayer_invasion_order_selected_class",mordr_use_any_weapon),
          (else_try),
            (eq,":value",1),
            (multiplayer_send_2_int_to_server, multiplayer_event_give_order_to_class,"$g_multiplayer_invasion_order_selected_class",mordr_use_melee_weapons),
          (else_try),
            (eq,":value",2),
            (multiplayer_send_2_int_to_server, multiplayer_event_give_order_to_class,"$g_multiplayer_invasion_order_selected_class",mordr_use_ranged_weapons),
          (try_end),
          
        (else_try),
          (store_sub,":obj","$g_multiplayer_invasion_order_classes",2),
          (eq,":obj",":object"),##deselect
          (assign,"$g_multiplayer_invasion_order_selected_class",-1),
          (presentation_set_duration,0),
          (start_presentation, "prsnt_invasion_commander"),
        (else_try),
          (call_script,"script_inv_commander_selected_class",":object"),
        (try_end),
    ]),
    (ti_on_presentation_run,[
        #(store_trigger_param_1, ":cur_time"),
        (set_fixed_point_multiplier, 1000),
        (try_begin),
          (multiplayer_get_my_team,":team"),
          (this_or_next|eq,"$g_round_ended",1),
          (neq,":team",1),
          (mission_cam_set_mode,0),
          (presentation_set_duration,0),
        (try_end),
        (try_begin),
          (key_clicked,key_left_mouse_button),
          (mouse_get_position,pos1),
          (position_get_x,":x",pos1),
          (position_get_y,":y",pos1),
          (try_begin),
            (lt,":x",850),
            (lt,":y",630),
            (gt,"$g_multiplayer_invasion_order_selected_class",-1),
            (eq,"$g_multiplayer_invasion_order_move_val",1),
            
            (mouse_get_world_projection,pos1,pos2),
            (set_fixed_point_multiplier,100),###Face pos1 to pos2
            (position_get_x,":x",pos1),
            (position_get_y,":y",pos1),
            (position_get_z,":z",pos1),
            (position_get_x,":x_diff",pos2),
            (position_get_y,":y_diff",pos2),
            (val_sub,":x_diff",":x"),
            (val_sub,":y_diff",":y"),
            
            (init_position,pos1),
            (position_set_x,pos1,":x"),
            (position_set_y,pos1,":y"),
            (position_set_z,pos1,":z"),
            
            (try_begin),
              (this_or_next|neq,":x_diff",0),
              (neq,":y_diff",0),
              (store_atan2,":rotate",":y_diff",":x_diff"),
              (assign,":dist",90),
              (convert_to_fixed_point,":dist"),
              (val_sub,":rotate",":dist"),
              (position_rotate_z_floating,pos1,":rotate"),
            (try_end),
            
            (get_distance_between_positions,":dist",pos1,pos2),
            (try_begin),
              (gt,":dist",0),
              (position_get_z,":rotate",pos2),
              (val_sub,":rotate",":z"),
              (val_mul,":rotate",100),
              (val_div,":rotate",":dist"),
              (store_asin,":rotate",":rotate"),
              (position_rotate_x_floating,pos1,":rotate"),
            (try_end),
            (set_fixed_point_multiplier,1000),
            (cast_ray,reg1,pos5,pos1,9999999),
            
            (position_get_x,":x",pos5),
            (position_get_y,":y",pos5),
            (position_get_z,":z",pos5),
            (store_add,":class","$g_multiplayer_invasion_order_selected_class",20),#fix for message
            (multiplayer_send_4_int_to_server, multiplayer_event_give_order_to_class,":class",":x",":y",":z"),
          (try_end),
        (try_end),
    ]),
]),

#####new
("multiplayer_admin_send_message", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier, 1000),
        (try_begin),
          (eq,"$g_presentation_credits_obj_3",1),
          (create_text_overlay, reg1, "@Send message to other ADMINS:", tf_single_line|tf_with_outline),
        (else_try),
          (create_text_overlay, reg1, "@Broadcast message to all players:", tf_single_line|tf_with_outline),
        (try_end),
        (overlay_set_color, reg1, 0xFFFFFFFF),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 530),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 980),
        (overlay_set_size, reg1, pos1),
        
        (create_simple_text_box_overlay, "$g_presentation_credits_obj_1"),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 500),
        (overlay_set_position, "$g_presentation_credits_obj_1", pos1),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_1", pos1),
        (presentation_set_duration, 999999),
        (overlay_obtain_focus, "$g_presentation_credits_obj_1"),
        (assign, "$g_presentation_credits_obj_2",1),
    ]),
    (ti_on_presentation_event_state_change,[
        (store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_credits_obj_1"),
          (try_begin),
            (key_is_down, key_enter),
            (neg|str_is_empty, s0),
            (presentation_set_duration, 0),
            (try_begin),
              (eq,"$g_presentation_credits_obj_3",1),
              (multiplayer_send_string_to_server, multiplayer_event_admin_chat, s0),
            (else_try),
              (multiplayer_send_string_to_server, multiplayer_event_admin_message, s0),
            (try_end),
          (else_try),
            (presentation_set_duration, 0),
          (try_end),
        (try_end),
    ]),
    (ti_on_presentation_run,[
        (store_trigger_param_1, ":cur_time"),
        (try_begin),
          (eq,"$g_presentation_credits_obj_2",1),
          (gt,":cur_time",100),
          (assign,"$g_presentation_credits_obj_2",0),
          (str_clear,s0),
          (overlay_set_text,"$g_presentation_credits_obj_1",s0),
        (try_end),
        (try_begin),
          (this_or_next|key_clicked, key_pad_start),
          (key_clicked, key_escape),
          (gt, ":cur_time", 200),
          (str_clear,s0),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),
("multiplayer_display_admin_message", prsntf_read_only|prsntf_manual_end_only, 0, [
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier, 1000),
        (display_message, "@*ADMIN*: {s0}", 0xFFFF0000),
        (create_text_overlay, reg0, "@*ADMIN*:", tf_center_justify|tf_with_outline),
        (overlay_set_color, reg0, 0xFFFFFFFF),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg0, pos1),
        (create_text_overlay, reg1, s0, tf_center_justify|tf_with_outline),
        (overlay_set_color, reg1, 0xFFFF0000),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 420),
        (overlay_set_position, reg1, pos1),
        
        (omit_key_once, key_pad_start),
        (omit_key_once, key_escape),
        (presentation_set_duration, 1000),
    ]),
    (ti_on_presentation_run,[
        (store_trigger_param_1, ":cur_time"),
        (try_begin),
          (this_or_next|key_clicked, key_pad_start),
          (key_clicked, key_escape),
          (ge, ":cur_time", 2500),
          (clear_omitted_keys),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),
("multiplayer_admin_tools", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier, 1000),
        
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1150),
        (overlay_set_size, reg0, pos1),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 20),
        (overlay_set_position, reg0, pos1),
        
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_escape_menu_container", s0, tf_scrollable_style_2),
        (position_set_x, pos1, 285),
        (position_set_y, pos1, 15),
        (overlay_set_position, "$g_presentation_obj_escape_menu_container", pos1),
        (position_set_x, pos1, 405),
        (position_set_y, pos1, 640),
        (overlay_set_area_size, "$g_presentation_obj_escape_menu_container", pos1),
        (set_container_overlay, "$g_presentation_obj_escape_menu_container"),
        
        
        (assign, ":cur_y", 610),
        
        (create_text_overlay, reg0, "str_choose_an_option", 0),
        (overlay_set_color, reg0, 0xFFFFFF),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg0, pos1),
        (val_sub, ":cur_y", 30),
        
        (position_set_x, pos2, 900),
        (position_set_y, pos2, 900),
        
        (assign,"$g_presentation_obj_escape_menu_1",-1),
        
        (position_set_x, pos1, 30),
        (create_button_overlay, "$g_presentation_obj_escape_menu_1", "@Reset map", 0),
        (overlay_set_color, "$g_presentation_obj_escape_menu_1", 0xFFFFFF),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_size, "$g_presentation_obj_escape_menu_1", pos2),
        (overlay_set_position, "$g_presentation_obj_escape_menu_1", pos1),
        (val_sub, ":cur_y", 45),
        
        (try_for_range,":try",1,16),
          (try_begin),(eq,":try",1),(create_button_overlay, reg1, "@Slay all horses", 0),
          (else_try),(eq,":try",2), (create_button_overlay, reg1, "@Slay all bots", 0),
          (else_try),(eq,":try",3), (create_button_overlay, reg1, "@Slay player", 0),
          (else_try),(eq,":try",4), (create_button_overlay, reg1, "@Heal player", 0),
            (val_sub, ":cur_y", 15),
          (else_try),(eq,":try",5), (create_button_overlay, reg1, "@Refill player's ammo", 0),
          (else_try),(eq,":try",6), (create_button_overlay, reg1, "@Fix player's shield", 0),
          (else_try),(eq,":try",7), (create_button_overlay, reg1, "@Change player's team", 0),
            (val_sub, ":cur_y", 15),
          (else_try),(eq,":try",8), (create_button_overlay, reg1, "@Make player a spectator", 0),
          (else_try),(eq,":try",9), (create_button_overlay, reg1, "@Give player Thor's Hammer", 0),
          (else_try),(eq,":try",10),(create_button_overlay, reg1, "@Beacon a player", 0),
            (val_sub, ":cur_y", 15),
          (else_try),(eq,":try",11),(create_button_overlay, reg1, "@Teleport to player", 0),
          (else_try),(eq,":try",12),(create_button_overlay, reg1, "@Teleport a player to me", 0),
          (else_try),(eq,":try",13),(create_button_overlay, reg1, "@Make player immortal", 0),
            (val_sub, ":cur_y", 15),
          (else_try),(eq,":try",14),(create_button_overlay, reg1, "@Make player mortal again", 0),
          (else_try),(eq,":try",15),(create_button_overlay, reg1, "@Force Master of the Field", 0),
            (val_sub, ":cur_y", 15),
          (try_end),
          (overlay_set_color, reg1, 0xFFFFFF),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_size, reg1, pos2),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 30),
        (try_end),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change,[
        (store_trigger_param_1, ":object"),
        (store_sub,":obj",":object","$g_presentation_obj_escape_menu_1"),
        (ge,":obj",0),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_escape_menu_1"),
          (multiplayer_send_int_to_server, multiplayer_event_admin, me_admin_reset_map),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":obj", 1),
          (multiplayer_send_int_to_server, multiplayer_event_admin, me_admin_slay_horses),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":obj", 2),
          (multiplayer_send_int_to_server, multiplayer_event_admin, me_admin_slay_bots),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":obj", 3),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_slay),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 4),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_heal),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 5),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_refill),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 6),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_fix_shield),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 7),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_swap_team),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 8),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_swap_spec),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 9),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_give_hammer),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 10),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_beacon),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 11),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_teleport_me),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 12),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_teleport_him),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 13),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_immortal),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 14),
          (presentation_set_duration, 0),
          (assign, "$g_multiplayer_players_list_action_type", plat_mortal),
          (start_presentation, "prsnt_multiplayer_show_players_list"),
        (else_try),
          (eq, ":obj", 15),
          (try_begin),
            (eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
            (multiplayer_send_int_to_server, multiplayer_event_admin, me_admin_force_master),
            (presentation_set_duration, 0),
          (else_try),
            (display_message,"@Only available in Battle game mode!",0xff0000),
          (try_end),
        (try_end),
    ]),
    (ti_on_presentation_run,[
        (store_trigger_param_1, ":cur_time"),
        (try_begin),
          (this_or_next|key_clicked, key_escape),
          (key_clicked, key_pad_start),
          (gt, ":cur_time", 200),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),
("multiplayer_beacon_player", prsntf_read_only|prsntf_manual_end_only,0,[
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier,1000),
        (position_set_x,pos1,50),
        (position_set_y,pos1,50),
        (try_begin),
          (player_is_active,"$tutorialmq_1_state"),
          (player_get_team_no,":team","$tutorialmq_1_state"),
          (team_get_faction,":mesh",":team"),
          (val_sub,":mesh","fac_culture_norse"),
          (val_add,":mesh","mesh_mp_scoreboard_team_1"),
          (create_mesh_overlay,"$tutorial_1_msg_1_displayed",":mesh"),
          (overlay_set_size,"$tutorial_1_msg_1_displayed",pos1),
          (presentation_set_duration, 2000),#20 sec.
        (else_try),
          (assign,"$tutorial_1_msg_1_displayed",-1),
          (presentation_set_duration,0),
        (try_end),
    ]),
    (ti_on_presentation_run,[
        (try_begin),
          (neq,"$g_round_ended",1),
          (ge,"$tutorial_1_msg_1_displayed",0),
          (player_is_active,"$tutorialmq_1_state"),
          (player_get_agent_id,":agent","$tutorialmq_1_state"),
          (agent_is_active,":agent"),
          (agent_is_alive,":agent"),
          (set_fixed_point_multiplier,1000),
          (agent_get_position,pos1,":agent"),
          (position_move_y,pos1,200),
          (position_get_screen_projection,pos2,pos1),
          (position_get_x,":x",pos2),
          (position_get_y,":y",pos2),
          (val_clamp,":x",30,970),
          (val_clamp,":y",30,720),
          (position_set_x,pos2,":x"),
          (position_set_y,pos2,":y"),
          (overlay_set_position,"$tutorial_1_msg_1_displayed",pos2),
        (else_try),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("show_active_bonuses",prsntf_read_only|prsntf_manual_end_only,0,[
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier, 1000),
        (presentation_set_duration, 999999),
        
        (get_player_agent_no,":agent"),
        (try_begin),
          (agent_is_active,":agent"),
          (agent_is_alive,":agent"),
          (assign,":x",950),
          (position_set_y,pos1,170),
          (position_set_x,pos2,50),
          (position_set_y,pos2,50),
          (try_begin),
            (agent_slot_eq,":agent",slot_agent_horn_bonus_applied,1),
            (create_mesh_overlay,reg1,"mesh_ico_horn_bonus"),
            (overlay_set_size,reg1,pos2),
            (position_set_x,pos1,":x"),
            (overlay_set_position,reg1,pos1),
            (val_sub,":x",50),
          (try_end),
          (try_begin),
            (agent_slot_eq,":agent",slot_agent_banner_bonus_applied,1),
            (create_mesh_overlay,reg1,"mesh_ico_banner_bonus"),
            (overlay_set_size,reg1,pos2),
            (position_set_x,pos1,":x"),
            (overlay_set_position,reg1,pos1),
            (val_sub,":x",50),
          (try_end),
          (try_begin),
            (agent_slot_ge,":agent",slot_agent_shieldwall_bonus,1),
            (create_mesh_overlay,reg1,"mesh_ico_shieldwall_bonus"),
            (overlay_set_size,reg1,pos2),
            (position_set_x,pos1,":x"),
            (overlay_set_position,reg1,pos1),
            (try_begin),
              (neg|agent_slot_eq,":agent",slot_agent_shieldwall_bonus,3),
              (overlay_set_alpha,reg1,0x44),
            (try_end),
          (try_end),
        (try_end),
    ]),
    (ti_on_presentation_run,[
        (get_player_agent_no,":agent"),
        (try_begin),
          (eq,"$gRefreshBonusIndicator",1),
          (assign,"$gRefreshBonusIndicator",0),
          (presentation_set_duration,0),
          (try_begin),
            (agent_is_active,":agent"),
            (agent_is_alive,":agent"),
            (this_or_next|agent_slot_eq,":agent",slot_agent_horn_bonus_applied,1),
            (this_or_next|agent_slot_eq,":agent",slot_agent_banner_bonus_applied,1),
            (agent_slot_ge,":agent",slot_agent_shieldwall_bonus,1),
            (start_presentation,"prsnt_show_active_bonuses"),
          (try_end),
        (else_try),
          (try_begin),
            (agent_is_active,":agent"),
            (agent_is_alive,":agent"),
            (this_or_next|agent_slot_eq,":agent",slot_agent_horn_bonus_applied,1),
            (this_or_next|agent_slot_eq,":agent",slot_agent_banner_bonus_applied,1),
            (agent_slot_ge,":agent",slot_agent_shieldwall_bonus,1),
          (else_try),
            (presentation_set_duration,0),
          (try_end),
        (try_end),
    ]),
]),
("show_thors_champion",prsntf_read_only|prsntf_manual_end_only,0,[
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier, 1000),
        (presentation_set_duration, 999999),
        
        (str_clear,s1),
        (str_clear,s2),
        (try_begin),
          (agent_is_active,"$gThorsChampionAgent"),
          (agent_is_alive,"$gThorsChampionAgent"),
          (get_player_agent_no,":agent"),
          (try_begin),
            (eq,"$gThorsChampionAgent",":agent"),
            (str_store_string,s1,"@You are the Thor's Champion"),
            (str_store_string,s2,"@Kill as many opponents as you can"),
          (else_try),
            (str_store_string,s1,"@Kill"),
            (try_begin),
              (neg|agent_is_non_player,"$gThorsChampionAgent"),
              (agent_get_player_id,":player","$gThorsChampionAgent"),
              (player_is_active,":player"),
              (str_store_player_username,s2,":player"),
            (else_try),
              (str_store_agent_name,s2,"$gThorsChampionAgent"),
            (try_end),
          (try_end),
        (try_end),
        (create_text_overlay,reg1,s1,tf_center_justify|tf_with_outline),
        (position_set_x,pos1,500),
        (position_set_y,pos1,700),
        (overlay_set_position,reg1,pos1),
        (overlay_set_color,reg1,0xffffff),
        (create_text_overlay,reg1,s2,tf_center_justify|tf_with_outline),
        (position_set_x,pos1,500),
        (position_set_y,pos1,670),
        (overlay_set_position,reg1,pos1),
        (overlay_set_color,reg1,0xffff22),
        
        (create_mesh_overlay,"$tutorial_2_msg_1_displayed","mesh_ico_thor_champ"),
        (position_set_x,pos1,50),
        (position_set_y,pos1,50),
        (overlay_set_size,"$tutorial_2_msg_1_displayed",pos1),
        (position_set_x,pos1,-100),
        (position_set_y,pos1,-100),
        (overlay_set_position,"$tutorial_2_msg_1_displayed",pos1),
        
    ]),
    (ti_on_presentation_run,[
        (try_begin),
          (lt,"$tutorial_2_msg_1_displayed",0),
          (presentation_set_duration,0),
          (start_presentation,"prsnt_show_thors_champion"),
        (else_try),
          (agent_is_active,"$gThorsChampionAgent"),
          (agent_is_alive,"$gThorsChampionAgent"),
          (get_player_agent_no,":agent"),
          (set_fixed_point_multiplier,1000),
          (try_begin),
            (eq,"$gThorsChampionAgent",":agent"),
            (position_set_x,pos2,-1000),
            (position_set_y,pos2,-1000),
            (str_store_string,s1,"@You are Thor's champion"),
            (str_store_string,s2,"@Kill as many opponents as you can"),
          (else_try),
            #(agent_get_position,pos1,"$gThorsChampionAgent"),
            (agent_get_bone_position,pos1,"$gThorsChampionAgent",hb_head,1),
            (position_move_y,pos1,100),
            (position_get_screen_projection,pos2,pos1),
            (position_get_x,":x",pos2),
            (position_get_y,":y",pos2),
            (val_clamp,":x",30,970),
            (val_clamp,":y",30,720),
            (position_set_x,pos2,":x"),
            (position_set_y,pos2,":y"),
            #strings
            (str_store_string,s1,"@Kill"),
            (try_begin),
              (neg|agent_is_non_player,"$gThorsChampionAgent"),
              (agent_get_player_id,":player","$gThorsChampionAgent"),
              (player_is_active,":player"),
              (str_store_player_username,s2,":player"),
            (else_try),
              (str_store_agent_name,s2,"$gThorsChampionAgent"),
            (try_end),
          (try_end),
          (overlay_set_position,"$tutorial_2_msg_1_displayed",pos2),
          (store_sub,":obj","$tutorial_2_msg_1_displayed",2),
          (overlay_set_text,":obj",s1),
          (val_add,":obj",1),
          (overlay_set_text,":obj",s2),
        (else_try),
          (presentation_set_duration,0),
        (try_end),
    ]),
]),
("show_ship_captain",prsntf_read_only|prsntf_manual_end_only,0,[
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier, 1000),
        (presentation_set_duration, 999999),
        
        (str_clear,s1),
        (str_clear,s2),
        (try_begin),
          (agent_is_active,"$player_ship_captain"),
          (agent_is_alive,"$player_ship_captain"),
          (get_player_agent_no,":agent"),
          (try_begin),
            (eq,"$player_ship_captain",":agent"),
            (str_store_string,s1,"@You are the captain of this ship"),
            (str_store_string,s2,"@Controls: arrow keys, Enter"),	#Cam:'Backspace'
          (else_try),
            (str_store_string,s1,"@Ship Captain"),
            (try_begin),
              (neg|agent_is_non_player,"$player_ship_captain"),
              (agent_get_player_id,":player","$player_ship_captain"),
              (player_is_active,":player"),
              (str_store_player_username,s2,":player"),
            (else_try),
              (str_store_agent_name,s2,"$player_ship_captain"),
            (try_end),
          (try_end),
        (try_end),
        (create_text_overlay,reg1,s1,tf_center_justify|tf_with_outline),
        (position_set_x,pos1,500),
        (position_set_y,pos1,700),
        (overlay_set_position,reg1,pos1),
        (overlay_set_color,reg1,0xffffff),
        (create_text_overlay,reg1,s2,tf_center_justify|tf_with_outline),
        (position_set_x,pos1,500),
        (position_set_y,pos1,670),
        (overlay_set_position,reg1,pos1),
        (overlay_set_color,reg1,0xffff22),
        
        (create_mesh_overlay,"$tutorial_2_msg_1_displayed","mesh_ico_ship_captain"),
        (position_set_x,pos1,50),
        (position_set_y,pos1,50),
        (overlay_set_size,"$tutorial_2_msg_1_displayed",pos1),
        (position_set_x,pos1,-100),
        (position_set_y,pos1,-100),
        (overlay_set_position,"$tutorial_2_msg_1_displayed",pos1),
        
    ]),
    (ti_on_presentation_run,[
        (try_begin),
          (lt,"$tutorial_2_msg_1_displayed",0),
          (presentation_set_duration,0),
          (start_presentation,"prsnt_show_ship_captain"),
        (else_try),
          (neq,"$player_ship_number",-1),
          (get_player_agent_no,":agent"),
          (agent_is_active,":agent"),
          (agent_is_alive,":agent"),
          (agent_is_active,"$player_ship_captain"),
          (agent_is_alive,"$player_ship_captain"),
          (set_fixed_point_multiplier,1000),
          (try_begin),
            (eq,"$player_ship_captain",":agent"),
            (position_set_x,pos2,-1000),
            (position_set_y,pos2,-1000),
          (else_try),
            (agent_get_bone_position,pos1,"$player_ship_captain",hb_head,1),
            (position_move_y,pos1,100),
            (position_get_screen_projection,pos2,pos1),
            (position_get_x,":x",pos2),
            (position_get_y,":y",pos2),
            #(val_clamp,":x",30,970),
            #(val_clamp,":y",30,720),
            (position_set_x,pos2,":x"),
            (position_set_y,pos2,":y"),
          (try_end),
          (overlay_set_position,"$tutorial_2_msg_1_displayed",pos2),
        (else_try),
          (presentation_set_duration,0),
        (try_end),
    ]),
]),
("show_game_mode_list", prsntf_manual_end_only, 0, [
    (ti_on_presentation_load,[
        (set_fixed_point_multiplier, 1000),
        (create_mesh_overlay, reg0, "mesh_mp_ingame_menu"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 80),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        
        (create_text_overlay, reg0,"@Change game type to:",tf_center_justify),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg0, pos1),
        (overlay_set_color, reg0, 0xFFFFFF),
        
        (str_clear, s0),
        (create_combo_label_overlay, "$g_presentation_obj_admin_panel_10"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_admin_panel_10", pos1),
        (try_for_range, ":i_game_type", 0, multiplayer_num_game_types),
          (store_add, ":string_index", ":i_game_type", multiplayer_game_type_names_begin),
          (str_store_string, s0, ":string_index"),
          (overlay_add_item, "$g_presentation_obj_admin_panel_10", s0),
        (try_end),
        (overlay_set_val, "$g_presentation_obj_admin_panel_10", "$g_multiplayer_game_type"),
        (assign,"$g_multiplayer_factions_list_action_type","$g_multiplayer_game_type"),
        (presentation_set_duration, 999999),
        
        (create_button_overlay, "$g_presentation_obj_admin_panel_9","@Send Poll",tf_center_justify),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_admin_panel_9", pos1),
        (overlay_set_color, "$g_presentation_obj_admin_panel_9", 0xFFFFFF),
        
    ]),
    (ti_on_presentation_event_state_change,[
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":val"),
        (try_begin),
          (eq,":object","$g_presentation_obj_admin_panel_10"),
          (assign,"$g_multiplayer_factions_list_action_type",":val"),
        (else_try),
          (eq,":object","$g_presentation_obj_admin_panel_9"),
          (multiplayer_get_my_player,":my_player_no"),
          (player_is_active,":my_player_no"),
          (multiplayer_send_2_int_to_server, multiplayer_event_start_new_poll, 5, "$g_multiplayer_factions_list_action_type"),
          (store_mission_timer_a, ":mission_timer"),
          (val_add, ":mission_timer", multiplayer_poll_disable_period),
          (player_set_slot, ":my_player_no", slot_player_poll_disabled_until_time, ":mission_timer"),
          (presentation_set_duration, 0),
        (try_end),
    ]),
    (ti_on_presentation_run,[
        (store_trigger_param_1, ":cur_time"),
        (try_begin),
          (this_or_next|key_clicked, key_escape),
          (key_clicked, key_pad_start),
          (gt, ":cur_time", 200),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),

#############
#############

("colour_kingdom", 0, 0, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_troop_trees"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        # color
        (faction_get_color, "$current_color", "fac_player_supporters_faction"),
        (store_mod, "$current_blue", "$current_color", 256),
        (store_div, "$current_green", "$current_color", 256),
        (val_mod, "$current_green", 256),
        (store_div, "$current_red", "$current_color", 256 * 256),
        (val_mod, "$current_red", 256),
        
        # message
        (create_text_overlay, reg1, "@Choose a colour for your kingdom!", tf_double_space|tf_center_justify),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 1800),
        (position_set_y, pos1, 1800),
        (overlay_set_size, reg1, pos1),
        
        # cancel
        (create_game_button_overlay, "$g_presentation_obj_1", "str_cancel"),
        (position_set_x, pos1, 700),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        # done
        (create_game_button_overlay, "$g_presentation_obj_2", "str_done"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        # kingdom name
        (str_store_faction_name, s7, "fac_player_supporters_faction"),
        (create_text_overlay, reg1, s7, tf_with_outline|tf_center_justify),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 420),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 3500),
        (position_set_y, pos1, 3500),
        (overlay_set_size, reg1, pos1),
        (overlay_set_color, reg1, "$current_color"),
        (assign, "$g_presentation_obj_3", reg1),
        
        (position_set_x, pos1, 500),
        (assign, ":button_y_position", 300),
        #red
        (create_slider_overlay, reg1, 0, 226),
        (overlay_set_val, reg1, "$current_red"),
        (position_set_y, pos1, ":button_y_position"),
        (val_sub, ":button_y_position", 30),
        (overlay_set_position, reg1, pos1),
        (assign, "$g_presentation_obj_11", reg1),
        (create_text_overlay, reg1, "@Red", tf_center_justify),
        (position_set_y, pos1, ":button_y_position"),
        (val_sub, ":button_y_position", 40),
        (overlay_set_position, reg1, pos1),
        
        (create_slider_overlay, reg1, 0, 226),
        (overlay_set_val, reg1, "$current_green"),
        (position_set_y, pos1, ":button_y_position"),
        (val_sub, ":button_y_position", 30),
        (overlay_set_position, reg1, pos1),
        (assign, "$g_presentation_obj_12", reg1),
        (create_text_overlay, reg1, "@Green", tf_center_justify),
        (position_set_y, pos1, ":button_y_position"),
        (val_sub, ":button_y_position", 40),
        (overlay_set_position, reg1, pos1),
        
        (create_slider_overlay, reg1, 0, 226),
        (overlay_set_val, reg1, "$current_blue"),
        (position_set_y, pos1, ":button_y_position"),
        (val_sub, ":button_y_position", 30),
        (overlay_set_position, reg1, pos1),
        (assign, "$g_presentation_obj_13", reg1),
        (create_text_overlay, reg1, "@Blue", tf_center_justify),
        (position_set_y, pos1, ":button_y_position"),
        (val_sub, ":button_y_position", 40),
        (overlay_set_position, reg1, pos1),
        
        # CHEAT
        (try_begin),
          (ge, "$cheat_mode", 1),
          (create_number_box_overlay, "$g_presentation_obj_7", kingdoms_begin, kingdoms_end),
          (position_set_x, pos1, 100),
          (position_set_y, pos1, 100),
          (overlay_set_position, "$g_presentation_obj_7", pos1),
          (create_text_overlay, "$g_presentation_obj_8", "@ ", tf_center_justify),
          (position_set_x, pos1, 200),
          (overlay_set_position, "$g_presentation_obj_8", pos1),
        (end_try),
        
        # (create_mesh_overlay, reg2, "mesh_white_plane"),
        # (overlay_set_color, reg2, "$current_color"),
        # (overlay_set_alpha, reg2, 0xFF),
        # (position_set_x, pos1, 660 * 10),
        # (position_set_y, pos1, 137 * 10),
        # (overlay_set_size, reg2, pos1),
        # (position_set_x, pos1, 20),
        # (position_set_y, pos1, 600),
        # (overlay_set_position, reg2, pos1),
        # (assign, "$g_presentation_obj_17", reg2),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          # (change_screen_return),
          #added v-2637
          #  (set_trigger_result,1),
          (assign, "$factionorders_type", factionorders_no),
          (start_presentation, "prsnt_faction_screen_main"),
          
        # (else_try),
          # (eq, ":object", "$g_presentation_obj_2"),
          # (ge, "$cheat_mode", 1),
          # (faction_set_color, "$temp1", "$current_color"), VC-3921 unfortunately this prevents changing color of player faction and triggers testers
          # (presentation_set_duration, 0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_2"),
          (faction_set_color, "fac_player_supporters_faction", "$current_color"),
          (presentation_set_duration, 0),
          #added v-2637
          (assign, "$factionorders_type", factionorders_no),
          (start_presentation, "prsnt_faction_screen_main"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_11"),
          (assign, "$current_red", ":value"),
          (call_script, "script_make_color"),
          (overlay_set_color, "$g_presentation_obj_3", "$current_color"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_12"),
          (assign, "$current_green", ":value"),
          (call_script, "script_make_color"),
          (overlay_set_color, "$g_presentation_obj_3", "$current_color"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_13"),
          (assign, "$current_blue", ":value"),
          (call_script, "script_make_color"),
          (overlay_set_color, "$g_presentation_obj_3", "$current_color"),
        (try_end),
        
        # CHEAT
        # (try_begin), VC-3921
          # (ge, "$cheat_mode", 1),
          # (eq, ":object", "$g_presentation_obj_7"),
          # (assign, "$temp1", ":value"),
          # (faction_get_color, "$current_color", ":value"),
          # (overlay_set_color, "$g_presentation_obj_3", "$current_color"),
          # (str_store_faction_name, s7, ":value"),
          # (overlay_set_text, "$g_presentation_obj_3", s7),
          
          # (store_mod, "$current_blue", "$current_color", 256),
          # (store_div, "$current_green", "$current_color", 256),
          # (val_mod, "$current_green", 256),
          # (store_div, "$current_red", "$current_color", 256 * 256),
          # (val_mod, "$current_red", 256),
          # (overlay_set_val, "$g_presentation_obj_11", "$current_red"),
          # (overlay_set_val, "$g_presentation_obj_12", "$current_green"),
          # (overlay_set_val, "$g_presentation_obj_13", "$current_blue"),
        # (end_try),
        (try_begin),
          (ge, "$cheat_mode", 1),
          (assign, reg11, "$current_red"),
          (assign, reg12, "$current_green"),
          (assign, reg13, "$current_blue"),
          (overlay_set_text, "$g_presentation_obj_8", "@{reg11}, {reg12}, {reg13}"),
        (end_try),
    ]),
]),

("work_progress", prsntf_read_only, 0, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (create_progress_overlay, reg1, 0, 30),
        (overlay_set_val, reg1, "$tutorial_num_total_dummies_destroyed"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 700),
        (overlay_set_position, reg1, pos1),
    ]),
]),
("take_cattle", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (party_get_slot, reg22, "$g_encountered_party", slot_center_player_cattle),
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        #mesh
        (create_mesh_overlay, reg0, "mesh_pic_farmstead"),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        
        (create_text_overlay, reg1, "@Head of cattle to take (max {reg22}):", tf_center_justify),
        
        (position_set_x, pos0, 250),
        (position_set_y, pos0, 600),
        (overlay_set_position, reg1, pos0),
        
        (assign, "$temp3", 0),
        (store_add, ":upper_bound", reg22, 1),
        (create_number_box_overlay, "$num_cattle_farm", 0, ":upper_bound"),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 550),
        (overlay_set_position, "$num_cattle_farm", pos1),
        (overlay_set_val, "$num_cattle_farm",0),
        (create_button_overlay, "$presentation_leave_button", "str_cancel", tf_center_justify),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 193),
        (overlay_set_position, "$presentation_leave_button", pos1),
        (create_button_overlay, "$presentation_commit_button", "str_continue", tf_center_justify),
        (position_set_x, pos1, 250),
        (position_set_y, pos1, 232),
        (overlay_set_position, "$presentation_commit_button", pos1),
    ]),
    (ti_on_presentation_run, [
        (try_begin),
          (this_or_next|key_clicked, key_escape),
          (key_clicked, key_pad_start),
          (presentation_set_duration, 0),
        (try_end),
    ]),
    
    (ti_on_presentation_event_state_change, [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$num_cattle_farm"),
          (assign, "$temp3", ":value"),
        (else_try),
          (eq, ":object", "$presentation_commit_button"),
          (try_begin),
            (gt, "$temp3", 0),
            (party_get_slot,":p_cat", "$g_encountered_party", slot_center_player_cattle),
            (val_sub, ":p_cat", "$temp3"),
            (party_set_slot, "$g_encountered_party", slot_center_player_cattle, ":p_cat"),
            (call_script, "script_create_cattle_herd", "$g_encountered_party", "$temp3"),
          (try_end),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":object", "$presentation_leave_button"),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),

("name_dog",0, 0,[
    (ti_on_presentation_load,
      [
        (set_fixed_point_multiplier, 1000),
        
        # BOARD
        (create_mesh_overlay, reg1, "mesh_message_window"),	#ca 660 wide so
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 330),
        (position_set_y, pos1, 250),
        (overlay_set_position, reg1, pos1),
        
        (create_simple_text_box_overlay, "$g_presentation_obj_name_kingdom_1"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_1", pos1),
        
        (str_store_troop_name, s7, "trp_dog"),
        (overlay_set_text, "$g_presentation_obj_name_kingdom_1", s7),
        (overlay_set_color, "$g_presentation_obj_name_kingdom_1", 0xFFFFFF),
        
        (create_game_button_overlay, "$g_presentation_obj_name_kingdom_2", "str_continue", tf_center_justify),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_name_kingdom_2", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_name_kingdom_1"),
          (str_store_string, s7, s0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_name_kingdom_2"),
          (troop_set_name, "trp_dog", s7),
          (presentation_set_duration, 0),
        (try_end),
    ]),
]),
# ("vc_conversation",0, 0,[		#This is a presentation which works like a conversation but with cropped conversation window
# (ti_on_presentation_load,
# [
# (set_fixed_point_multiplier, 1000),
# (presentation_set_duration, 999999),

# #CAM
# (call_script, "script_save_cam_first_person_mode"),
# (mission_cam_set_mode, 1, 0, 0),
# (set_camera_in_first_person, 0),

# # BOARD
# (create_mesh_overlay, reg1, "mesh_conversation_window_cropped"),
# (position_set_x, pos1, 0),
# (position_set_y, pos1, 0),
# (overlay_set_position, reg1, pos1),

# # BUTTONS:
# (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
# (str_clear, ":menu_slot"),
# (end_try),
# (str_store_string, slot_quest_menu_1, "@Heel!"),
# (str_store_string, slot_quest_menu_2, "@Go!"),
# (str_store_string, slot_quest_menu_3, "@Stay!"),
# (str_store_string, slot_quest_menu_town_visit, "@I'm gonne call you ..."),
# (str_store_string, slot_quest_menu_5, "@Drop it!"),

# (assign, ":button_y_position", 230),
# (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
# (neg|str_is_empty, ":menu_slot"),
# (create_image_button_overlay, reg1, "mesh_dlg_button", "mesh_dlg_button_down"),
# (position_set_x, pos1, 20),
# (position_set_y, pos1, ":button_y_position"),
# (overlay_set_position, reg1, pos1),
# (quest_set_slot, "qst_vc_menu", ":menu_slot", reg1),
# (str_store_string_reg, s1,":menu_slot"),
# (create_text_overlay, reg1, s1),
# (position_set_x, pos1, 500),
# (overlay_set_position, reg1, pos1),
# (val_sub, ":button_y_position", 38),
# (end_try),
# ]),

# (ti_on_presentation_event_state_change,
# [
# (store_trigger_param_1, ":object"),
# (try_begin),
# (presentation_set_duration, 0),
# (mission_enable_talk),
# (end_try),

# (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
# (quest_slot_eq, "qst_vc_menu", ":menu_slot", ":object"),
# (try_begin),
# (eq, ":menu_slot", slot_quest_menu_1),
# (assign, "$dog_order", 1),
# (else_try),
# (eq, ":menu_slot", slot_quest_menu_2),
# (assign, "$dog_order", 0),
# (else_try),
# (eq, ":menu_slot", slot_quest_menu_3),
# (assign, "$dog_order", -1),
# (try_end),
# (try_end),
# ]),
# ]),
("party_slot_check",0, 0,[
    (ti_on_presentation_load,
      [
        (set_fixed_point_multiplier, 1000),
        
        # BOARD
        (create_mesh_overlay, reg1, "mesh_message_window"),	#ca 660 wide so
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 700),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 330),
        (position_set_y, pos1, 300),
        (overlay_set_position, reg1, pos1),
        
        (str_store_party_name, s1, "$temp1"),
        (create_text_overlay, reg1, s1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_position, reg1, pos1),
        
        (create_number_box_overlay, "$g_presentation_obj_1", slot_party_type, slot_party_messenger_time),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        (create_text_overlay, "$g_presentation_obj_2", "@{!}Slot"),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_3", "str_continue", tf_center_justify),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_3", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_4", "@{!}track", tf_center_justify),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_4", pos1),
        
        (create_number_box_overlay, "$g_presentation_obj_5", 0, 99999),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 600),
        (overlay_set_position, "$g_presentation_obj_5", pos1),
        (overlay_set_val, "$g_presentation_obj_5", "$temp1"),
        
        (create_game_button_overlay, "$g_presentation_obj_6", "@{!}change party", tf_center_justify),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 600),
        (overlay_set_position, "$g_presentation_obj_6", pos1),
        
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (party_get_slot, reg1, "$temp1", ":value"),
          (overlay_set_text, "$g_presentation_obj_2", "@{reg1}"),
          (assign, "$temp2", reg1),
        (else_try),
          (eq, ":object", "$g_presentation_obj_3"),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_4"),
          (set_camera_follow_party, "$temp2"),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_5"),
          (assign, "$alpha_animal", ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_6"),
          (assign, "$temp1", "$alpha_animal"),
          (set_camera_follow_party, "$temp1"),
          (start_presentation, "prsnt_party_slot_check"),
        (try_end),
    ]),
]),

("ingame_operation",0, 0,[
    (ti_on_presentation_load,
      [
        (set_fixed_point_multiplier, 1000),
        (assign, reg1, 1),
        (assign, reg2, 0),
        (assign, reg3, 0),
        (assign, reg4, 0),
        
        # BOARD
        (create_mesh_overlay, reg1, "mesh_message_window"),	#ca 660 wide so
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 330),
        (position_set_y, pos1, 250),
        (overlay_set_position, reg1, pos1),
        
        (create_number_box_overlay, "$g_presentation_obj_1", call_script, face_keys_set_morph_key),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        (create_number_box_overlay, "$g_presentation_obj_2", 0, 99999),
        (position_set_x, pos1, 450),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        
        (create_number_box_overlay, "$g_presentation_obj_3", 0, 99999),
        (position_set_x, pos1, 500),
        (overlay_set_position, "$g_presentation_obj_3", pos1),
        
        (create_number_box_overlay, "$g_presentation_obj_4", 0, 99999),
        (position_set_x, pos1, 550),
        (overlay_set_position, "$g_presentation_obj_4", pos1),
        
        
        (create_game_button_overlay, "$g_presentation_obj_8", "str_continue", tf_center_justify),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_8", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_9", "@{!}run", tf_center_justify),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_9", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (assign, reg11, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_2"),
          (assign, reg12, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_3"),
          (assign, reg13, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_4"),
          (assign, reg14, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_8"),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_9"),
          (presentation_set_duration, 0),
          (call_script, reg11, reg12, reg13, reg14),
        (try_end),
    ]),
]),

("visit_scene",0, 0,[
    (ti_on_presentation_load,
      [
        (set_fixed_point_multiplier, 1000),
        (assign, reg11, 1),
        
        # BOARD
        (create_mesh_overlay, reg1, "mesh_message_window"),	#ca 660 wide so
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 500),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 330),
        (position_set_y, pos1, 250),
        (overlay_set_position, reg1, pos1),
        
        (create_number_box_overlay, "$g_presentation_obj_1", "scn_random_scene", "scn_mp_addon_maps_end"),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 400),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_8", "str_back", tf_center_justify),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_8", pos1),
        
        (create_game_button_overlay, "$g_presentation_obj_9", "@{!}Go to Scene", tf_center_justify),
        (position_set_x, pos1, 600),
        (position_set_y, pos1, 300),
        (overlay_set_position, "$g_presentation_obj_9", pos1),
        (presentation_set_duration, 999999),
    ]),
    (ti_on_presentation_event_state_change,
      [(store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (assign, reg11, ":value"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_8"),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_9"),
          #(presentation_set_duration, 0),
          (set_jump_mission, "mt_ai_training"),
          (jump_to_scene, reg11),
          (change_screen_mission),
        (try_end),
    ]),
]),

#add-ons questline presentation final
("addon_final_text", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        (play_track, "track_morrigan_song", 1),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro11"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (call_script, "script_texto_add_final1"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 800),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),
        
    ]),
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (call_script, "script_succeed_quest", "qst_blank_quest_26"),
          (set_show_messages, 0),
          (call_script, "script_end_quest", "qst_blank_quest_26"),
          (set_show_messages, 1),
          (quest_set_slot,"qst_blank_quest_26",slot_quest_current_state, 12), #
          (add_xp_as_reward, 3000),
          # (add_xp_to_troop,2000,"trp_player"),
          (presentation_set_duration, 0),
          #          (change_screen_return),
          (leave_encounter),
          (jump_to_menu, "mnu_auto_return_to_map"),
        (try_end),
    ]),
]),

#########
# "prsnt_set_goal"
# Description: sets the metrics for SET GOAL
("set_goal", 0, mesh_load_window, [
    (load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro1b"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        # Done button
        (create_game_button_overlay, "$g_presentation_leave_button", "str_done"),
        (position_set_x, pos1, 350),
        (position_set_y, pos1, 85),
        (overlay_set_position, "$g_presentation_leave_button", pos1),
        
        # Cancel button
        (create_game_button_overlay, "$g_presentation_cancel_button", "str_cancel"),
        (position_set_x, pos1, 180),
        (position_set_y, pos1, 85),
        (overlay_set_position, "$g_presentation_cancel_button", pos1),
        
        # title
        (try_begin),
          (str_store_string, s1, "@Create a new goal:"),
          
          (create_text_overlay, reg1,
            "@(You can select a custom goal or one of^the templates below for a reward!)",
          tf_center_justify),
          (position_set_x, pos1, 250),(position_set_y, pos1, 515),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_small),(position_set_y, pos1, font_small),
          (overlay_set_size, reg1, pos1),
        (try_end),
        
        (create_text_overlay, reg1, s1, tf_center_justify),
        (position_set_x, pos1, 250),(position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, font_normal + 200),(position_set_y, pos1, font_normal + 200),
        (overlay_set_size, reg1, pos1),
        
        # feedback message
        (create_text_overlay, "$g_presentation_obj_7", "str_empty_string", tf_center_justify),
        (position_set_x, pos1, 250),(position_set_y, pos1, 450),
        (overlay_set_position, "$g_presentation_obj_7", pos1),
        (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
        (overlay_set_size, "$g_presentation_obj_7", pos1),
        (overlay_set_color, "$g_presentation_obj_7", 0xFF0000),
        
        # ---------------------------------------------------------------------------
        # Container 1: selection
        (try_begin),
          
          (create_game_button_overlay, "$g_presentation_obj_1", "@Let me choose!"),
          (position_set_x, pos1, 250),(position_set_y, pos1, 380),
          (overlay_set_position, "$g_presentation_obj_1", pos1),
          
          (create_game_button_overlay, "$g_presentation_obj_2", "str_set_goal_raider"),
          (position_set_x, pos1, 160),(position_set_y, pos1, 310),
          (overlay_set_position, "$g_presentation_obj_2", pos1),
          
          (create_game_button_overlay, "$g_presentation_obj_3", "str_set_goal_warrior"),
          (position_set_x, pos1, 350),(position_set_y, pos1, 310),
          (overlay_set_position, "$g_presentation_obj_3", pos1),
          
          (create_game_button_overlay, "$g_presentation_obj_4", "str_set_goal_lord"),
          (position_set_x, pos1, 160),(position_set_y, pos1, 240),
          (overlay_set_position, "$g_presentation_obj_4", pos1),
          
          (create_game_button_overlay, "$g_presentation_obj_5", "str_set_goal_king"),
          (position_set_x, pos1, 350),(position_set_y, pos1, 240),
          (overlay_set_position, "$g_presentation_obj_5", pos1),
          
          (create_game_button_overlay, "$g_presentation_obj_6", "str_set_goal_expand"),
          (position_set_x, pos1, 220),(position_set_y, pos1, 170),
          (overlay_set_position, "$g_presentation_obj_6", pos1),
          (position_set_x, pos1, 200),(position_set_y, pos1, 40),
          (overlay_set_size, "$g_presentation_obj_6", pos1),
          
        (try_end),
        
        # ----------------------------------------------------------------------------
        # ----- Container 2: metrics -------------------------------------------------
        (try_begin),
          (ge, "$goal_type", goal_custom),
          
          (create_text_overlay, ":metrics_area", "str_empty_string", tf_scrollable),
          (position_set_x, pos1, 530),(position_set_y, pos1, 70),
          (overlay_set_position, ":metrics_area", pos1),
          (position_set_x, pos1, 520),(position_set_y, pos1, 500),
          (overlay_set_area_size, ":metrics_area", pos1),
          (set_container_overlay, ":metrics_area"),
          
          (create_text_overlay, reg1, "@{s0}:", tf_left_align),
          (position_set_x, pos1, 50),(position_set_y, pos1, 425),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, reg1, pos1),
          
          (assign, ":x_slider", 400),
          # ----- Renown slider -----------------------------------------------
          (create_text_overlay, reg1, "@Renown:", tf_left_align),
          (position_set_x, pos1, 50),(position_set_y, pos1, 340-58*0),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, reg1, pos1),
          
          (assign, reg0, "$goal_renown_slider_val"),
          (create_text_overlay, "$goal_renown_slider_label", "str_reg0", tf_left_align),
          (position_set_x, pos1, 199),(position_set_y, pos1, 340-58*0),
          (overlay_set_position, "$goal_renown_slider_label", pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, "$goal_renown_slider_label", pos1),
          
          (call_script, "script_goal_slider_values", "$goal_renown_slider_val", 2000),
          (create_slider_overlay, "$goal_renown_slider", "$goal_renown_slider_val", reg5),
          (position_set_x, pos1, ":x_slider"),(position_set_y, pos1, 340-58*0),
          (overlay_set_position, "$goal_renown_slider", pos1),
          (overlay_set_val, "$goal_renown_slider", "$goal_renown_slider_val"),
          (position_set_x, pos1, 450),(position_set_y, pos1, 800),
          (overlay_set_size, "$goal_renown_slider", pos1),
          
          # ----- Reputation --------------------------------------------------
          (create_text_overlay, reg1, "@Reputation:", tf_left_align),
          (position_set_x, pos1, 50),(position_set_y, pos1, 340-58*1),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, reg1, pos1),
          
          (assign, reg0, "$goal_reputation_slider_val"),
          (create_text_overlay, "$goal_reputation_slider_label", "str_reg0", tf_left_align),
          (position_set_x, pos1, 199),(position_set_y, pos1, 340-58*1),
          (overlay_set_position, "$goal_reputation_slider_label", pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, "$goal_reputation_slider_label", pos1),
          
          (create_slider_overlay, "$goal_reputation_slider", -100, 100),
          (position_set_x, pos1, ":x_slider"),(position_set_y, pos1, 340-58*1),
          (overlay_set_position, "$goal_reputation_slider", pos1),
          (overlay_set_val, "$goal_reputation_slider", "$goal_reputation_slider_val"),
          (position_set_x, pos1, 450),(position_set_y, pos1, 800),
          (overlay_set_size, "$goal_reputation_slider", pos1),
          
          # ----- Army ------------------------------------------------------------
          (create_text_overlay, reg1, "@Army size:", tf_left_align),
          (position_set_x, pos1, 50),(position_set_y, pos1, 340-58*2),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, reg1, pos1),
          
          (assign, reg0, "$goal_army_size_slider_val"),
          (create_text_overlay, "$goal_army_size_slider_label", "str_reg0", tf_left_align),
          (position_set_x, pos1, 199),(position_set_y, pos1, 340-58*2),
          (overlay_set_position, "$goal_army_size_slider_label", pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, "$goal_army_size_slider_label", pos1),
          
          (call_script, "script_goal_slider_values", "$goal_army_size_slider_val", 500),
          (create_slider_overlay, "$goal_army_size_slider", "$goal_army_size_slider_val", reg5),
          (position_set_x, pos1, ":x_slider"),(position_set_y, pos1, 340-58*2),
          (overlay_set_position, "$goal_army_size_slider", pos1),
          (overlay_set_val, "$goal_army_size_slider", "$goal_army_size_slider_val"),
          (position_set_x, pos1, 450),(position_set_y, pos1, 800),
          (overlay_set_size, "$goal_army_size_slider", pos1),
          
          # ----- Marriage------------------------------------------------------------
          (create_text_overlay, reg1, "@Marry a {reg59?lord:lady}:", tf_left_align),
          (position_set_x, pos1, 50),(position_set_y, pos1, 340-58*3),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, reg1, pos1),
          
          (try_begin),
            (eq, "$goal_marry_checkbox_val", 1),
            (str_store_string, s1, "str_yes"),
          (else_try),
            (str_store_string, s1, "str_no"),
          (try_end),
          
          (create_text_overlay, "$goal_marry_checkbox_label", s1, tf_left_align),
          (position_set_x, pos1, 199),(position_set_y, pos1, 340-58*3),
          (overlay_set_position, "$goal_marry_checkbox_label", pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, "$goal_marry_checkbox_label", pos1),
          
          (try_begin),
            (neq, "$goal_type", goal_raider),
            (neq, "$goal_type", goal_warrior),
            (neq, "$goal_type", goal_lord),
            (troop_get_slot, reg2, "trp_player", slot_troop_spouse),
            (eq, reg2, -1),
            
            (create_check_box_overlay, "$goal_marry_checkbox", "mesh_checkbox_off", "mesh_checkbox_on"),
            (position_set_x, pos1, 320),(position_set_y, pos1, 340-58*3),
            (overlay_set_position, "$goal_marry_checkbox", pos1),
            (overlay_set_val, "$goal_marry_checkbox", "$goal_marry_checkbox_val"),
            (position_set_x, pos1, 1200),(position_set_y, pos1, 1200),
            (overlay_set_size, "$goal_marry_checkbox", pos1),
          (try_end),
          
          # ----- Right to rule --------------------------------------------------
          (create_text_overlay, reg1, "@Right to rule:", tf_left_align),
          (position_set_x, pos1, 50),(position_set_y, pos1, 340-58*4),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, reg1, pos1),
          
          (assign, reg0, "$goal_right_to_rule_slider_val"),
          (create_text_overlay, "$goal_right_to_rule_slider_label", "str_reg0", tf_left_align),
          (position_set_x, pos1, 199),(position_set_y, pos1, 340-58*4),
          (overlay_set_position, "$goal_right_to_rule_slider_label", pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, "$goal_right_to_rule_slider_label", pos1),
          
          (create_slider_overlay, "$goal_right_to_rule_slider", "$goal_right_to_rule_slider_val", 100),
          (position_set_x, pos1, ":x_slider"),(position_set_y, pos1, 340-58*4),
          (overlay_set_position, "$goal_right_to_rule_slider", pos1),
          (overlay_set_val, "$goal_right_to_rule_slider", "$goal_right_to_rule_slider_val"),
          (position_set_x, pos1, 450),(position_set_y, pos1, 800),
          (overlay_set_size, "$goal_right_to_rule_slider", pos1),
          
          # ----- Wealth ------------------------------------------------------------
          (create_text_overlay, reg1, "@Wealth:", tf_left_align),
          (position_set_x, pos1, 50),(position_set_y, pos1, 340-58*5),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, reg1, pos1),
          
          (assign, reg0, "$goal_wealth_slider_val"),
          (create_text_overlay, "$goal_wealth_slider_label", "str_reg0", tf_left_align),
          (position_set_x, pos1, 199),(position_set_y, pos1, 340-58*5),
          (overlay_set_position, "$goal_wealth_slider_label", pos1),
          (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
          (overlay_set_size, "$goal_wealth_slider_label", pos1),
          
          (call_script, "script_goal_slider_values", "$goal_wealth_slider_val", 100000),
          (create_slider_overlay, "$goal_wealth_slider", "$goal_wealth_slider_val", reg5),
          (position_set_x, pos1, ":x_slider"),(position_set_y, pos1, 340-58*5),
          (overlay_set_position, "$goal_wealth_slider", pos1),
          (overlay_set_val, "$goal_wealth_slider", "$goal_wealth_slider_val"),
          (position_set_x, pos1, 450),(position_set_y, pos1, 800),
          (overlay_set_size, "$goal_wealth_slider", pos1),
          
          (try_begin),
            (eq, "$goal_can_change_sliders", 0),
            (overlay_set_display, "$goal_renown_slider", 0),
            (overlay_set_display, "$goal_reputation_slider", 0),
            (overlay_set_display, "$goal_army_size_slider", 0),
            (overlay_set_display, "$goal_right_to_rule_slider", 0),
            (overlay_set_display, "$goal_wealth_slider", 0),
          (try_end),
          
          (set_container_overlay, -1),
        (try_end),
        
    ]),
    
    (event,[
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_leave_button"),
          
          (try_begin),
            (ge, "$goal_type", goal_custom),
            
            # save data
            (quest_set_slot, "qst_vc_menu", slot_set_goal_type, "$goal_type"),
            (quest_set_slot, "qst_vc_menu", slot_set_goal_wealth, "$goal_wealth_slider_val"),
            (quest_set_slot, "qst_vc_menu", slot_set_goal_rtr, "$goal_right_to_rule_slider_val"),
            (quest_set_slot, "qst_vc_menu", slot_set_goal_marry, "$goal_marry_checkbox_val"),
            (quest_set_slot, "qst_vc_menu", slot_set_goal_army, "$goal_army_size_slider_val"),
            (quest_set_slot, "qst_vc_menu", slot_set_goal_reputation, "$goal_reputation_slider_val"),
            (quest_set_slot, "qst_vc_menu", slot_set_goal_renown, "$goal_renown_slider_val"),
            
            (presentation_set_duration, 0),
            (start_presentation, "prsnt_view_current_goal"),
            
          (else_try),
            (overlay_set_text, "$g_presentation_obj_7", "@(You need to choose^a goal first!)"),
            
          (try_end),
          
        (else_try),
          (eq, ":object", "$g_presentation_cancel_button"),
          (presentation_set_duration, 0),
          (assign, "$goal_type", goal_canceled),
          
        (else_try),
          (eq, ":object", "$goal_renown_slider"),
          (assign, "$goal_renown_slider_val", ":value"),
          (assign, reg0, ":value"),
          (overlay_set_text, "$goal_renown_slider_label", "str_reg0"),
          
        (else_try),
          (eq, ":object", "$goal_reputation_slider"),
          (assign, "$goal_reputation_slider_val", ":value"),
          (assign, reg0, ":value"),
          (overlay_set_text, "$goal_reputation_slider_label", "str_reg0"),
          
        (else_try),
          (eq, ":object", "$goal_army_size_slider"),
          (assign, "$goal_army_size_slider_val", ":value"),
          (assign, reg0, ":value"),
          (overlay_set_text, "$goal_army_size_slider_label", "str_reg0"),
          
        (else_try),
          (eq, ":object", "$goal_right_to_rule_slider"),
          (assign, "$goal_right_to_rule_slider_val", ":value"),
          (assign, reg0, ":value"),
          (overlay_set_text, "$goal_right_to_rule_slider_label", "str_reg0"),
          
        (else_try),
          (eq, ":object", "$goal_wealth_slider"),
          (assign, "$goal_wealth_slider_val", ":value"),
          (assign, reg0, ":value"),
          (overlay_set_text, "$goal_wealth_slider_label", "str_reg0"),
          
        (else_try),
          (eq, ":object", "$goal_marry_checkbox"),
          
          (try_begin),
            (eq, ":value", 1),
            (str_store_string, s1, "@Yes"),
          (else_try),
            (str_store_string, s1, "@No"),
          (try_end),
          
          (assign, "$goal_marry_checkbox_val", ":value"),
          (overlay_set_text, "$goal_marry_checkbox_label", s1),
          
        (else_try),#custom
          (eq, ":object", "$g_presentation_obj_1"),
          (troop_get_slot, ":current_renown", "trp_player", slot_troop_renown),
          (assign, "$goal_renown_slider_val", ":current_renown"),
          (assign, "$goal_reputation_slider_val", "$player_honor"),
          (store_party_size_wo_prisoners, ":current_army"),
          (assign, "$goal_army_size_slider_val", ":current_army"),
          (troop_get_slot, reg2, "trp_player", slot_troop_spouse),
          (try_begin),
            (eq, reg2, -1),
            (assign, reg2, 0),
          (else_try),
            (assign, reg2, 1),
          (try_end),
          (assign, "$goal_marry_checkbox_val", reg2),
          (assign, "$goal_right_to_rule_slider_val", "$player_right_to_rule"),
          (store_troop_gold, ":current_wealth", "trp_player"),
          (val_add, ":current_wealth", 1000),
          (assign, "$goal_wealth_slider_val", ":current_wealth"),
          (assign, "$goal_type", goal_custom),
          
          (assign, "$goal_can_change_sliders", 1),
          (str_store_string, s0, "@Custom Goal (no reward)"),
          
          (start_presentation, "prsnt_set_goal"),
          
        (else_try),#raider
          (eq, ":object", "$g_presentation_obj_2"),
          
          (try_begin),
            (quest_slot_eq, "qst_vc_menu", slot_set_goal_completed_raider, goal_complete),
            (overlay_set_text, "$g_presentation_obj_7", "str_set_goal_already_completed"),
          (else_try),
            (neq, "$players_kingdom", 0),
            (overlay_set_text, "$g_presentation_obj_7", "str_set_goal_you_are_a_noble"),
          (else_try),
            (eq, "$players_kingdom", 0),
            (assign, "$goal_renown_slider_val", 250),
            (assign, "$goal_reputation_slider_val", -60),
            (assign, "$goal_army_size_slider_val", 60),
            (assign, "$goal_marry_checkbox_val", 0),
            (assign, "$goal_right_to_rule_slider_val", 0),
            (assign, "$goal_wealth_slider_val", 15000),
            (assign, "$goal_type", goal_raider),
            
            (assign, "$goal_can_change_sliders", 0),
            (str_store_string, s0, "str_set_goal_raider"),
            
            (start_presentation, "prsnt_set_goal"),
          (try_end),
          
        (else_try),#warrior
          (eq, ":object", "$g_presentation_obj_3"),
          
          (try_begin),
            (quest_slot_eq, "qst_vc_menu", slot_set_goal_completed_warrior, goal_complete),
            (overlay_set_text, "$g_presentation_obj_7", "str_set_goal_already_completed"),
          (else_try),
            (neq, "$players_kingdom", 0),
            (overlay_set_text, "$g_presentation_obj_7", "str_set_goal_you_are_a_noble"),
          (else_try),
            (eq, "$players_kingdom", 0),
            (assign, "$goal_renown_slider_val", 250),
            (assign, "$goal_reputation_slider_val", 25),
            (assign, "$goal_army_size_slider_val", 100),
            (assign, "$goal_marry_checkbox_val", 0),
            (assign, "$goal_right_to_rule_slider_val", 0),
            (assign, "$goal_wealth_slider_val", 10000),
            (assign, "$goal_type", goal_warrior),
            
            (assign, "$goal_can_change_sliders", 0),
            (str_store_string, s0, "str_set_goal_warrior"),
            
            (start_presentation, "prsnt_set_goal"),
            
          (try_end),
          
        (else_try),#lord
          (eq, ":object", "$g_presentation_obj_4"),
          
          (try_begin),
            (quest_slot_eq, "qst_vc_menu", slot_set_goal_completed_lord, goal_complete),
            (overlay_set_text, "$g_presentation_obj_7", "str_set_goal_already_completed"),
          (else_try),
            (eq, "$players_kingdom", "fac_player_supporters_faction"),
            (overlay_set_text, "$g_presentation_obj_7", "@(You are a king already!)"),
          (else_try),
            (assign, "$goal_renown_slider_val", 500),
            (assign, "$goal_reputation_slider_val", 20),
            (assign, "$goal_army_size_slider_val", 150),
            (assign, "$goal_marry_checkbox_val", 0),
            (assign, "$goal_right_to_rule_slider_val", 0),
            (assign, "$goal_wealth_slider_val", 25000),
            (assign, "$goal_type", goal_lord),
            
            (assign, "$goal_can_change_sliders", 1),
            (str_store_string, s0, "str_set_goal_lord"),
            
            (start_presentation, "prsnt_set_goal"),
            
          (try_end),
          
        (else_try),#king
          (eq, ":object", "$g_presentation_obj_5"),
          
          (try_begin),
            (quest_slot_eq, "qst_vc_menu", slot_set_goal_completed_king, goal_complete),
            (overlay_set_text, "$g_presentation_obj_7", "str_set_goal_already_completed"),
          (else_try),
            (assign, "$goal_renown_slider_val", 900),
            (assign, "$goal_reputation_slider_val", 50),
            (assign, "$goal_army_size_slider_val", 250),
            (assign, "$goal_marry_checkbox_val", 1),
            (assign, "$goal_right_to_rule_slider_val", 50),
            (assign, "$goal_wealth_slider_val", 50000),
            (assign, "$goal_type", goal_king),
            
            (assign, "$goal_can_change_sliders", 1),
            (str_store_string, s0, "str_set_goal_king"),
            (start_presentation, "prsnt_set_goal"),
            
          (try_end),
          
        (else_try),#expand territory
          (eq, ":object", "$g_presentation_obj_6"),
          
          (try_begin),
            (quest_slot_eq, "qst_vc_menu", slot_set_goal_completed_expand, goal_complete),
            (overlay_set_text, "$g_presentation_obj_7", "str_set_goal_already_completed"),
          (else_try),
            (neq, "$players_kingdom", "fac_player_supporters_faction"),
            (overlay_set_text, "$g_presentation_obj_7", "@(You need to be the ruler^of your faction first!)"),
          (else_try),
            (assign, "$goal_renown_slider_val", 1250),
            (assign, "$goal_reputation_slider_val", 75),
            (assign, "$goal_army_size_slider_val", 400),
            (assign, "$goal_marry_checkbox_val", 1),
            (assign, "$goal_right_to_rule_slider_val", 80),
            (assign, "$goal_wealth_slider_val", 65000),
            (assign, "$goal_type", goal_expand),
            
            (assign, "$goal_can_change_sliders", 1),
            (str_store_string, s0, "str_set_goal_expand"),
            
            (start_presentation, "prsnt_set_goal"),
            
          (try_end),
        (try_end),
    ]),
    
  ] + coord_helper + prsnt_escape_close
),

# "prsnt_view_current_goal"
# Description: shows metrics for the current goal choosen by the player
#              feature meant to help new players understand the base game
("view_current_goal", 0, mesh_load_window, [
    (load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro1b"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        # New button
        (create_game_button_overlay, "$g_presentation_new_button", "@New Goal"),
        (position_set_x, pos1, 640),
        (position_set_y, pos1, 85),
        (overlay_set_position, "$g_presentation_new_button", pos1),
        
        # Done
        (create_game_button_overlay, "$g_presentation_leave_button", "str_done"),
        (position_set_x, pos1, 840),
        (position_set_y, pos1, 85),
        (overlay_set_position, "$g_presentation_leave_button", pos1),
        
        # title
        (quest_get_slot, reg0, "qst_vc_menu", slot_set_goal_type),
        (val_add, reg0, "str_set_goal_start"),
        (str_store_string, s1, reg0),
        (str_store_string, s0, "@Current Goal: {s1}"),
        
        (create_text_overlay, reg1, "str_s0", tf_center_justify),
        (position_set_x, pos1, 735),(position_set_y, pos1, 550),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, font_normal+200),(position_set_y, pos1, font_normal+200),
        (overlay_set_size, reg1, pos1),
        
        # --------------------------------------------------------------------
        # Container 1: metrics
        (create_text_overlay, ":metrics_area", "str_empty_string", tf_scrollable_style_2),
        (position_set_x, pos1, 75),(position_set_y, pos1, 80),
        (overlay_set_position, ":metrics_area", pos1),
        (position_set_x, pos1, 400),(position_set_y, pos1, 500),
        (overlay_set_area_size, ":metrics_area", pos1),
        (set_container_overlay, ":metrics_area"),
        
        (assign, ":y", 630),
        (assign, ":y_dec", 110),
        
        # --------- Renown -------------------------------------------------------
        (troop_get_slot, reg2, "trp_player", slot_troop_renown),
        
        (str_store_string, s1, "@Renown:"),
        (call_script, "script_view_goal_metric", reg2, ":y", 0, ":y_dec", slot_set_goal_renown),
        
        # --------- Reputation ---------------------------------------------------
        (assign, reg2, "$player_honor"),
        
        (str_store_string, s1, "@Reputation:"),
        (call_script, "script_view_goal_metric", reg2, ":y", 1, ":y_dec", slot_set_goal_reputation),
        
        # --------- Troops -------------------------------------------------------
        (quest_get_slot, reg0, "qst_vc_menu", slot_set_goal_army),
        (store_party_size_wo_prisoners, reg2),
        
        (str_store_string, s1, "@Troops:"),
        (call_script, "script_view_goal_metric", reg2, ":y", 2, ":y_dec", slot_set_goal_army),
        
        # --------- Married ------------------------------------------------------
        (troop_get_slot, reg2, "trp_player", slot_troop_spouse),
        (try_begin),
          (ge, reg2, 1),
          (assign, reg2, 1),
        (else_try),
          (assign, reg2, 0),
        (try_end),
        
        (str_store_string, s1, "@Marry:"),
        (call_script, "script_view_goal_metric", reg2, ":y", 3, ":y_dec", slot_set_goal_marry),
        
        # --------- Right to rule ------------------------------------------------
        (assign, reg2, "$player_right_to_rule"),
        
        (str_store_string, s1, "@Right to rule:"),
        (call_script, "script_view_goal_metric", reg2, ":y", 4, ":y_dec", slot_set_goal_rtr),
        
        # --------- Wealth -------------------------------------------------------
        (store_troop_gold, reg2, "trp_player"),
        
        (str_store_string, s1, "@Wealth:"),
        (call_script, "script_view_goal_metric", reg2, ":y", 5, ":y_dec", slot_set_goal_wealth),
        
        (set_container_overlay, -1),
        # ------------------------------------------------------------------------
        # Container 2: hints
        (create_text_overlay, ":hints_area", "str_empty_string", tf_scrollable|tf_center_justify|tf_double_space), #VC-3837 edited
        (position_set_x, pos1, 535),(position_set_y, pos1, 150),
        (overlay_set_position, ":hints_area", pos1),
        (position_set_x, pos1, 380),(position_set_y, pos1, 340),
        (overlay_set_area_size, ":hints_area", pos1),
        #(set_container_overlay, ":hints_area"),
        
        (str_clear, s1),(str_clear, s2),(str_clear, s3),
        (quest_get_slot, reg0, "qst_vc_menu", slot_set_goal_type),
        (val_add, reg0, "str_set_goal_start_hint"),
        (str_store_string, s3, reg0),
        
        (str_store_string, s1, "@{s3}^-------------------------------^"),# current goal text
        (str_store_string, s2, "str_view_goal_hint_renown"),
        (str_store_string, s1, "@{s1}^{s2}^"),
        (str_store_string, s2, "str_view_goal_hint_reputation"),
        (str_store_string, s1, "@{s1}^{s2}^"),
        (str_store_string, s2, "str_view_goal_hint_army"),
        (str_store_string, s1, "@{s1}^{s2}^"),
        (str_store_string, s2, "str_view_goal_hint_marry"),
        (str_store_string, s1, "@{s1}^{s2}^"),
        (str_store_string, s2, "str_view_goal_hint_right_to_rule"),
        (str_store_string, s1, "@{s1}^{s2}^"),
        (str_store_string, s2, "str_view_goal_hint_wealth"),
        (str_store_string, s1, "@{s1}^{s2}^"),
        
        (overlay_set_text, ":hints_area", "@^{s1}"), #added for VC-3837
        # (create_text_overlay,
          # reg1,
          # "@^{s1}",
        # tf_center_justify|tf_double_space),
        # (position_set_x, pos1, 380/2),(position_set_y, pos1, 0),
        # (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, font_normal-200),(position_set_y, pos1, font_normal-200),
        (overlay_set_size, ":hints_area", pos1), #VC-3837 edited
        
        # (set_container_overlay, -1),
    ]),
    
    (event,[
        (store_trigger_param_1, ":object"),
        #(store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_new_button"),
          (presentation_set_duration, 0),
          (assign, "$goal_type", goal_empty),
          (presentation_set_duration, 0),
          (start_presentation, "prsnt_set_goal"),
          
        (else_try),
          (eq, ":object", "$g_presentation_leave_button"),
          (presentation_set_duration, 0),
          (start_presentation, "prsnt_character_screen_main"),
          
        (else_try),# don't let player change progressbar values
          (try_for_range, ":i", 0, 6),
            (troop_get_slot, reg1, "trp_temp_array_a", ":i"),
            (eq, ":object", reg1),
            (troop_get_slot, reg1, "trp_temp_array_b", ":i"),
            (overlay_set_val, ":object", reg1),
          (try_end),
        (try_end),
    ]),
    
  ] + coord_helper + prsnt_escape_close
),

# Presentation prsnt_troop_detail
# Description: from the troop tree you can click on any troop
#              to see its details: stats, inventory, etc
("troop_detail", 0, 0, [
    (load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        (assign, ":draw_troop", "$temp_troop"),
        
        #pic
        (create_mesh_overlay, reg0, "mesh_pic_units_details"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (try_begin),
          (eq, debug_troop_detail, 1),
          (assign, reg0, ":draw_troop"),
          (assign, reg1, "$temp"),
          (str_store_troop_name, s1, ":draw_troop"),
          (display_message, "@{!}DEBUG: troop {reg0} {s1}, $temp={reg1}"),
        (try_end),
        
        (call_script, "script_troop_detail_layout"),
        (call_script, "script_troop_detail_draw_troop", ":draw_troop"),
        (call_script, "script_troop_detail_draw_weapons", ":draw_troop"),
        
        (try_begin),
          (eq, "$temp", 1),# ---- Stats ----
          (call_script, "script_troop_detail_stats", ":draw_troop"),
          
        (else_try),# ---- Inventory of troop ----
          (eq, "$temp", 2),
          (call_script, "script_troop_detail_inventory"),
        (try_end),
        
        (try_begin),#CHEAT
          (ge, "$cheat_mode", 1),
          #(lt, vc_version, 2020),# disabled for VC-3672
          (create_button_overlay, "$alpha_animal", "@{!}Take 10"),
        (try_end),
    ]),
    
    (event,
      [
        (store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":value"),
        
        (try_begin),# done button
          (eq, ":object", "$g_presentation_leave_button"),
          (start_presentation, "prsnt_troop_tree"),
        (else_try),
          (eq, ":object", "$g_presentation_obj_1"),
          (call_script, "script_troop_detail_change_screen", "$temp_troop"),
          
        (else_try),
          (eq, ":object", "$checkbox_show_item_details"),
          (assign, "$checkbox_show_item_details_val", ":value"),
        (try_end),
        
        (try_begin),#CHEAT
          #(lt, vc_version, 2020),# disabled for VC-3672
          (ge, "$cheat_mode", 1),
          (eq, ":object", "$alpha_animal"),
          (party_add_members, "p_main_party", "$temp_troop", 10),
        (try_end),
    ]),
    
    (hover,[
        (call_script, "script_troop_detail_inventory_tooltip"),
    ]),
    
    (click,
      [
        (eq, "$temp", 2),
        (store_trigger_param_1, ":object_id"),
        (call_script, "script_troop_detail_update_dummy", "$temp_troop", ":object_id"),
    ]),
  ] + coord_helper + prsnt_escape_close
),

# "prstn_show_companions"
# VC-2380 Companions Presentations: companions are displayed as
# cards on a deck, with a central portrait that shows extra info
# if you select (click) on one of them
# check module_constants for the configuration variables
("show_companions", 0, 0, [
    (load, [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        # global that controls center portrait
        (assign, "$current_selected", 0),
        
        # Done
        (create_game_button_overlay, "$g_presentation_leave_button", "str_done"),
        (position_set_x, pos1, 835),(position_set_y, pos1, 670),
        (overlay_set_position, "$g_presentation_leave_button", pos1),
        
        # title
        (create_text_overlay, reg1, "str_com_companions", tf_center_justify),
        (position_set_x, pos1, 510),(position_set_y, pos1, 650),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, font_title),(position_set_y, pos1, font_title),
        (overlay_set_size, reg1, pos1),
        #pic
        (create_mesh_overlay, reg0, "mesh_pic_vc_companions"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        # Local Variables
        (assign, ":x", 30),
        (assign, ":y", 0),
        (assign, ":counter", 0),
        (assign, ":slot_no", 0),
        
        # Grid with companions using gear without a horse
        (troop_set_slot, "trp_temp_array_c", 6, 295),
        (troop_set_slot, "trp_temp_array_c", 11, 296),
        (troop_set_slot, "trp_temp_array_c", 5, 297),
        (troop_set_slot, "trp_temp_array_c", 9, 298),
        (troop_set_slot, "trp_temp_array_c", 13, 299),
        (troop_set_slot, "trp_temp_array_c", 4, 300),
        (troop_set_slot, "trp_temp_array_c", 10, 301),
        (troop_set_slot, "trp_temp_array_c", 14, 302),
        (troop_set_slot, "trp_temp_array_c", 8, 303),
        (troop_set_slot, "trp_temp_array_c", 7, 304),
        (troop_set_slot, "trp_temp_array_c", 15, 305),
        (troop_set_slot, "trp_temp_array_c", 2, 306),
        (troop_set_slot, "trp_temp_array_c", 12, 307),
        (troop_set_slot, "trp_temp_array_c", 1, 308),
        (troop_set_slot, "trp_temp_array_c", 0, 309),
        (troop_set_slot, "trp_temp_array_c", 3, 310),
        
        (try_for_range, ":slot_no", 0, 16),
          (troop_get_slot, ":npc", "trp_temp_array_c", ":slot_no"),
          (troop_get_slot, ":companion_ocupation", ":npc", slot_troop_occupation),
          
          (assign, ":draw_this_companion", 1),
          (try_begin),
            (eq, companions_prsnt_show_members_not_in_party, 1),
            (assign, ":draw_this_companion", 1),
            
            (try_begin),
              (eq, companions_prsnt_show_lords, 0),
              (eq, ":companion_ocupation", slto_kingdom_hero), #is a lord
              (assign, ":draw_this_companion", 0),
            (try_end),
            
          (else_try),
            (neq, ":companion_ocupation", slto_player_companion),
            (assign, ":draw_this_companion", 0),
          (try_end),
          
          (try_begin),
            (eq, companions_prsnt_debug, 1),
            (assign, reg2, ":draw_this_companion"),
            (str_store_troop_name, s1, ":npc"),
            (display_log_message, "@{!}DEBUG: should draw companion {s1}: {reg2}"),
          (try_end),
          
          (store_mul, ":npc_with_gear", ":npc", 2), #with weapons
          
          # Creates character picture with name
          # 700 and 800 are the default for the tableau
          (create_image_button_overlay_with_tableau_material,
            reg0,
            -1,
            "tableau_troop_tree_pic_without_horse",
          ":npc_with_gear"),
          (position_set_x, pos1, ":x"),(position_set_y, pos1, ":y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 700/4),(position_set_y, pos1, 800/4),
          (overlay_set_size, reg0, pos1),
          
          (str_store_troop_name, s0, ":npc"),
          
          # Name on card
          (create_text_overlay, reg1, "str_com_s0", tf_center_justify),
          (store_add, reg2, ":x", 57),
          (position_set_x, pos1, reg2),(position_set_y, pos1, ":y"),
          (overlay_set_position, reg1, pos1),
          (position_set_x, pos1, font_small),(position_set_y, pos1, font_small),
          (overlay_set_size, reg1, pos1),
          
          (try_begin),
            # if not in party paints with grey
            (neq, ":companion_ocupation", slto_player_companion),
            (overlay_set_color, reg0, 0x999999),
          (try_end),
          
          (try_begin),
            (eq, ":draw_this_companion", 1),
          (else_try),
            (overlay_set_display, reg0, 1),
            (overlay_set_color, reg0, 0x55464646),
            (overlay_set_display, reg1, 0),
            (assign, reg0, -1),
          (try_end),
          
          # Data array
          (troop_set_slot, "trp_temp_array_a", ":slot_no", reg0), # overlay id
          (troop_set_slot, "trp_temp_array_b", ":slot_no", ":npc"), # troop
          (val_add, ":slot_no", 1),
          
          (val_add, ":counter", 1),
          (val_add, ":x", 150),
          
          # jump to next row after 2 companions and right side after 8
          (try_begin),
            (eq, ":counter", 2),
            (gt, ":y", 450),
            (assign, ":x", 700),
            (assign, ":y", 0),
            (assign, ":counter", 0),
          (else_try),
            (eq, ":counter", 2),
            (val_add, ":y", 157),
            (val_sub, ":x", 150*2),
            (assign, ":counter", 0),
          (try_end),
        (try_end),
        
        # Saves number of companions
        (assign, "$temp", ":slot_no"),
    ]),
    (run, []),
    (click, [
        (store_trigger_param_1, ":object_id"),
        (try_begin),
          
          (assign, ":end_loop", "$temp"),
          
          # Checks if object clicked is a companion
          (try_for_range, ":slot_no", 0, ":end_loop"),
            (troop_slot_eq, "trp_temp_array_a", ":slot_no", ":object_id"),
            (troop_get_slot, ":troop_id", "trp_temp_array_b", ":slot_no"),
            (is_between, ":troop_id", companions_begin, companions_end),
            (str_store_troop_name, s1, ":troop_id"),
            (assign, ":end_loop", 0),
            
            (try_begin),
              (eq, companions_prsnt_debug, 1),
              (str_store_troop_name, s1, ":troop_id"),
              (display_log_message, "@{!}DEBUG: drawing portrait of companion {s1}"),
            (try_end),
            
            # clears old portrait after first click
            (try_begin),
              (ge, "$current_selected", 1),
              (overlay_set_display, reg11, 0),
              (overlay_set_display, reg13, 0),
            (try_end),
            
            # central portrait
            (create_mesh_overlay_with_tableau_material, reg11, -1, "tableau_troop_note_mesh", ":troop_id"),
            (set_fixed_point_multiplier, 1000),
            (position_set_x, pos1, 390),(position_set_y, pos1, 270),
            (overlay_set_position, reg11, pos1),
            (position_set_x, pos1, 600),(position_set_y, pos1, 600),
            (overlay_set_size, reg11, s1),
            
            (call_script, "script_npc_morale", ":troop_id"),
            (str_store_troop_name, s1, ":troop_id"),
            (str_store_string, s1, "str_com_morale_reg0"),
            (troop_get_slot, reg12, ":troop_id", slot_troop_player_relation),
            (str_store_string, s1, "str_com_relation_reg12"),
            (troop_get_slot, reg12, ":troop_id", 16),
            (try_begin),
              (eq, reg12, 1),
              (str_store_string, s1, "str_com_catholic"),
            (else_try),
              (str_store_string, s1, "str_com_pagan"),
            (try_end),
            
            (create_text_overlay, reg13, s1, tf_double_space),
            (position_set_x, pos1, 405),(position_set_y, pos1, 45),
            (overlay_set_position, reg13, pos1),
            (position_set_x, pos1, font_normal),(position_set_y, pos1, font_normal),
            (overlay_set_size, reg13, pos1),
            (overlay_set_color, reg13, 0x000000),
            
            (assign, "$current_selected", ":troop_id"),
            (troop_get_slot, ":companion_ocupation", ":troop_id", slot_troop_occupation),
            (neq, ":companion_ocupation", slto_player_companion),
            (overlay_set_color, reg11, 0x555555),
          (try_end),
        (try_end),
    ]),
    
    (event,[
        (store_trigger_param_1, ":object"),
        
        (try_begin),# done button
          (eq, ":object", "$g_presentation_leave_button"),
          (presentation_set_duration, 0),
          (assign, "$temp", 4),
          (call_script, "script_texto_companions_report"),
          (start_presentation, "prsnt_character_screen_main"),
        (try_end),
    ]),
    (hover,[]),
  ] + coord_helper + prsnt_escape_close
),


###start sandbox
("start_sandbox", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro11"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (try_begin),
          (eq, "$campaign_type", camp_sandbox),
          (call_script, "script_start_text_sandbox"),
        (else_try),
          (eq, "$campaign_type", camp_storyline),
          (call_script, "script_start_text_storyline"),
        (else_try),
          (call_script, "script_start_text_kingmode"),
        (end_try),
        (create_text_overlay, reg1, s10, tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 850),
        (overlay_set_size, reg1, pos1),
        
    ]),
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          (jump_to_menu, "mnu_auto_return_to_map"),
        (try_end),
    ]),
]),
###game_concepts_tutorial
("game_concepts_tutorial", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro11"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (create_text_overlay, reg1, "str_game_concepts_tutorial", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg1, pos1),
        
    ]),
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          (change_screen_notes, 5, 0),
        (try_end),
    ]),
]),
#storyline
("start_storyline", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        ## basicos
        (create_game_button_overlay, "$g_presentation_obj_1", "str_continue"),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 25),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        
        ###mesh de fondo
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro1"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1002),
        (position_set_y, pos1, 1002),
        (overlay_set_size, reg0, pos1),
        
        (call_script, "script_start_text_storyline"),
        (create_text_overlay, reg1, "@{s10}", tf_double_space|tf_scrollable|tf_center_justify),
        (position_set_x, pos1, 55),
        (position_set_y, pos1, 120),
        (overlay_set_position, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 460),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 850),
        (overlay_set_size, reg1, pos1),
        
    ]),
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        # (store_trigger_param_2, ":value"),
        
        (try_begin),
          (eq, ":object", "$g_presentation_obj_1"),
          (presentation_set_duration, 0),
          (change_screen_return),
        (try_end),
    ]),
]),
###
("vc_debug", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),
        
        #0. BACKROUND
        (create_mesh_overlay, reg0, "mesh_pic_extra_intro2"),
        (position_set_x, pos1, -1),
        (position_set_y, pos1, -1),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),
        
        (try_for_range, ":i", 1, 30),
          (str_clear, ":i"),
        (end_try),
        
        # simply add the name of your command here (max = 30)
        # (str_store_string, i, "@{!}Name"),
        # i is the ":object" in the trigger
        (str_store_string, 1, "@{!}vc debug mode on/off"),
        (str_store_string, 2, "@{!}party_slot_check"),
        (str_store_string, 3, "@{!}phaiak_cheats"),
        (str_store_string, 4, "@{!}Cheats fast use."),
        (str_store_string, 5, "@{!}ingame script execution"),
        (str_store_string, 6, "@{!}Check land parties follow a port"),
        (str_store_string, 7, "@{!}Check deserters on sea"),
        (str_store_string, 8, "@{!}Show all messages?"),
        (str_store_string, 9, "@{!}Check parties in towns"),
        (str_store_string, 10, "@{!}Check troop wealth"),
        (str_store_string, 11, "@{!}Create beta test log"),
        (str_store_string, 12, "@{!}Read beta test log"),
        (str_store_string, 13, "@{!}Check parties in ports"),
        (str_store_string, 14, "@{!}Check parties on water with wrong slot"),
        (str_store_string, 15, "@{!}Make all spawn points visible."),
        (str_store_string, 16, "@{!}Visit a scene."),
        (str_store_string, 17, "@{!}Change Weather."),
        (str_store_string, 18, "@{!}Check Savegame status."),
        (str_store_string, 19, "@{!}Check relations."),
        (str_store_string, 20, "@{!}Check sea parties with problems."),
        (str_store_string, 21, "@{!}Performance test (multi troop types)."),# FPS test VC-3672
        (str_store_string, 22, "@{!}Performance test (mono troop type)."),# FPS test VC-3672
        (str_store_string, 23, "@{!}Performance test (bring your own troops)."),# FPS test VC-3672
        (str_store_string, 24, "@{!}Check kingdom non-player parties."),
        
        #1. BUTTONS:
        (position_set_x, pos1, 50),
        (assign, ":button_y_position", 630),
        (try_for_range, ":i", 1, 30),
          (str_store_string_reg, s0,":i"),
          (create_button_overlay, reg1, s0, tf_left_align),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", 27),
          (overlay_set_position, reg1, pos1),
        (end_try),
        
        #2. OUTPUT:
        (str_store_string, s30, "@{!}Click a debug command!"),
        (create_text_overlay, reg1, s30, tf_scrollable|tf_double_space|tf_left_align),
        (position_set_x, pos1, 850),
        (position_set_y, pos1, 850),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 400),
        (position_set_y, pos1, 600),
        (overlay_set_area_size, reg1, pos1),
        (position_set_x, pos1, 520),
        (position_set_y, pos1, 100),
        (overlay_set_position, reg1, pos1),
        (assign, "$g_presentation_obj_1", reg1),
        
        #3. BASICS
        (create_game_button_overlay, "$g_presentation_obj_2", "str_back"),
        (position_set_y, pos1, 25),
        (position_set_x, pos1, 900),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
        (create_game_button_overlay, "$g_presentation_obj_3", "@{!}Print"),
        (position_set_y, pos1, 25),
        (position_set_x, pos1, 700),
        (overlay_set_position, "$g_presentation_obj_3", pos1),
        
    ]),
    
    
    
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),
        #(store_trigger_param_2, ":value"),
        
        (assign, reg8, 0),
        
        (try_begin),
          (eq, ":object", 1),
          (try_begin),
            (ge, "$vc_debug_mode", 2),
            (assign, "$vc_debug_mode", 0),
            (str_store_string, s30, "@{!}vc_debug_mode off"),
          (else_try),
            (val_add, "$vc_debug_mode", 1),
            (assign, reg2, "$vc_debug_mode"),
            (str_store_string, s30, "@{!}vc_debug_mode = {reg2}"),
          (end_try),
          (overlay_set_text, "$g_presentation_obj_1", s30),
          #
        (else_try),
          (eq, ":object", 2),
          (change_screen_map),
          (start_presentation, "prsnt_party_slot_check"),
          #
        (else_try),
          (eq, ":object", 3),
          (jump_to_menu, "mnu_phaiak_cheats"),
          #
        (else_try),
          (eq, ":object", 4),
          (jump_to_menu, "mnu_cheat_testing_cheats1"),
          #
        (else_try),
          (eq, ":object", 5),
          (change_screen_map),
          (start_presentation, "prsnt_ingame_operation"),
          #
        (else_try),
          (eq, ":object", 6),
          (str_store_string, s30, "@{!}PARTIES FOLLOWING PORT:^"),
          (try_for_parties, ":current_party"),
            (party_is_active, ":current_party"),
            (party_slot_eq, ":current_party", slot_party_on_water, 0),
            (get_party_ai_behavior, ":ai_behavior", ":current_party"),
            
            (this_or_next|eq, ":ai_behavior", ai_bhvr_travel_to_party),
            (this_or_next|eq, ":ai_behavior", ai_bhvr_patrol_party),
            (this_or_next|eq, ":ai_behavior", ai_bhvr_track_party),
            (this_or_next|eq, ":ai_behavior", ai_bhvr_attack_party),
            (this_or_next|eq, ":ai_behavior", ai_bhvr_avoid_party),
            (this_or_next|eq, ":ai_behavior", ai_bhvr_negotiate_party),
            (this_or_next|eq, ":ai_behavior", ai_bhvr_in_town),
            (this_or_next|eq, ":ai_behavior", ai_bhvr_travel_to_ship),
            (this_or_next|eq, ":ai_behavior", ai_bhvr_escort_party),
            (eq, ":ai_behavior", ai_bhvr_driven_by_party),
            
            (neg|party_is_in_any_town, ":current_party"),
            
            (get_party_ai_object, ":ai_object", ":current_party"),
            (call_script, "script_cf_is_port_party", ":ai_object"),
            (str_store_party_name, s1, ":current_party"),
            (assign, reg9, ":current_party"),
            (str_store_party_name, s2, ":ai_object"),
            (assign, reg10, ":ai_behavior"),
            (val_add, reg8, 1),
            (str_store_string, s30, "@{!}{s30}^{reg8}. {s1}({reg9}) wants to {s2}|ai:{reg10}"),
          (try_end),
          #
        (else_try),
          (eq, ":object", 7),
          (str_store_string, s30, "@{!}DESERTERS ON SEA:^"),
          (try_for_parties, ":current_party"),
            (party_is_active, ":current_party"),
            (party_slot_eq, ":current_party", slot_party_on_water, 1),
            (store_faction_of_party, ":faction", ":current_party"),
            (eq, ":faction", "fac_deserters"),
            (val_add, reg8, 1),
            (str_store_party_name, s1, ":current_party"),
            (str_store_string, s30, "@{!}{s30}^{reg8}. {s1}"),
          (try_end),
          #
        (else_try),
          (eq, ":object", 8),
          (try_begin),
            (ge, "$vc_show_all_messages", 1),
            (assign, "$vc_show_all_messages", 0),
            (str_store_string, s30, "@{!}vc_show_all_messages off"),
          (else_try),
            (assign, "$vc_show_all_messages", 1),
            (str_store_string, s30, "@{!}vc_show_all_messages on"),
          (end_try),
          #
        (else_try),
          (eq, ":object", 9),
          (str_store_string, s30, "@{!}PARTIES IN TOWNS:^"),
          (try_for_parties, ":party"),
            (party_get_template_id, reg1, ":party"),
            # (is_between, reg1, "pt_looters", "pt_merchant_caravan"),
            (str_store_party_name, s1, ":party"),
            (assign, reg7, ":party"),
            (party_is_in_any_town, ":party"),
            (party_get_cur_town, ":cur_center", ":party"),
            (str_store_party_name, s2, ":cur_center"),
            (store_party_size_wo_prisoners,reg1,":party"),
            (val_add, reg8, 1),
            (str_store_string, s30, "@{!}{s30}^{reg8}. {s1} {reg7} size {reg1} is in {s2}"),
          (end_try),
          #
        (else_try),
          (eq, ":object", 10),
          (str_store_string, s30, "@{!}TROOP WEALTH:^"),
          (try_for_range, reg0, active_npcs_begin, active_npcs_end),
            (troop_get_slot, reg1, reg0, slot_troop_wealth),
            (val_add, reg8, 1),
            (str_store_string, s30, "@{!}{s30}^{reg8}. troop {reg0} has {reg1} wealth"),
          (try_end),
          #
        (else_try),
          (eq, ":object", 11),
          (str_store_string, s30, "@{!}currently disabled"),
          (eq, 1, 0),
          # (str_store_string, s30, "@{!}TEST LOG:^"),
          # (try_for_range, reg1, 0, 10000),
            # (str_store_string, s30, "@{s30}XXXXXXXXXX^"),
          # (try_end),
          # (troop_set_plural_name, "trp_pseudo_troop_05", s30),
          #
        (else_try),
          (eq, ":object", 12),
          (call_script, "script_setup_debug_log"),
          (call_script, "script_print_debug_log"),
          #
        (else_try),
          (eq, ":object", 13),
          (str_store_string, s30, "@{!}PARTIES IN PORTS:^"),
          (try_for_parties, ":party"),
            (party_get_template_id, reg1, ":party"),
            # (is_between, reg1, "pt_looters", "pt_merchant_caravan"),
            (str_store_party_name, s1, ":party"),
            (assign, reg7, ":party"),
            (party_is_in_any_town, ":party"),
            (party_get_cur_town, ":cur_center", ":party"),
            (call_script, "script_cf_is_port_party", ":cur_center"),
            (str_store_party_name, s2, ":cur_center"),
            (store_party_size_wo_prisoners,reg1,":party"),
            (val_add, reg8, 1),
            (str_store_string, s30, "@{!}{s30}^{reg8}. {s1} {reg7} size {reg1} is in {s2}"),
          (end_try),
          #
        (else_try),
          (eq, ":object", 14),
          (str_store_string, s30, "@{!}PARTIES ON WATER WRONG SLOTS:^"),
          (try_for_parties, ":party_no"),
            (str_store_party_name, s1, ":party_no"),
            (assign, reg7, ":party_no"),
            (party_get_current_terrain, ":terrain_type", ":party_no"),
            (try_begin),
              (this_or_next|eq, ":terrain_type", rt_water),
              (this_or_next|eq, ":terrain_type", rt_river),
              (eq, ":terrain_type", rt_bridge),
              (neg|party_slot_eq, ":party_no", slot_party_on_water, 1),
              (val_add, reg8, 1),
              (str_store_string, s30, "@{!}{s30}^{reg8}. '{s1}' ({reg7}) on water but slot = 0"),
            (else_try),
              (neq, ":terrain_type", rt_water),
              (neq, ":terrain_type", rt_river),
              (neq, ":terrain_type", rt_bridge),
              (neg|party_slot_eq, ":party_no", slot_party_on_water, 0),
              (val_add, reg8, 1),
              (str_store_string, s30, "@{!}{s30}^{reg8}. '{s1}' ({reg7}) on land but slot = 1"),
            (end_try),
          (end_try),
          #
        (else_try),
          (eq, ":object", 15),
          (try_for_range, ":current_party", "p_wales_spawn_point", "p_testing_spawn_point"),
            (enable_party, ":current_party"),
            (party_set_flags, ":current_party", pf_always_visible, 1),
            (party_get_slot, ":lair", ":current_party", slot_party_lair_party),
            (gt, ":lair", "p_spawn_points_end"),
            (enable_party, ":lair"),
            (party_set_flags, ":lair", pf_always_visible, 1),
          (end_try),
          #
        (else_try),
          (eq, ":object", 16),
          (start_presentation, "prsnt_visit_scene"),
          #
        (else_try),
          (eq, ":object", 17),
          (jump_to_menu, "mnu_cheat_change_weather"),
          #
        (else_try),
          (eq, ":object", 18),
          (assign, reg4, "$game_started_in_version"),
          (assign, reg1, "$bug_fix_version"),
          (assign, reg2, "$game_started_with_content_update"),
          (assign, reg3, "$game_updated_to_content_update"),
          (str_store_string, s30, "@{!}SAVEGAME STATUS:^^game_started_in_version: {reg4}^bug_fix_version: {reg1}^game_started_with_content_update: {reg2}^game_updated_to_content_update: {reg3}"),
          #
        (else_try),
          (eq, ":object", 19),
          (str_store_string, s30, "@{!}RELATION MATRIX:^"),
          (set_show_messages, 0),
          (str_store_string, s30, "@{!}^^RELATION MATRIX:^"),
          (store_sub, ":count", lords_end, kings_begin),
          (try_for_range, ":npc", kings_begin, lords_end),
            (str_store_troop_name, s1, ":npc"),
            (assign, reg1, ":npc"),
            (val_add, reg8, 1),
            (assign, reg7, 0),
            (display_message, "@{!}{reg8}. '{s1}' ({reg1}):"),
            (try_for_range, ":npc2", kings_begin, lords_end),
              (call_script, "script_troop_get_relation_with_troop", ":npc", ":npc2"),
              (str_store_troop_name, s2, ":npc2"),
              (assign, reg2, ":npc2"),
              (display_message, "@{!}    '{s2}' ({reg2}): {reg0}"),
              (val_add, reg7, reg0),
            (try_end),
            (val_div, reg7, ":count"),
            (display_message, "@{!}    Average: {reg7}^"),
          (try_end),
          (set_show_messages, 1),
          (str_store_string, s30, "@{!}{s30}^Too long. See rgl_log.txt"),
          #
        (else_try),
          (eq, ":object", 20),
          (str_store_string, s30, "@{!}SEA PARTIES ON LAND:^"),
          (try_for_parties, ":current_party"),
            (party_is_active, ":current_party"),
            (neg|party_is_in_any_town, ":current_party"),
            
            (party_get_template_id, reg1, ":current_party"),
            (is_between, reg1, "pt_fisher_ship", "pt_viking_raider"),
            
            (get_party_ai_object, ":ai_object", ":current_party"),
            (this_or_next|le, ":ai_object", 0),
            (party_slot_eq, ":current_party", slot_party_on_water, 0),
            (get_party_ai_behavior, ":ai_behavior", ":current_party"),
            
            (str_store_party_name, s1, ":current_party"),
            (assign, reg9, ":current_party"),
            (str_store_party_name, s2, ":ai_object"),
            (assign, reg10, ":ai_behavior"),
            (val_add, reg8, 1),
            (str_store_string, s30, "@{!}{s30}^{reg8}. {s1}({reg9}) wants to {s2}|ai:{reg10}"),
          (try_end),
          #
        (else_try),
          (eq, ":object", 21),# FPS test VC-3672
      
          (spawn_around_party, "p_main_party", "pt_steppe_bandits"),
          (assign, ":opponent_party_id", reg0),
          
          # Position
          (set_fixed_point_multiplier, 1),
          (position_set_x, pos1, 27),
          (position_set_y, pos1, -107),
          (party_set_position, "p_main_party", pos1),
          (party_set_position, ":opponent_party_id", pos1),
          
          # Remove companions
          (assign, "$g_move_heroes", 1),
          (call_script, "script_party_remove_all_companions", "p_main_party"),
          (call_script, "script_party_remove_all_companions", ":opponent_party_id"),
          
          # Add new companions
          (assign, ":counter", 0),
          (try_for_range, ":troop_id", "trp_norse_slave", "trp_irish_priest"),
            (lt, ":counter", 50),
            (party_add_members, "p_main_party", ":troop_id", 1),
            (val_add, ":counter", 1),
          (end_try),		  
          (assign, ":counter", 0),
          (try_for_range_backwards, ":troop_id", "trp_norse_slave", "trp_irish_priest"),
            (lt, ":counter", 50),
            (party_add_members, ":opponent_party_id", ":troop_id", 1),
            (val_add, ":counter", 1),
          (end_try),
          
          (presentation_set_duration, 0),
          (assign, "$alpha_animal", 7777),
          (rest_for_hours, 1, 100, 1),
          #
        (else_try),
          (eq, ":object", 22),# FPS test VC-3672 (mono troops)
          
          (spawn_around_party, "p_main_party", "pt_steppe_bandits"),
          (assign, ":opponent_party_id", reg0),
          
          # Position
          (set_fixed_point_multiplier, 1),
          (position_set_x, pos1, 27),
          (position_set_y, pos1, -107),
          (party_set_position, "p_main_party", pos1),
          (party_set_position, ":opponent_party_id", pos1),
          
          # Companions
          (assign, "$g_move_heroes", 1),
          (call_script, "script_party_remove_all_companions", "p_main_party"),
          (call_script, "script_party_remove_all_companions", ":opponent_party_id"),
          (party_add_members, "p_main_party", "trp_norse_slave", 50),
          (party_add_members, ":opponent_party_id", "trp_norse_slave", 50),
          
          (presentation_set_duration, 0),
          (assign, "$alpha_animal", 7777),
          (rest_for_hours, 1, 100, 1),
          #
        (else_try),
          (eq, ":object", 23),# FPS test VC-3672 (own troops)
      
          (spawn_around_party, "p_main_party", "pt_steppe_bandits"),
          (assign, ":opponent_party_id", reg0),
          
          # Position
          (set_fixed_point_multiplier, 1),
          (position_set_x, pos1, 27),
          (position_set_y, pos1, -107),
          (party_set_position, "p_main_party", pos1),
          (party_set_position, ":opponent_party_id", pos1),
          
          # Companions
          (assign, "$g_move_heroes", 1),
          (call_script, "script_party_remove_all_companions", ":opponent_party_id"),
          (party_add_members, ":opponent_party_id", "trp_norse_slave", 50),
          
          (presentation_set_duration, 0),
          (assign, "$alpha_animal", 7777),
          #(rest_for_hours, 1, 100, 1),
          #
        (else_try),
          (eq, ":object", 24),  #test kingdom non-player parties for zombie kingdoms of defeated lords
          (str_store_string, s30, "@{!}KINGDOM NON-PLAYER PARTIES:^"),
          (try_for_parties, ":party"),
            (store_faction_of_party, reg1, ":party"),
            (this_or_next|is_between, reg1, kingdoms_begin, kingdoms_end),
            (this_or_next|eq, reg1, "fac_adventurers"),
            (eq, reg1, "fac_commoners"),
            
            (neq, reg1, "fac_player_supporters_faction"),
            
            (str_store_faction_name, s2, reg1),
            (str_store_party_name, s1, ":party"),
            (assign, reg7, ":party"),
            
            (store_party_size_wo_prisoners,reg1,":party"),
            (val_add, reg8, 1),
            
            (str_store_string, s30, "@{!}{s30}^{reg8}. {s1} {reg7} size {reg1} {s2}"),
            
            (party_stack_get_troop_id, ":party_leader", ":party", 0),
            (try_begin),
              (is_between, ":party_leader", active_npcs_begin, active_npcs_end),
              (str_store_troop_name, s3, ":party_leader"),
              
              (store_faction_of_troop, reg9, ":party_leader"),
              (str_store_faction_name, s4, reg9),
              (str_store_string, s30, "@{!}{s30} leader {s3} in {s4}"),
            (end_try),
          (end_try),
          #
        (else_try),
          (eq, ":object", "$g_presentation_obj_2"),
          (presentation_set_duration, 0),
        (else_try),
          (eq, ":object", "$g_presentation_obj_3"),
          (display_message, "@{!}^^---print---^^"),
          (display_message, s30),
          (display_message, "@{!}^^"),
        (try_end),
        (overlay_set_text, "$g_presentation_obj_1", s30),
    ]),
  ] + prsnt_escape_close
),

]
