Jump to content

Better Tactical Overlay


Recommended Posts

Posted

Better Tactical Overlay


Prerequisites:

- de-stretching fix

- code for module.ini reading

 

Start by downloading the assets. Put them in the correct subfolders of your module.

Remember to add the BRF to load order, like so:

load_mod_resource = rndl_tactical_overlay

 

Ok, now we can begin.

 

Add this as first line of all your files:

#-*-coding:utf-8-*-

 

Ok, let's get to it.

Keep in mind that division for ranged cavalry is optional (the new flags and their controls). Analyze the code and you can easily remove them, use the original flags instead.

 

Add this to header_mission_templates.py:

grc_shooters = 1
grc_skirmishers = 3
grd_1 = 0
grd_2 = 1
grd_3 = 2
grd_4 = 3
grd_5 = 4
grd_6 = 5
grd_7 = 6
grd_8 = 7
grd_9 = 8

 

This to module_meshes.py:

    ("rndl_white_plane",0,"rndl_white_plane",     0,0,0,0,0,0,1,1,1),
    ##("flag_infantry", 0,"flag_infantry",        0,0,0,0,0,0,1,1,1),
    ##("flag_archers",  0,"flag_archers",         0,0,0,0,0,0,1,1,1),
    ##("flag_cavalry",  0,"flag_cavalry",         0,0,0,0,0,0,1,1,1),
    ("flag_infantry",   0,"rndl_flag_infantry",   0,0,0,0,0,0,1,1,1),
    ("flag_archers",    0,"rndl_flag_shooters",   0,0,0,0,0,0,1,1,1),
    ("flag_cavalry",    0,"rndl_flag_cavalry",    0,0,0,0,0,0,1,1,1),
    ("flag_skirmishers",0,"rndl_flag_skirmishers",0,0,0,0,0,0,1,1,1),

 

To module_presentations.py:

	("tactical_overlay",0,0,
		[
			(ti_on_presentation_load,
				[
					(presentation_set_duration,0x7FFFFFFF),
					(set_fixed_point_multiplier,1000),
					(assign,"$prsnt_tac_stop",0),
					(try_begin),
						(eq,"$g_ally_party",0),
						(assign,"$g_ally_party",-1),
					(try_end),
					#reset selection variables from previous launch of the presentation
					(assign,"$prsnt_tac_div1_is_selected",0),
					(assign,"$prsnt_tac_div2_is_selected",0),
					(assign,"$prsnt_tac_div3_is_selected",0),
					(assign,"$prsnt_tac_div4_is_selected",0),
					(assign,"$prsnt_tac_div5_is_selected",0),
					(assign,"$prsnt_tac_div6_is_selected",0),
					(assign,"$prsnt_tac_div7_is_selected",0),
					(assign,"$prsnt_tac_div8_is_selected",0),
					(assign,"$prsnt_tac_div9_is_selected",0),
					(try_begin), #divisions & orders column
						(try_begin), #divisions
							(try_begin), #headers
								(create_text_overlay,"$prsnt_tac_div_header_status_action","@Action",tf_center_justify|tf_single_line|tf_with_outline),
								(create_text_overlay,"$prsnt_tac_div_header_status_firing","@Firing",tf_center_justify|tf_single_line|tf_with_outline),
								(create_text_overlay,"$prsnt_tac_div_header_status_weapon","@Weapon",tf_center_justify|tf_single_line|tf_with_outline),
								(create_text_overlay,"$prsnt_tac_div_header_status_riding","@Riding",tf_center_justify|tf_single_line|tf_with_outline),
								(position_set_y,pos0,750-25-10*mult_y), #10 units margin (with fix for screen stretching) from the upper screen edge, assuming that font size around 25, which it roughly is
								(position_set_x,pos0,265),(overlay_set_position,"$prsnt_tac_div_header_status_action",pos0),
								(position_set_x,pos0,399),(overlay_set_position,"$prsnt_tac_div_header_status_firing",pos0),
								(position_set_x,pos0,512),(overlay_set_position,"$prsnt_tac_div_header_status_weapon",pos0),
								(position_set_x,pos0,625),(overlay_set_position,"$prsnt_tac_div_header_status_riding",pos0),
								(overlay_set_color,"$prsnt_tac_div_header_status_action",0xCCCCCC),
								(overlay_set_color,"$prsnt_tac_div_header_status_firing",0xCCCCCC),
								(overlay_set_color,"$prsnt_tac_div_header_status_weapon",0xCCCCCC),
								(overlay_set_color,"$prsnt_tac_div_header_status_riding",0xCCCCCC),
							(try_end),
							#division bg size
							(position_set_x,pos0,1000-3*10-290), #3*10 are gaps between screen edge and orders, screen edge and minimap, and between orders and minimap, while 290 is minimap max width
							(position_set_y,pos0,40), #row height
							#checkbox size
							(position_set_x,pos1,1000*mult_x), #anti-stretching fix
							(position_set_y,pos1,1000),
							#no need to position division rows yet, a script will decide if they should appear and move them accordingly to correct positions
							(try_begin), #division 1 row
								(create_image_button_overlay,"$prsnt_tac_div1_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div1_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div1_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div1_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div1_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div1_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div1_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div1_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div1_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div1_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div1_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div1_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div1_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div1_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div1_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div1_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div1_order_status_riding",1),
							(try_end),
							(try_begin), #division 2 row
								(create_image_button_overlay,"$prsnt_tac_div2_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div2_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div2_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div2_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div2_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div2_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div2_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div2_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div2_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div2_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div2_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div2_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div2_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div2_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div2_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div2_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div2_order_status_riding",1),
							(try_end),
							(try_begin), #division 3 row
								(create_image_button_overlay,"$prsnt_tac_div3_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div3_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div3_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div3_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div3_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div3_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div3_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div3_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div3_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div3_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div3_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div3_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div3_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div3_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div3_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div3_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div3_order_status_riding",1),
							(try_end),
							(try_begin), #division 4 row
								(create_image_button_overlay,"$prsnt_tac_div4_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div4_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div4_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div4_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div4_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div4_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div4_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div4_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div4_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div4_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div4_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div4_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div4_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div4_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div4_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div4_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div4_order_status_riding",1),
							(try_end),
							(try_begin), #division 5 row
								(create_image_button_overlay,"$prsnt_tac_div5_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div5_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div5_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div5_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div5_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div5_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div5_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div5_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div5_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div5_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div5_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div5_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div5_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div5_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div5_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div5_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div5_order_status_riding",1),
							(try_end),
							(try_begin), #division 6 row
								(create_image_button_overlay,"$prsnt_tac_div6_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div6_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div6_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div6_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div6_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div6_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div6_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div6_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div6_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div6_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div6_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div6_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div6_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div6_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div6_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div6_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div6_order_status_riding",1),
							(try_end),
							(try_begin), #division 7 row
								(create_image_button_overlay,"$prsnt_tac_div7_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div7_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div7_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div7_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div7_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div7_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div7_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div7_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div7_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div7_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div7_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div7_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div7_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div7_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div7_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div7_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div7_order_status_riding",1),
							(try_end),
							(try_begin), #division 8 row
								(create_image_button_overlay,"$prsnt_tac_div8_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div8_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div8_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div8_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div8_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div8_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div8_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div8_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div8_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div8_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div8_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div8_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div8_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div8_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div8_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div8_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div8_order_status_riding",1),
							(try_end),
							(try_begin), #division 9 row
								(create_image_button_overlay,"$prsnt_tac_div9_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_size, "$prsnt_tac_div9_bg",pos0),
								(overlay_set_alpha,"$prsnt_tac_div9_bg",0x44),
								(overlay_set_color,"$prsnt_tac_div9_bg",0x000000),
								(create_check_box_overlay,"$prsnt_tac_div9_checkbox","mesh_checkbox_off","mesh_checkbox_on"),
								(overlay_set_size,   "$prsnt_tac_div9_checkbox",pos1),
								(create_text_overlay,"$prsnt_tac_div9_name_and_count",     "@{!}",0),
								(create_text_overlay,"$prsnt_tac_div9_order_status_action","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div9_order_status_firing","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div9_order_status_weapon","@{!}",tf_center_justify),
								(create_text_overlay,"$prsnt_tac_div9_order_status_riding","@{!}",tf_center_justify),
								(overlay_set_additional_render_height,"$prsnt_tac_div9_checkbox",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_div9_name_and_count",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_div9_order_status_action",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div9_order_status_firing",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div9_order_status_weapon",1),
								(overlay_set_additional_render_height,"$prsnt_tac_div9_order_status_riding",1),
							(try_end),
						(try_end),
						(try_begin), #orders
							(try_begin), #headers & bg
								#headers
								(game_key_get_mapped_key_name,s0,gk_order_1),(create_text_overlay,"$prsnt_tac_orders_movement_header", "@[{s0}] Movement orders", tf_center_justify|tf_single_line|tf_with_outline),
								(game_key_get_mapped_key_name,s0,gk_order_2),(create_text_overlay,"$prsnt_tac_orders_formation_header","@[{s0}] Formation orders",tf_center_justify|tf_single_line|tf_with_outline),
								(game_key_get_mapped_key_name,s0,gk_order_3),(create_text_overlay,"$prsnt_tac_orders_firing_header",   "@[{s0}] Fire orders",     tf_center_justify|tf_single_line|tf_with_outline),
								(game_key_get_mapped_key_name,s0,gk_order_4),(create_text_overlay,"$prsnt_tac_orders_equipment_header","@[{s0}] Equipment orders",tf_center_justify|tf_single_line|tf_with_outline),
								(overlay_set_color,"$prsnt_tac_orders_movement_header", 0xCCCCCC),
								(overlay_set_color,"$prsnt_tac_orders_formation_header",0xCCCCCC),
								(overlay_set_color,"$prsnt_tac_orders_firing_header",   0xCCCCCC),
								(overlay_set_color,"$prsnt_tac_orders_equipment_header",0xCCCCCC),
								(position_set_x,pos0,750), #75% of standard size
								(position_set_y,pos0,750), #75% of standard size
								(overlay_set_size,"$prsnt_tac_orders_movement_header", pos0),
								(overlay_set_size,"$prsnt_tac_orders_formation_header",pos0),
								(overlay_set_size,"$prsnt_tac_orders_firing_header",   pos0),
								(overlay_set_size,"$prsnt_tac_orders_equipment_header",pos0),
								#backgrounds
								(create_image_button_overlay,"$prsnt_tac_orders_movement_bg", "mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(create_image_button_overlay,"$prsnt_tac_orders_formation_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(create_image_button_overlay,"$prsnt_tac_orders_firing_bg",   "mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(create_image_button_overlay,"$prsnt_tac_orders_equipment_bg","mesh_rndl_white_plane","mesh_rndl_white_plane"),
								(overlay_set_color,"$prsnt_tac_orders_movement_bg", 0x000000),
								(overlay_set_color,"$prsnt_tac_orders_formation_bg",0x000000),
								(overlay_set_color,"$prsnt_tac_orders_firing_bg",   0x000000),
								(overlay_set_color,"$prsnt_tac_orders_equipment_bg",0x000000),
								(overlay_set_alpha,"$prsnt_tac_orders_movement_bg", 0x44), #4/15 visibility (around 27%)
								(overlay_set_alpha,"$prsnt_tac_orders_formation_bg",0x44), #4/15 visibility (around 27%)
								(overlay_set_alpha,"$prsnt_tac_orders_firing_bg",   0x44), #4/15 visibility (around 27%)
								(overlay_set_alpha,"$prsnt_tac_orders_equipment_bg",0x44), #4/15 visibility (around 27%)
								(position_set_x,pos0,((1000-3*10-290)-3*10)/4), #the (1000-3*10-290) part is total length of division background and the total space we have for order backgrounds, minus 3 gaps of 10 units between order backgrounds, and that divided among 4 backgrounds
								(try_begin), #advanced orders
									(eq,module_ini["use_advanced_formation"],1),
									(position_set_y,pos0,35*7*0.667), #max 7 orders per background, text size is 66.7%
								(else_try), #simple orders
									(position_set_y,pos0,35*6*0.667), #max 6 orders per background, text size is 66.7%
								(try_end),
								(overlay_set_size,"$prsnt_tac_orders_movement_bg", pos0),
								(overlay_set_size,"$prsnt_tac_orders_formation_bg",pos0),
								(overlay_set_size,"$prsnt_tac_orders_firing_bg",   pos0),
								(overlay_set_size,"$prsnt_tac_orders_equipment_bg",pos0),
								#hide advanced controls when advanced orders are off
								(try_begin),
									(eq,module_ini["use_advanced_formation"],0),
									(overlay_set_display,"$prsnt_tac_orders_equipment_header",0),
									(overlay_set_display,"$prsnt_tac_orders_equipment_bg",    0),
								(try_end),
							(try_end),
							(try_begin), #order buttons
								(try_begin), #advanced orders
									(eq,module_ini["use_advanced_formation"],1),
									#movement orders
									(game_key_get_mapped_key_name,s0,gk_order_1),(create_button_overlay,"$prsnt_tac_orders_hold",              "@[{s0}] Hold this position",    tf_center_justify|tf_single_line), #mordr_hold
									(game_key_get_mapped_key_name,s0,gk_order_2),(create_button_overlay,"$prsnt_tac_orders_follow",            "@[{s0}] Follow me",             tf_center_justify|tf_single_line), #mordr_follow
									(game_key_get_mapped_key_name,s0,gk_order_3),(create_button_overlay,"$prsnt_tac_orders_charge",            "@[{s0}] Charge",                tf_center_justify|tf_single_line), #mordr_charge
									(game_key_get_mapped_key_name,s0,gk_order_4),(create_button_overlay,"$prsnt_tac_orders_stand_ground",      "@[{s0}] Stand ground",          tf_center_justify|tf_single_line), #mordr_stand_ground
									(game_key_get_mapped_key_name,s0,gk_order_5),(create_button_overlay,"$prsnt_tac_orders_retreat",           "@[{s0}] Retreat",               tf_center_justify|tf_single_line), #mordr_retreat
									(game_key_get_mapped_key_name,s0,gk_order_6),(create_button_overlay,"$prsnt_tac_orders_advance",           "@[{s0}] Advance ten paces",     tf_center_justify|tf_single_line), #mordr_advance
									(game_key_get_mapped_key_name,s0,gk_order_7),(create_button_overlay,"$prsnt_tac_orders_fall_back",         "@[{s0}] Fall back ten paces",   tf_center_justify|tf_single_line), #mordr_fall_back
									#formation orders
									(game_key_get_mapped_key_name,s0,gk_order_1),(create_button_overlay,"$prsnt_tac_orders_form_1_row",        "@[{s0}] Form 1 row",            tf_center_justify|tf_single_line), #mordr_form_1_row
									(game_key_get_mapped_key_name,s0,gk_order_2),(create_button_overlay,"$prsnt_tac_orders_form_2_row",        "@[{s0}] Form 2 rows",           tf_center_justify|tf_single_line), #mordr_form_2_row
									(game_key_get_mapped_key_name,s0,gk_order_3),(create_button_overlay,"$prsnt_tac_orders_form_3_row",        "@[{s0}] Form 3 rows",           tf_center_justify|tf_single_line), #mordr_form_3_row
									(game_key_get_mapped_key_name,s0,gk_order_4),(create_button_overlay,"$prsnt_tac_orders_form_4_row",        "@[{s0}] Form 4 rows",           tf_center_justify|tf_single_line), #mordr_form_4_row
									(game_key_get_mapped_key_name,s0,gk_order_5),(create_button_overlay,"$prsnt_tac_orders_form_5_row",        "@[{s0}] Form 5 rows",           tf_center_justify|tf_single_line), #mordr_form_5_row
									(game_key_get_mapped_key_name,s0,gk_order_6),(create_button_overlay,"$prsnt_tac_orders_spread_out",        "@[{s0}] Spread out",            tf_center_justify|tf_single_line), #mordr_spread_out
									(game_key_get_mapped_key_name,s0,gk_order_7),(create_button_overlay,"$prsnt_tac_orders_stand_closer",      "@[{s0}] Stand closer",          tf_center_justify|tf_single_line), #mordr_stand_closer
									#firing orders
									(game_key_get_mapped_key_name,s0,gk_order_1),(create_button_overlay,"$prsnt_tac_orders_fire_at_will",      "@[{s0}] Fire at will",          tf_center_justify|tf_single_line), #mordr_fire_at_will
									(game_key_get_mapped_key_name,s0,gk_order_2),(create_button_overlay,"$prsnt_tac_orders_fire_at_my_command","@[{s0}] Fire at my command",    tf_center_justify|tf_single_line), #mordr_fire_at_my_command
									(game_key_get_mapped_key_name,s0,gk_order_2),(create_button_overlay,"$prsnt_tac_orders_all_fire_now",      "@[{s0}] All, fire now",         tf_center_justify|tf_single_line), #mordr_all_fire_now
									(game_key_get_mapped_key_name,s0,gk_order_3),(create_button_overlay,"$prsnt_tac_orders_left_fire_now",     "@[{s0}] Left, fire now",        tf_center_justify|tf_single_line), #mordr_left_fire_now
									(game_key_get_mapped_key_name,s0,gk_order_4),(create_button_overlay,"$prsnt_tac_orders_middle_fire_now",   "@[{s0}] Middle, fire now",      tf_center_justify|tf_single_line), #mordr_middle_fire_now
									(game_key_get_mapped_key_name,s0,gk_order_5),(create_button_overlay,"$prsnt_tac_orders_right_fire_now",    "@[{s0}] Right, fire now",       tf_center_justify|tf_single_line), #mordr_right_fire_now
									#equipment orders
									(game_key_get_mapped_key_name,s0,gk_order_1),(create_button_overlay,"$prsnt_tac_orders_use_melee_weapons", "@[{s0}] Use melee weapons",     tf_center_justify|tf_single_line), #mordr_use_melee_weapons
									(game_key_get_mapped_key_name,s0,gk_order_2),(create_button_overlay,"$prsnt_tac_orders_use_ranged_weapons","@[{s0}] Use ranged weapons",    tf_center_justify|tf_single_line), #mordr_use_ranged_weapons
									(game_key_get_mapped_key_name,s0,gk_order_3),(create_button_overlay,"$prsnt_tac_orders_use_blunt_weapons", "@[{s0}] Use only blunt weapons",tf_center_justify|tf_single_line), #mordr_use_blunt_weapons
									(game_key_get_mapped_key_name,s0,gk_order_4),(create_button_overlay,"$prsnt_tac_orders_use_any_weapon",    "@[{s0}] Use weapons at will",   tf_center_justify|tf_single_line), #mordr_use_any_weapon
									(game_key_get_mapped_key_name,s0,gk_order_5),(create_button_overlay,"$prsnt_tac_orders_mount",             "@[{s0}] Mount horses",          tf_center_justify|tf_single_line), #mordr_mount
									(game_key_get_mapped_key_name,s0,gk_order_6),(create_button_overlay,"$prsnt_tac_orders_dismount",          "@[{s0}] Dismount",              tf_center_justify|tf_single_line), #mordr_dismount
									#unused orders - create the overlays anyway to simplify the code
									(create_button_overlay,"$prsnt_tac_orders_hold_fire","@{!}"), #mordr_hold_fire
								(else_try), #simple orders
									#movement orders
									(game_key_get_mapped_key_name,s0,gk_order_1),(create_button_overlay,"$prsnt_tac_orders_hold",             "@[{s0}] Hold this position",    tf_center_justify|tf_single_line), #mordr_hold
									(game_key_get_mapped_key_name,s0,gk_order_2),(create_button_overlay,"$prsnt_tac_orders_follow",           "@[{s0}] Follow me",             tf_center_justify|tf_single_line), #mordr_follow
									(game_key_get_mapped_key_name,s0,gk_order_3),(create_button_overlay,"$prsnt_tac_orders_charge",           "@[{s0}] Charge",                tf_center_justify|tf_single_line), #mordr_charge
									(game_key_get_mapped_key_name,s0,gk_order_4),(create_button_overlay,"$prsnt_tac_orders_stand_ground",     "@[{s0}] Stand ground",          tf_center_justify|tf_single_line), #mordr_stand_ground
									(game_key_get_mapped_key_name,s0,gk_order_5),(create_button_overlay,"$prsnt_tac_orders_retreat",          "@[{s0}] Retreat",               tf_center_justify|tf_single_line), #mordr_retreat
									#formation orders
									(game_key_get_mapped_key_name,s0,gk_order_1),(create_button_overlay,"$prsnt_tac_orders_advance",          "@[{s0}] Advance ten paces",     tf_center_justify|tf_single_line), #mordr_advance
									(game_key_get_mapped_key_name,s0,gk_order_2),(create_button_overlay,"$prsnt_tac_orders_fall_back",        "@[{s0}] Fall back ten paces",   tf_center_justify|tf_single_line), #mordr_fall_back
									(game_key_get_mapped_key_name,s0,gk_order_3),(create_button_overlay,"$prsnt_tac_orders_spread_out",       "@[{s0}] Spread out",            tf_center_justify|tf_single_line), #mordr_spread_out
									(game_key_get_mapped_key_name,s0,gk_order_4),(create_button_overlay,"$prsnt_tac_orders_stand_closer",     "@[{s0}] Stand closer",          tf_center_justify|tf_single_line), #mordr_stand_closer
									(game_key_get_mapped_key_name,s0,gk_order_5),(create_button_overlay,"$prsnt_tac_orders_mount",            "@[{s0}] Mount horses",          tf_center_justify|tf_single_line), #mordr_mount
									(game_key_get_mapped_key_name,s0,gk_order_6),(create_button_overlay,"$prsnt_tac_orders_dismount",         "@[{s0}] Dismount",              tf_center_justify|tf_single_line), #mordr_dismount
									#firing orders
									(game_key_get_mapped_key_name,s0,gk_order_1),(create_button_overlay,"$prsnt_tac_orders_hold_fire",        "@[{s0}] Hold your fire",        tf_center_justify|tf_single_line), #mordr_hold_fire
									(game_key_get_mapped_key_name,s0,gk_order_2),(create_button_overlay,"$prsnt_tac_orders_fire_at_will",     "@[{s0}] Fire at will",          tf_center_justify|tf_single_line), #mordr_fire_at_will
									(game_key_get_mapped_key_name,s0,gk_order_3),(create_button_overlay,"$prsnt_tac_orders_use_blunt_weapons","@[{s0}] Use only blunt weapons",tf_center_justify|tf_single_line), #mordr_use_blunt_weapons
									(game_key_get_mapped_key_name,s0,gk_order_4),(create_button_overlay,"$prsnt_tac_orders_use_any_weapon",   "@[{s0}] Use weapons at will",   tf_center_justify|tf_single_line), #mordr_use_any_weapon
									#unused orders - create the overlays anyway to simplify the code
									(create_button_overlay,"$prsnt_tac_orders_form_1_row",        "@{!}"), #mordr_form_1_row
									(create_button_overlay,"$prsnt_tac_orders_form_2_row",        "@{!}"), #mordr_form_2_row
									(create_button_overlay,"$prsnt_tac_orders_form_3_row",        "@{!}"), #mordr_form_3_row
									(create_button_overlay,"$prsnt_tac_orders_form_4_row",        "@{!}"), #mordr_form_4_row
									(create_button_overlay,"$prsnt_tac_orders_form_5_row",        "@{!}"), #mordr_form_5_row
									(create_button_overlay,"$prsnt_tac_orders_fire_at_my_command","@{!}"), #mordr_fire_at_my_command
									(create_button_overlay,"$prsnt_tac_orders_all_fire_now",      "@{!}"), #mordr_all_fire_now
									(create_button_overlay,"$prsnt_tac_orders_left_fire_now",     "@{!}"), #mordr_left_fire_now
									(create_button_overlay,"$prsnt_tac_orders_middle_fire_now",   "@{!}"), #mordr_middle_fire_now
									(create_button_overlay,"$prsnt_tac_orders_right_fire_now",    "@{!}"), #mordr_right_fire_now
									(create_button_overlay,"$prsnt_tac_orders_use_melee_weapons", "@{!}"), #mordr_use_melee_weapons
									(create_button_overlay,"$prsnt_tac_orders_use_ranged_weapons","@{!}"), #mordr_use_ranged_weapons
								(try_end),
								#set color
								(overlay_set_color,"$prsnt_tac_orders_hold",              0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_follow",            0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_charge",            0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_stand_ground",      0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_retreat",           0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_advance",           0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_fall_back",         0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_form_1_row",        0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_form_2_row",        0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_form_3_row",        0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_form_4_row",        0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_form_5_row",        0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_spread_out",        0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_stand_closer",      0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_hold_fire",         0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_fire_at_will",      0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_fire_at_my_command",0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_all_fire_now",      0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_left_fire_now",     0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_middle_fire_now",   0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_right_fire_now",    0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_use_melee_weapons", 0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_use_ranged_weapons",0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_use_blunt_weapons", 0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_use_any_weapon",    0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_mount",             0xFFFFFF),
								(overlay_set_color,"$prsnt_tac_orders_dismount",          0xFFFFFF),
								#set alpha
								(overlay_set_alpha,"$prsnt_tac_orders_hold",              0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_follow",            0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_charge",            0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_stand_ground",      0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_retreat",           0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_advance",           0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_fall_back",         0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_form_1_row",        0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_form_2_row",        0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_form_3_row",        0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_form_4_row",        0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_form_5_row",        0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_spread_out",        0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_stand_closer",      0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_hold_fire",         0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_fire_at_will",      0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_fire_at_my_command",0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_all_fire_now",      0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_left_fire_now",     0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_middle_fire_now",   0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_right_fire_now",    0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_use_melee_weapons", 0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_use_ranged_weapons",0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_use_blunt_weapons", 0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_use_any_weapon",    0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_mount",             0x99),
								(overlay_set_alpha,"$prsnt_tac_orders_dismount",          0x99),
								#set highlight color
								(overlay_set_hilight_color,"$prsnt_tac_orders_hold",              0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_follow",            0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_charge",            0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_stand_ground",      0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_retreat",           0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_advance",           0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_fall_back",         0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_form_1_row",        0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_form_2_row",        0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_form_3_row",        0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_form_4_row",        0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_form_5_row",        0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_spread_out",        0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_stand_closer",      0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_hold_fire",         0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_fire_at_will",      0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_fire_at_my_command",0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_all_fire_now",      0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_left_fire_now",     0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_middle_fire_now",   0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_right_fire_now",    0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_use_melee_weapons", 0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_use_ranged_weapons",0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_use_blunt_weapons", 0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_use_any_weapon",    0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_mount",             0xFFFF00),
								(overlay_set_hilight_color,"$prsnt_tac_orders_dismount",          0xFFFF00),
								#set highlight alpha
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_hold",              0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_follow",            0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_charge",            0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_stand_ground",      0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_retreat",           0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_advance",           0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_fall_back",         0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_form_1_row",        0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_form_2_row",        0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_form_3_row",        0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_form_4_row",        0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_form_5_row",        0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_spread_out",        0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_stand_closer",      0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_hold_fire",         0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_fire_at_will",      0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_fire_at_my_command",0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_all_fire_now",      0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_left_fire_now",     0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_middle_fire_now",   0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_right_fire_now",    0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_use_melee_weapons", 0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_use_ranged_weapons",0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_use_blunt_weapons", 0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_use_any_weapon",    0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_mount",             0xFF),
								(overlay_set_hilight_alpha,"$prsnt_tac_orders_dismount",          0xFF),
								#set size
								(position_set_x,pos0,667), #66.7% of standard size
								(position_set_y,pos0,667), #66.7% of standard size
								(overlay_set_size,"$prsnt_tac_orders_hold",              pos0),
								(overlay_set_size,"$prsnt_tac_orders_follow",            pos0),
								(overlay_set_size,"$prsnt_tac_orders_charge",            pos0),
								(overlay_set_size,"$prsnt_tac_orders_stand_ground",      pos0),
								(overlay_set_size,"$prsnt_tac_orders_retreat",           pos0),
								(overlay_set_size,"$prsnt_tac_orders_advance",           pos0),
								(overlay_set_size,"$prsnt_tac_orders_fall_back",         pos0),
								(overlay_set_size,"$prsnt_tac_orders_form_1_row",        pos0),
								(overlay_set_size,"$prsnt_tac_orders_form_2_row",        pos0),
								(overlay_set_size,"$prsnt_tac_orders_form_3_row",        pos0),
								(overlay_set_size,"$prsnt_tac_orders_form_4_row",        pos0),
								(overlay_set_size,"$prsnt_tac_orders_form_5_row",        pos0),
								(overlay_set_size,"$prsnt_tac_orders_spread_out",        pos0),
								(overlay_set_size,"$prsnt_tac_orders_stand_closer",      pos0),
								(overlay_set_size,"$prsnt_tac_orders_hold_fire",         pos0),
								(overlay_set_size,"$prsnt_tac_orders_fire_at_will",      pos0),
								(overlay_set_size,"$prsnt_tac_orders_fire_at_my_command",pos0),
								(overlay_set_size,"$prsnt_tac_orders_all_fire_now",      pos0),
								(overlay_set_size,"$prsnt_tac_orders_left_fire_now",     pos0),
								(overlay_set_size,"$prsnt_tac_orders_middle_fire_now",   pos0),
								(overlay_set_size,"$prsnt_tac_orders_right_fire_now",    pos0),
								(overlay_set_size,"$prsnt_tac_orders_use_melee_weapons", pos0),
								(overlay_set_size,"$prsnt_tac_orders_use_ranged_weapons",pos0),
								(overlay_set_size,"$prsnt_tac_orders_use_blunt_weapons", pos0),
								(overlay_set_size,"$prsnt_tac_orders_use_any_weapon",    pos0),
								(overlay_set_size,"$prsnt_tac_orders_mount",             pos0),
								(overlay_set_size,"$prsnt_tac_orders_dismount",          pos0),
								#raise above bg
								(overlay_set_additional_render_height,"$prsnt_tac_orders_hold",              1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_follow",            1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_charge",            1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_stand_ground",      1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_retreat",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_advance",           1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_fall_back",         1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_form_1_row",        1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_form_2_row",        1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_form_3_row",        1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_form_4_row",        1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_form_5_row",        1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_spread_out",        1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_stand_closer",      1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_hold_fire",         1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_fire_at_will",      1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_fire_at_my_command",1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_all_fire_now",      1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_left_fire_now",     1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_middle_fire_now",   1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_right_fire_now",    1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_use_melee_weapons", 1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_use_ranged_weapons",1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_use_blunt_weapons", 1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_use_any_weapon",    1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_mount",             1),
								(overlay_set_additional_render_height,"$prsnt_tac_orders_dismount",          1),
							(try_end),
						(try_end),
					(try_end),
					(try_begin), #minimap & statistics column
						(try_begin), #minimap
							#create minimap
							(create_image_button_overlay,"$prsnt_tac_minimap","mesh_rndl_white_plane","mesh_rndl_white_plane"),
							(overlay_set_color,"$prsnt_tac_minimap",0x000000),
							(overlay_set_alpha,"$prsnt_tac_minimap",0x44), #4/15 visibility, so around 27%
							#examine scene proportions
							(get_scene_boundaries,pos1,pos0),
							(position_transform_position_to_local,pos0,pos1,pos0), #move position so that lower bound is at (0,0) - upper bound will give us scene dimensions then
							(position_get_x,":scene_wdth",pos0),
							(position_get_y,":scene_hght",pos0),
							(store_div,":scene_ratio",":scene_hght",100), #works for values bigger than 100 (fpm=1000, so scenes bigger than 0.1m) and unlike 100*height/width doesn't risk integer overflow if value is bigger than 21474836 (scene bigger than 21474.836m)
							(store_div,":scene_ratio",":scene_wdth",":scene_ratio"), #scene size is always in full meters, we will never get fractions
							#set minimap size
							(try_begin),
								(ge,":scene_ratio",100), #ratio is width/height where 100 = square, below 100 = short west-east and long north-south, above 100 = long west-east and short north-south
								(assign,"$prsnt_tac_minimap_wdth",270),
								(store_div,"$prsnt_tac_minimap_scale_x",":scene_wdth","$prsnt_tac_minimap_wdth"),
								(store_div,"$prsnt_tac_minimap_hght",":scene_hght","$prsnt_tac_minimap_scale_x"),
							(else_try),
								(assign,"$prsnt_tac_minimap_hght",270),
								(store_div,"$prsnt_tac_minimap_scale_x",":scene_hght","$prsnt_tac_minimap_hght"),
								(store_div,"$prsnt_tac_minimap_wdth",":scene_wdth","$prsnt_tac_minimap_scale_x"),
							(try_end),
							(val_mul,"$prsnt_tac_minimap_hght",100*mult_y), #prevent stretching by extending the minimap's height
							(val_div,"$prsnt_tac_minimap_hght",100), #doing it in 2 steps to avoid rounding errors
							(store_mul,"$prsnt_tac_minimap_scale_y","$prsnt_tac_minimap_scale_x",100), #y scale of the minimap needs a stretching fix too
							(val_div,"$prsnt_tac_minimap_scale_y",100*mult_y),
							#the approach is to keep the width unchanged and on wide screens extend the minimap down to undo stretching - this solution is not designed for *extremely* wide screens, but should somehow manage even at screen ratio 21:9
							(store_add,":minimap_mesh_scale_x","$prsnt_tac_minimap_wdth",10*2), #add some padding so agents don't appear at the very edge of the minimap - let's use 10 for each edge (scene boundaries are smaller than actual scene anyway - engine makes 24 meters on each edge unaccessible)
							(store_add,":minimap_mesh_scale_y","$prsnt_tac_minimap_hght",10*2*mult_y), #same as above, but also a fix for stretching
							(position_set_x,pos0,":minimap_mesh_scale_x"),
							(position_set_y,pos0,":minimap_mesh_scale_y"),
							(overlay_set_size,"$prsnt_tac_minimap",pos0),
							#set minimap position
							(store_div,":half_of_minimap_wdth","$prsnt_tac_minimap_wdth",2),
							(store_div,":half_of_minimap_hght","$prsnt_tac_minimap_hght",2),
							(store_sub,":minimap_pos_x",1000-(10+290/2+10),       ":half_of_minimap_wdth"), #10 units margin from the right screen edge, minimap center-aligned in the remaining space, 10 units of minimap border
							(store_sub,":minimap_pos_y", 750-(10+290/2+10)*mult_y,":half_of_minimap_hght"), #10 units margin from the right screen edge, minimap center-aligned in the remaining space, 10 units of minimap border (all of that with fixes for stretching)
							(position_set_x,pos0,":minimap_pos_x"),
							(position_set_y,pos0,":minimap_pos_y"),
							(overlay_set_position,"$prsnt_tac_minimap",pos0),
							#create minimap flags
							(create_mesh_overlay,"$prsnt_tac_minimap_flag_infantry",   "mesh_flag_infantry"),
							(create_mesh_overlay,"$prsnt_tac_minimap_flag_shooters",   "mesh_flag_archers"),
							(create_mesh_overlay,"$prsnt_tac_minimap_flag_cavalry",    "mesh_flag_cavalry"),
							(create_mesh_overlay,"$prsnt_tac_minimap_flag_skirmishers","mesh_flag_skirmishers"),
							(position_set_x,pos0,1000*mult_x), #fix for stretching
							(position_set_y,pos0,1000),
							(overlay_set_size,"$prsnt_tac_minimap_flag_infantry",   pos0),
							(overlay_set_size,"$prsnt_tac_minimap_flag_shooters",   pos0),
							(overlay_set_size,"$prsnt_tac_minimap_flag_cavalry",    pos0),
							(overlay_set_size,"$prsnt_tac_minimap_flag_skirmishers",pos0),
						(try_end),
						(try_begin), #statistics
							#background
							(create_mesh_overlay,"$prsnt_tac_statistics_bg","mesh_rndl_white_plane"),
							(overlay_set_color,"$prsnt_tac_statistics_bg",0x000000),
							(position_set_x,pos0,290), #290 is max width of the padded minimap, we should match it
							(try_begin), #battle with allies
								(party_is_active,"$g_ally_party"),
								(assign,":hght",30*4), #4 rows - header, us, allies, enemies
							(else_try), #battle without allies
								(assign,":hght",30*3), #3 rows - header, us, enemies
							(try_end),
							(position_set_y,pos0,":hght"),
							(overlay_set_size,"$prsnt_tac_statistics_bg",pos0),
							(assign,":pos_x",1000-(10+290)), #10 units of margin from screen edge, 290 is map max width, another 10 units is a gap between minimap and statistics
							(assign,":pos_y", 750-(10+290+10)*mult_y), #10 units of margin from screen edge, 290 is map max width, another 10 units is a gap between minimap and statistics (both with fixes for stretching)
							(val_sub,":pos_y",":hght"), #down by height value because we are positioning based on bottom edge of the rectangle
							(position_set_x,pos0,":pos_x"),
							(position_set_y,pos0,":pos_y"),
							(overlay_set_position,"$prsnt_tac_statistics_bg",pos0),
							(overlay_set_color,"$prsnt_tac_statistics_bg",0x1166BB),
							(overlay_set_alpha,"$prsnt_tac_statistics_bg",0x44), #4/15 visibility, so around 27%
							#create labels and values
							(create_text_overlay,"$prsnt_tac_statistics_label_us",          "@Us",tf_right_align),
							(create_text_overlay,"$prsnt_tac_statistics_label_allies",  "@Allies",tf_right_align),
							(create_text_overlay,"$prsnt_tac_statistics_label_enemies","@Enemies",tf_right_align),
							(create_text_overlay,"$prsnt_tac_statistics_label_ready",    "@Ready",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_label_wounded","@Wounded",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_label_routed",  "@Routed",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_label_dead",      "@Dead",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_us_ready",         "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_us_wounded",       "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_us_routed",        "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_us_dead",          "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_enemies_ready",    "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_enemies_wounded",  "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_enemies_routed",   "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_enemies_dead",     "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_allies_ready",     "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_allies_wounded",   "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_allies_routed",    "@{!}",tf_center_justify),
							(create_text_overlay,"$prsnt_tac_statistics_allies_dead",      "@{!}",tf_center_justify),
							#raise above background for better visibility
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_label_us",       1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_label_allies",   1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_label_enemies",  1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_label_ready",    1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_label_wounded",  1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_label_routed",   1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_label_dead",     1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_us_ready",       1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_us_wounded",     1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_us_routed",      1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_us_dead",        1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_enemies_ready",  1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_enemies_wounded",1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_enemies_routed", 1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_enemies_dead",   1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_allies_ready",   1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_allies_wounded", 1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_allies_routed",  1),
							(overlay_set_additional_render_height,"$prsnt_tac_statistics_allies_dead",    1),
							#set size
							(position_set_x,pos0,750), #75% of standard size
							(position_set_y,pos0,750), #75% of standard size
							(overlay_set_size,"$prsnt_tac_statistics_label_us",       pos0),
							(overlay_set_size,"$prsnt_tac_statistics_label_allies",   pos0),
							(overlay_set_size,"$prsnt_tac_statistics_label_enemies",  pos0),
							(overlay_set_size,"$prsnt_tac_statistics_label_ready",    pos0),
							(overlay_set_size,"$prsnt_tac_statistics_label_wounded",  pos0),
							(overlay_set_size,"$prsnt_tac_statistics_label_dead",     pos0),
							(overlay_set_size,"$prsnt_tac_statistics_label_routed",   pos0),
							(overlay_set_size,"$prsnt_tac_statistics_us_ready",       pos0),
							(overlay_set_size,"$prsnt_tac_statistics_us_wounded",     pos0),
							(overlay_set_size,"$prsnt_tac_statistics_us_routed",      pos0),
							(overlay_set_size,"$prsnt_tac_statistics_us_dead",        pos0),
							(overlay_set_size,"$prsnt_tac_statistics_enemies_ready",  pos0),
							(overlay_set_size,"$prsnt_tac_statistics_enemies_wounded",pos0),
							(overlay_set_size,"$prsnt_tac_statistics_enemies_routed", pos0),
							(overlay_set_size,"$prsnt_tac_statistics_enemies_dead",   pos0),
							(overlay_set_size,"$prsnt_tac_statistics_allies_ready",   pos0),
							(overlay_set_size,"$prsnt_tac_statistics_allies_wounded", pos0),
							(overlay_set_size,"$prsnt_tac_statistics_allies_routed",  pos0),
							(overlay_set_size,"$prsnt_tac_statistics_allies_dead",    pos0),
							#set positions
							#if all 5 columns were center-aligned, first should be at pos_x+32, then +64 for each after
							(val_add,":pos_x",29+28), #this one is right-aligned, +30 to compensate
							(position_set_x,pos0,":pos_x"),
							(val_add,":pos_x",58-28+3), #-30 to undo +30 earlier, +9 to compensate for space taken by right-aligned column left of it
							(position_set_x,pos1,":pos_x"),
							(val_add,":pos_x",58-1), #-3 to compensate for 1/3 of that +9 earlier
							(position_set_x,pos2,":pos_x"),
							(val_add,":pos_x",58-1), #-3 to compensate for 1/3 of that +9 earlier
							(position_set_x,pos3,":pos_x"),
							(val_add,":pos_x",58-1), #-3 to compensate for 1/3 of that +9 earlier
							(position_set_x,pos4,":pos_x"),
							(val_add,":pos_y",5), #margin of 5 from the bottom edge of the background
							(position_set_y,pos0,":pos_y"),
							(position_set_y,pos1,":pos_y"),
							(position_set_y,pos2,":pos_y"),
							(position_set_y,pos3,":pos_y"),
							(position_set_y,pos4,":pos_y"),
							(overlay_set_position,"$prsnt_tac_statistics_label_enemies",  pos0),
							(overlay_set_position,"$prsnt_tac_statistics_enemies_ready",  pos1),
							(overlay_set_position,"$prsnt_tac_statistics_enemies_wounded",pos2),
							(overlay_set_position,"$prsnt_tac_statistics_enemies_routed", pos3),
							(overlay_set_position,"$prsnt_tac_statistics_enemies_dead",   pos4),
							(try_begin), #battle with allies
								(party_is_active,"$g_ally_party"),
								(val_add,":pos_y",30), #space of 30 between rows
								(position_set_y,pos0,":pos_y"),
								(position_set_y,pos1,":pos_y"),
								(position_set_y,pos2,":pos_y"),
								(position_set_y,pos3,":pos_y"),
								(position_set_y,pos4,":pos_y"),
								(overlay_set_position,"$prsnt_tac_statistics_label_allies",  pos0),
								(overlay_set_position,"$prsnt_tac_statistics_allies_ready",  pos1),
								(overlay_set_position,"$prsnt_tac_statistics_allies_wounded",pos2),
								(overlay_set_position,"$prsnt_tac_statistics_allies_routed", pos3),
								(overlay_set_position,"$prsnt_tac_statistics_allies_dead",   pos4),
							(else_try), #battle without allies
								(overlay_set_display,"$prsnt_tac_statistics_label_allies",  0),
								(overlay_set_display,"$prsnt_tac_statistics_allies_ready",  0),
								(overlay_set_display,"$prsnt_tac_statistics_allies_wounded",0),
								(overlay_set_display,"$prsnt_tac_statistics_allies_routed", 0),
								(overlay_set_display,"$prsnt_tac_statistics_allies_dead",   0),
							(try_end),
							(val_add,":pos_y",30), #space of 30 between rows
							(position_set_y,pos0,":pos_y"),
							(position_set_y,pos1,":pos_y"),
							(position_set_y,pos2,":pos_y"),
							(position_set_y,pos3,":pos_y"),
							(position_set_y,pos4,":pos_y"),
							(overlay_set_position,"$prsnt_tac_statistics_label_us",  pos0),
							(overlay_set_position,"$prsnt_tac_statistics_us_ready",  pos1),
							(overlay_set_position,"$prsnt_tac_statistics_us_wounded",pos2),
							(overlay_set_position,"$prsnt_tac_statistics_us_routed", pos3),
							(overlay_set_position,"$prsnt_tac_statistics_us_dead",   pos4),
							(val_add,":pos_y",30), #space of 30 between rows
							(position_set_y,pos1,":pos_y"),
							(position_set_y,pos2,":pos_y"),
							(position_set_y,pos3,":pos_y"),
							(position_set_y,pos4,":pos_y"),
							(overlay_set_position,"$prsnt_tac_statistics_label_ready",  pos1),
							(overlay_set_position,"$prsnt_tac_statistics_label_wounded",pos2),
							(overlay_set_position,"$prsnt_tac_statistics_label_routed", pos3),
							(overlay_set_position,"$prsnt_tac_statistics_label_dead",   pos4),
						(try_end),
					(try_end),
					#position the overlays and set their values
					(try_for_agents,":agent"),
						(agent_set_slot,":agent",slot_agent_map_overlay_id,0), #could be old data from previous launch of the overlay
					(try_end),
					(call_script,"script_tactical_overlay_update"), #overall overlay refresh that also gets called every frame
				]
			),
			(ti_on_presentation_event_state_change,
				[
					(store_trigger_param,":object",1),
					(assign,":update_listeners",0),
					(try_begin), #minimap - give hold position order in clicked location to selected divisions
						(eq,":object","$prsnt_tac_minimap"),
						#calculate position
						(set_fixed_point_multiplier,1000),
						(mouse_get_position,pos0),
						(call_script,"script_tactical_overlay_convert_minimap_pos_to_scene_pos",pos0),
						#give the order
						(call_script,"script_tactical_overlay_give_order",mordr_hold,pos0),
					(else_try), #order buttons
						(eq,":object","$prsnt_tac_orders_hold"              ),(call_script,"script_tactical_overlay_give_order",mordr_hold,              -1),(else_try), #for mordr_hold -1 means "use player position"
						(eq,":object","$prsnt_tac_orders_follow"            ),(call_script,"script_tactical_overlay_give_order",mordr_follow,            -1),(else_try), #for other orders the last parameter is irrelevant
						(eq,":object","$prsnt_tac_orders_charge"            ),(call_script,"script_tactical_overlay_give_order",mordr_charge,            -1),(else_try),
						(eq,":object","$prsnt_tac_orders_stand_ground"      ),(call_script,"script_tactical_overlay_give_order",mordr_stand_ground,      -1),(else_try),
						(eq,":object","$prsnt_tac_orders_retreat"           ),(call_script,"script_tactical_overlay_give_order",mordr_retreat,           -1),(else_try),
						(eq,":object","$prsnt_tac_orders_advance"           ),(call_script,"script_tactical_overlay_give_order",mordr_advance,           -1),(else_try),
						(eq,":object","$prsnt_tac_orders_fall_back"         ),(call_script,"script_tactical_overlay_give_order",mordr_fall_back,         -1),(else_try),
						(eq,":object","$prsnt_tac_orders_form_1_row"        ),(call_script,"script_tactical_overlay_give_order",mordr_form_1_row,        -1),(else_try),
						(eq,":object","$prsnt_tac_orders_form_2_row"        ),(call_script,"script_tactical_overlay_give_order",mordr_form_2_row,        -1),(else_try),
						(eq,":object","$prsnt_tac_orders_form_3_row"        ),(call_script,"script_tactical_overlay_give_order",mordr_form_3_row,        -1),(else_try),
						(eq,":object","$prsnt_tac_orders_form_4_row"        ),(call_script,"script_tactical_overlay_give_order",mordr_form_4_row,        -1),(else_try),
						(eq,":object","$prsnt_tac_orders_form_5_row"        ),(call_script,"script_tactical_overlay_give_order",mordr_form_5_row,        -1),(else_try),
						(eq,":object","$prsnt_tac_orders_spread_out"        ),(call_script,"script_tactical_overlay_give_order",mordr_spread_out,        -1),(else_try),
						(eq,":object","$prsnt_tac_orders_stand_closer"      ),(call_script,"script_tactical_overlay_give_order",mordr_stand_closer,      -1),(else_try),
						(eq,":object","$prsnt_tac_orders_hold_fire"         ),(call_script,"script_tactical_overlay_give_order",mordr_hold_fire,         -1),(else_try),
						(eq,":object","$prsnt_tac_orders_fire_at_will"      ),(call_script,"script_tactical_overlay_give_order",mordr_fire_at_will,      -1),(else_try),
						(eq,":object","$prsnt_tac_orders_fire_at_my_command"),(call_script,"script_tactical_overlay_give_order",mordr_fire_at_my_command,-1),(else_try),
						(eq,":object","$prsnt_tac_orders_all_fire_now"      ),(call_script,"script_tactical_overlay_give_order",mordr_all_fire_now,      -1),(else_try),
						(eq,":object","$prsnt_tac_orders_left_fire_now"     ),(call_script,"script_tactical_overlay_give_order",mordr_left_fire_now,     -1),(else_try),
						(eq,":object","$prsnt_tac_orders_middle_fire_now"   ),(call_script,"script_tactical_overlay_give_order",mordr_middle_fire_now,   -1),(else_try),
						(eq,":object","$prsnt_tac_orders_right_fire_now"    ),(call_script,"script_tactical_overlay_give_order",mordr_right_fire_now,    -1),(else_try),
						(eq,":object","$prsnt_tac_orders_use_melee_weapons" ),(call_script,"script_tactical_overlay_give_order",mordr_use_melee_weapons, -1),(else_try),
						(eq,":object","$prsnt_tac_orders_use_ranged_weapons"),(call_script,"script_tactical_overlay_give_order",mordr_use_ranged_weapons,-1),(else_try),
						(eq,":object","$prsnt_tac_orders_use_blunt_weapons" ),(call_script,"script_tactical_overlay_give_order",mordr_use_blunt_weapons, -1),(else_try),
						(eq,":object","$prsnt_tac_orders_use_any_weapon"    ),(call_script,"script_tactical_overlay_give_order",mordr_use_any_weapon,    -1),(else_try),
						(eq,":object","$prsnt_tac_orders_mount"             ),(call_script,"script_tactical_overlay_give_order",mordr_mount,             -1),(else_try),
						(eq,":object","$prsnt_tac_orders_dismount"          ),(call_script,"script_tactical_overlay_give_order",mordr_dismount,          -1),
					(else_try), #division checkboxes (selects/unselects that one division)
						#variables for division checkboxes and also division backgrounds
						(assign,":d1","$prsnt_tac_div1_is_selected"),
						(assign,":d2","$prsnt_tac_div2_is_selected"),
						(assign,":d3","$prsnt_tac_div3_is_selected"),
						(assign,":d4","$prsnt_tac_div4_is_selected"),
						(assign,":d5","$prsnt_tac_div5_is_selected"),
						(assign,":d6","$prsnt_tac_div6_is_selected"),
						(assign,":d7","$prsnt_tac_div7_is_selected"),
						(assign,":d8","$prsnt_tac_div8_is_selected"),
						(assign,":d9","$prsnt_tac_div9_is_selected"),
						(eq,":object","$prsnt_tac_div1_checkbox"),(assign,":update_listeners",1),(val_add,":d1",1),(val_mod,":d1",2),(else_try), #can't just use 2nd trigger_param, because the update script running every frame keeps interfering
						(eq,":object","$prsnt_tac_div2_checkbox"),(assign,":update_listeners",1),(val_add,":d2",1),(val_mod,":d2",2),(else_try), #so instead gotta just flip the selection we had stored before
						(eq,":object","$prsnt_tac_div3_checkbox"),(assign,":update_listeners",1),(val_add,":d3",1),(val_mod,":d3",2),(else_try),
						(eq,":object","$prsnt_tac_div4_checkbox"),(assign,":update_listeners",1),(val_add,":d4",1),(val_mod,":d4",2),(else_try),
						(eq,":object","$prsnt_tac_div5_checkbox"),(assign,":update_listeners",1),(val_add,":d5",1),(val_mod,":d5",2),(else_try),
						(eq,":object","$prsnt_tac_div6_checkbox"),(assign,":update_listeners",1),(val_add,":d6",1),(val_mod,":d6",2),(else_try),
						(eq,":object","$prsnt_tac_div7_checkbox"),(assign,":update_listeners",1),(val_add,":d7",1),(val_mod,":d7",2),(else_try),
						(eq,":object","$prsnt_tac_div8_checkbox"),(assign,":update_listeners",1),(val_add,":d8",1),(val_mod,":d8",2),(else_try),
						(eq,":object","$prsnt_tac_div9_checkbox"),(assign,":update_listeners",1),(val_add,":d9",1),(val_mod,":d9",2),
					(else_try), #division backgrounds (limits selection to that one division)
						(eq,":object","$prsnt_tac_div1_bg"),(assign,":update_listeners",1),(assign,":d1",1),(assign,":d2",0),(assign,":d3",0),(assign,":d4",0),(assign,":d5",0),(assign,":d6",0),(assign,":d7",0),(assign,":d8",0),(assign,":d9",0),(else_try),
						(eq,":object","$prsnt_tac_div2_bg"),(assign,":update_listeners",1),(assign,":d1",0),(assign,":d2",1),(assign,":d3",0),(assign,":d4",0),(assign,":d5",0),(assign,":d6",0),(assign,":d7",0),(assign,":d8",0),(assign,":d9",0),(else_try),
						(eq,":object","$prsnt_tac_div3_bg"),(assign,":update_listeners",1),(assign,":d1",0),(assign,":d2",0),(assign,":d3",1),(assign,":d4",0),(assign,":d5",0),(assign,":d6",0),(assign,":d7",0),(assign,":d8",0),(assign,":d9",0),(else_try),
						(eq,":object","$prsnt_tac_div4_bg"),(assign,":update_listeners",1),(assign,":d1",0),(assign,":d2",0),(assign,":d3",0),(assign,":d4",1),(assign,":d5",0),(assign,":d6",0),(assign,":d7",0),(assign,":d8",0),(assign,":d9",0),(else_try),
						(eq,":object","$prsnt_tac_div5_bg"),(assign,":update_listeners",1),(assign,":d1",0),(assign,":d2",0),(assign,":d3",0),(assign,":d4",0),(assign,":d5",1),(assign,":d6",0),(assign,":d7",0),(assign,":d8",0),(assign,":d9",0),(else_try),
						(eq,":object","$prsnt_tac_div6_bg"),(assign,":update_listeners",1),(assign,":d1",0),(assign,":d2",0),(assign,":d3",0),(assign,":d4",0),(assign,":d5",0),(assign,":d6",1),(assign,":d7",0),(assign,":d8",0),(assign,":d9",0),(else_try),
						(eq,":object","$prsnt_tac_div7_bg"),(assign,":update_listeners",1),(assign,":d1",0),(assign,":d2",0),(assign,":d3",0),(assign,":d4",0),(assign,":d5",0),(assign,":d6",0),(assign,":d7",1),(assign,":d8",0),(assign,":d9",0),(else_try),
						(eq,":object","$prsnt_tac_div8_bg"),(assign,":update_listeners",1),(assign,":d1",0),(assign,":d2",0),(assign,":d3",0),(assign,":d4",0),(assign,":d5",0),(assign,":d6",0),(assign,":d7",0),(assign,":d8",1),(assign,":d9",0),(else_try),
						(eq,":object","$prsnt_tac_div9_bg"),(assign,":update_listeners",1),(assign,":d1",0),(assign,":d2",0),(assign,":d3",0),(assign,":d4",0),(assign,":d5",0),(assign,":d6",0),(assign,":d7",0),(assign,":d8",0),(assign,":d9",1),
					(try_end),
					(try_begin),
						(eq,":update_listeners",1),
						(get_player_agent_no,":player_agent"),
						(agent_get_team,":player_team",":player_agent"),
						(set_show_messages,0),
						(team_set_order_listener,":player_team",-1),
						(try_begin), #everyone is when each division...
							#  is either selected,    or doesn't count because it has no troops
							(this_or_next|eq,":d1",1),(eq,"$prsnt_tac_div1_has_troops",0),
							(this_or_next|eq,":d2",1),(eq,"$prsnt_tac_div2_has_troops",0),
							(this_or_next|eq,":d3",1),(eq,"$prsnt_tac_div3_has_troops",0),
							(this_or_next|eq,":d4",1),(eq,"$prsnt_tac_div4_has_troops",0),
							(this_or_next|eq,":d5",1),(eq,"$prsnt_tac_div5_has_troops",0),
							(this_or_next|eq,":d6",1),(eq,"$prsnt_tac_div6_has_troops",0),
							(this_or_next|eq,":d7",1),(eq,"$prsnt_tac_div7_has_troops",0),
							(this_or_next|eq,":d8",1),(eq,"$prsnt_tac_div8_has_troops",0),
							(this_or_next|eq,":d9",1),(eq,"$prsnt_tac_div9_has_troops",0),
							(team_set_order_listener,":player_team",grc_everyone),
						(else_try), #selected divisions (add to listeners)
							(try_begin),(eq,":d1",1),(team_set_order_listener,":player_team",grd_1,1),(try_end),
							(try_begin),(eq,":d2",1),(team_set_order_listener,":player_team",grd_2,1),(try_end),
							(try_begin),(eq,":d3",1),(team_set_order_listener,":player_team",grd_3,1),(try_end),
							(try_begin),(eq,":d4",1),(team_set_order_listener,":player_team",grd_4,1),(try_end),
							(try_begin),(eq,":d5",1),(team_set_order_listener,":player_team",grd_5,1),(try_end),
							(try_begin),(eq,":d6",1),(team_set_order_listener,":player_team",grd_6,1),(try_end),
							(try_begin),(eq,":d7",1),(team_set_order_listener,":player_team",grd_7,1),(try_end),
							(try_begin),(eq,":d8",1),(team_set_order_listener,":player_team",grd_8,1),(try_end),
							(try_begin),(eq,":d9",1),(team_set_order_listener,":player_team",grd_9,1),(try_end),
						(try_end),
						(set_show_messages,1),
					(try_end),
				]
			),
			(ti_on_presentation_mouse_enter_leave,
				[
					(store_trigger_param,":overlay",1),
					(store_trigger_param,":is_leaving",2),
					(try_begin), #highlight division 1 row
						(eq,":overlay","$prsnt_tac_div1_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div1_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div1_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div1_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div1_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div1_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div1_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div1_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div1_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div1_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div1_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div1_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div1_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight division 2 row
						(eq,":overlay","$prsnt_tac_div2_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div2_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div2_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div2_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div2_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div2_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div2_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div2_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div2_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div2_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div2_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div2_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div2_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight division 3 row
						(eq,":overlay","$prsnt_tac_div3_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div3_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div3_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div3_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div3_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div3_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div3_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div3_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div3_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div3_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div3_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div3_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div3_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight division 4 row
						(eq,":overlay","$prsnt_tac_div4_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div4_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div4_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div4_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div4_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div4_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div4_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div4_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div4_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div4_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div4_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div4_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div4_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight division 5 row
						(eq,":overlay","$prsnt_tac_div5_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div5_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div5_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div5_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div5_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div5_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div5_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div5_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div5_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div5_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div5_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div5_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div5_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight division 6 row
						(eq,":overlay","$prsnt_tac_div6_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div6_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div6_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div6_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div6_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div6_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div6_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div6_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div6_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div6_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div6_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div6_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div6_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight division 7 row
						(eq,":overlay","$prsnt_tac_div7_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div7_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div7_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div7_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div7_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div7_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div7_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div7_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div7_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div7_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div7_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div7_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div7_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight division 8 row
						(eq,":overlay","$prsnt_tac_div8_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div8_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div8_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div8_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div8_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div8_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div8_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div8_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div8_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div8_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div8_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div8_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div8_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight division 9 row
						(eq,":overlay","$prsnt_tac_div9_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_div9_bg",                 250,0x66), #6/15 = 40% (darken the background)
							(overlay_animate_to_color,"$prsnt_tac_div9_name_and_count",     250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div9_order_status_action",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div9_order_status_firing",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div9_order_status_weapon",250,0xFFFFFF),
							(overlay_animate_to_color,"$prsnt_tac_div9_order_status_riding",250,0xFFFFFF),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_div9_bg",                 250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_color,"$prsnt_tac_div9_name_and_count",     250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div9_order_status_action",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div9_order_status_firing",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div9_order_status_weapon",250,0x000000),
							(overlay_animate_to_color,"$prsnt_tac_div9_order_status_riding",250,0x000000),
						(try_end),
					(else_try), #highlight movement orders
						(eq,":overlay","$prsnt_tac_orders_movement_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_movement_bg",   250,0x66), #6/15 ≈ 40% (back to normal)
							(try_begin), #advanced orders
								(eq,module_ini["use_advanced_formation"],1),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_hold",        250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_follow",      250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_charge",      250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_stand_ground",250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_retreat",     250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_advance",     250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fall_back",   250,0xFF),
							(else_try), #simple orders
								(overlay_animate_to_alpha,"$prsnt_tac_orders_hold",        250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_follow",      250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_charge",      250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_stand_ground",250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_retreat",     250,0xFF),
							(try_end),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_orders_movement_bg",   250,0x22), #2/15 ≈ 13% (back to normal)
							(try_begin), #advanced orders
								(eq,module_ini["use_advanced_formation"],1),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_hold",        250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_follow",      250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_charge",      250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_stand_ground",250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_retreat",     250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_advance",     250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fall_back",   250,0x99),
							(else_try), #simple orders
								(overlay_animate_to_alpha,"$prsnt_tac_orders_hold",        250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_follow",      250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_charge",      250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_stand_ground",250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_retreat",     250,0x99),
							(try_end),
						(try_end),
					(else_try), #highlight formation orders
						(eq,":overlay","$prsnt_tac_orders_formation_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_formation_bg",  250,0x66), #6/15 ≈ 40% (back to normal)
							(try_begin), #advanced orders
								(eq,module_ini["use_advanced_formation"],1),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_1_row",  250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_2_row",  250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_3_row",  250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_4_row",  250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_5_row",  250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_spread_out",  250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_stand_closer",250,0xFF),
							(else_try), #simple orders
								(overlay_animate_to_alpha,"$prsnt_tac_orders_advance",     250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fall_back",   250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_spread_out",  250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_stand_closer",250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_mount",       250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_dismount",    250,0xFF),
							(try_end),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_orders_formation_bg",  250,0x22), #2/15 ≈ 13% (back to normal)
							(try_begin), #advanced orders
								(eq,module_ini["use_advanced_formation"],1),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_1_row",  250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_2_row",  250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_3_row",  250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_4_row",  250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_form_5_row",  250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_spread_out",  250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_stand_closer",250,0x99),
							(else_try), #simple orders
								(overlay_animate_to_alpha,"$prsnt_tac_orders_advance",     250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fall_back",   250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_spread_out",  250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_stand_closer",250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_mount",       250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_dismount",    250,0x99),
							(try_end),
						(try_end),
					(else_try), #highlight firing orders
						(eq,":overlay","$prsnt_tac_orders_firing_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_firing_bg",           250,0x66), #6/15 ≈ 40% (back to normal)
							(try_begin), #advanced orders
								(eq,module_ini["use_advanced_formation"],1),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fire_at_will",      250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fire_at_my_command",250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_all_fire_now",      250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_left_fire_now",     250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_middle_fire_now",   250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_right_fire_now",    250,0xFF),
							(else_try), #simple orders
								(overlay_animate_to_alpha,"$prsnt_tac_orders_hold_fire",         250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fire_at_will",      250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_use_blunt_weapons", 250,0xFF),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_use_any_weapon",    250,0xFF),
							(try_end),
						(else_try), #mouse leaving
							(overlay_animate_to_alpha,"$prsnt_tac_orders_firing_bg",           250,0x22), #2/15 ≈ 13% (back to normal)
							(try_begin), #advanced orders
								(eq,module_ini["use_advanced_formation"],1),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fire_at_will",      250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fire_at_my_command",250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_all_fire_now",      250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_left_fire_now",     250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_middle_fire_now",   250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_right_fire_now",    250,0x99),
							(else_try), #simple orders
								(overlay_animate_to_alpha,"$prsnt_tac_orders_hold_fire",         250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_fire_at_will",      250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_use_blunt_weapons", 250,0x99),
								(overlay_animate_to_alpha,"$prsnt_tac_orders_use_any_weapon",    250,0x99),
							(try_end),
						(try_end),
					(else_try), #highlight equipment orders
						(eq,":overlay","$prsnt_tac_orders_equipment_bg"),
						(try_begin), #mouse entering
							(eq,":is_leaving",0),
							#no variants for simple/advanced orders - this bg doesn't show in simple mode
							(overlay_animate_to_alpha,"$prsnt_tac_orders_equipment_bg",      250,0x66), #6/15 ≈ 40% (back to normal)
							(overlay_animate_to_alpha,"$prsnt_tac_orders_use_melee_weapons", 250,0xFF),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_use_ranged_weapons",250,0xFF),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_use_blunt_weapons", 250,0xFF),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_use_any_weapon",    250,0xFF),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_mount",             250,0xFF),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_dismount",          250,0xFF),
						(else_try), #mouse leaving
							#no variants for simple/advanced orders - this bg doesn't show in simple mode
							(overlay_animate_to_alpha,"$prsnt_tac_orders_equipment_bg",      250,0x22), #2/15 ≈ 13% (back to normal)
							(overlay_animate_to_alpha,"$prsnt_tac_orders_use_melee_weapons", 250,0x99),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_use_ranged_weapons",250,0x99),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_use_blunt_weapons", 250,0x99),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_use_any_weapon",    250,0x99),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_mount",             250,0x99),
							(overlay_animate_to_alpha,"$prsnt_tac_orders_dismount",          250,0x99),
						(try_end),
					(try_end),
				]
			),
			(ti_on_presentation_run,
				[
					(try_begin),
						(eq,"$prsnt_tac_stop",1),
						(presentation_set_duration,0),
					(else_try),
						(call_script,"script_tactical_overlay_update"),
					(try_end),
				]
			),
		]
	),

 

To module_scripts.py:

	("tactical_overlay_update", #updates all elements of the tactical overlay - called at presentation load to position the elements and set their values, and later every frame to reflect the current situation
		#input: none
		#output: none
		[
			(set_fixed_point_multiplier,1000),
			(try_begin), #collect agent data (and update agent dots on the minimap if needed)
				(assign,"$prsnt_tac_div1_has_troops",0),
				(assign,"$prsnt_tac_div2_has_troops",0),
				(assign,"$prsnt_tac_div3_has_troops",0),
				(assign,"$prsnt_tac_div4_has_troops",0),
				(assign,"$prsnt_tac_div5_has_troops",0),
				(assign,"$prsnt_tac_div6_has_troops",0),
				(assign,"$prsnt_tac_div7_has_troops",0),
				(assign,"$prsnt_tac_div8_has_troops",0),
				(assign,"$prsnt_tac_div9_has_troops",0),
				(assign,":num_us_ready_div1",  0),
				(assign,":num_us_ready_div2",  0),
				(assign,":num_us_ready_div3",  0),
				(assign,":num_us_ready_div4",  0),
				(assign,":num_us_ready_div5",  0),
				(assign,":num_us_ready_div6",  0),
				(assign,":num_us_ready_div7",  0),
				(assign,":num_us_ready_div8",  0),
				(assign,":num_us_ready_div9",  0),
				(assign,":num_us_ready",       0),
				(assign,":num_us_wounded",     0),
				(assign,":num_us_routed",      0),
				(assign,":num_us_dead",        0),
				(assign,":num_allies_ready",   0),
				(assign,":num_allies_wounded", 0),
				(assign,":num_allies_routed",  0),
				(assign,":num_allies_dead",    0),
				(assign,":num_enemies_ready",  0),
				(assign,":num_enemies_wounded",0),
				(assign,":num_enemies_routed", 0),
				(assign,":num_enemies_dead",   0),
				(get_player_agent_no,":player_agent"),
				(agent_get_team,":player_team",":player_agent"),
				(try_for_agents,":cur_agent"),
					(agent_is_human,":cur_agent"),
					(agent_get_slot,":agent_overlay",":cur_agent",slot_agent_map_overlay_id),
					(agent_get_party_id,":agent_party",":cur_agent"),
					(try_begin), #hide minimap dot
						(neg|agent_is_alive,":cur_agent"),
						(overlay_set_display,":agent_overlay",0),
					(else_try), #update minimap dot
						#create agent's minimap dot if it doesn't exist
						(try_begin),
							(le,":agent_overlay",0),
							(try_begin), #player's minimap dot
								(eq,":cur_agent",":player_agent"),
								(create_mesh_overlay,":agent_overlay","mesh_player_dot"),
								(position_set_x,pos0,500),
								(position_set_y,pos0,500),
								(overlay_set_size,":agent_overlay",pos0),
							(else_try), #npc's minimap dot
								(create_mesh_overlay,":agent_overlay","mesh_white_dot"),
								(position_set_x,pos0,200),
								(position_set_y,pos0,200),
								(overlay_set_size,":agent_overlay",pos0),
								(try_begin),
									(eq,":agent_party","p_main_party"),
									(agent_get_division,":agent_division",":cur_agent"),
									(try_begin),
										(eq,":agent_division",grd_1),(overlay_set_color,":agent_overlay",0x8D5220),(else_try),
										(eq,":agent_division",grd_2),(overlay_set_color,":agent_overlay",0x34C6E4),(else_try),
										(eq,":agent_division",grd_3),(overlay_set_color,":agent_overlay",0x569619),(else_try),
										(eq,":agent_division",grd_4),(overlay_set_color,":agent_overlay",0xFFE500),(else_try),
										(eq,":agent_division",grd_5),(overlay_set_color,":agent_overlay",0x990099),(else_try),
										(eq,":agent_division",grd_6),(overlay_set_color,":agent_overlay",0x99FE80),(else_try),
										(eq,":agent_division",grd_7),(overlay_set_color,":agent_overlay",0x9DEFFE),(else_try),
										(eq,":agent_division",grd_8),(overlay_set_color,":agent_overlay",0xFECB9D),(else_try),
										(eq,":agent_division",grd_9),(overlay_set_color,":agent_overlay",0xB19C9C),
									(try_end),
								(else_try),
									(agent_is_ally,":cur_agent"),
									(overlay_set_color,":agent_overlay",0x5555FF),
								(else_try),
									(overlay_set_color,":agent_overlay",0xFF0000),
								(try_end),
							(try_end),
							(agent_set_slot,":cur_agent",slot_agent_map_overlay_id,":agent_overlay"),
						(try_end),
						#update player dot's rotation
						(try_begin),
							(eq,":cur_agent",":player_agent"),
							(agent_get_look_position,pos0,":cur_agent"),
							(position_get_rotation_around_z,":rot",pos0),
							(init_position,pos0),
							(position_rotate_z,pos0,":rot"),
							(overlay_set_mesh_rotation,":agent_overlay",pos0),
						(try_end),
						#update dot's position
						(agent_get_position,pos0,":cur_agent"),
						(call_script,"script_tactical_overlay_convert_scene_pos_to_minimap_pos",pos0),
						(overlay_set_position,":agent_overlay",pos0),
					(try_end),
					(try_begin), #us
						(eq,":agent_party","p_main_party"),
						(try_begin),
							(agent_is_alive,":cur_agent"),
							(val_add,":num_us_ready",1),
							(try_begin),
								(eq,":cur_agent",":player_agent"),(else_try), #don't count player into divisions
								(agent_get_division,":agent_division",":cur_agent"),
								(eq,":agent_division",grd_1),(val_add,":num_us_ready_div1",1),(assign,"$prsnt_tac_div1_has_troops",1),(else_try),
								(eq,":agent_division",grd_2),(val_add,":num_us_ready_div2",1),(assign,"$prsnt_tac_div2_has_troops",1),(else_try),
								(eq,":agent_division",grd_3),(val_add,":num_us_ready_div3",1),(assign,"$prsnt_tac_div3_has_troops",1),(else_try),
								(eq,":agent_division",grd_4),(val_add,":num_us_ready_div4",1),(assign,"$prsnt_tac_div4_has_troops",1),(else_try),
								(eq,":agent_division",grd_5),(val_add,":num_us_ready_div5",1),(assign,"$prsnt_tac_div5_has_troops",1),(else_try),
								(eq,":agent_division",grd_6),(val_add,":num_us_ready_div6",1),(assign,"$prsnt_tac_div6_has_troops",1),(else_try),
								(eq,":agent_division",grd_7),(val_add,":num_us_ready_div7",1),(assign,"$prsnt_tac_div7_has_troops",1),(else_try),
								(eq,":agent_division",grd_8),(val_add,":num_us_ready_div8",1),(assign,"$prsnt_tac_div8_has_troops",1),(else_try),
								(eq,":agent_division",grd_9),(val_add,":num_us_ready_div9",1),(assign,"$prsnt_tac_div9_has_troops",1),
							(try_end),
						(else_try),
							(agent_is_wounded,":cur_agent"),
							(val_add,":num_us_wounded",1),
						(else_try),
							(agent_is_routed,":cur_agent"),
							(val_add,":num_us_routed",1),
						(else_try),
							(val_add,":num_us_dead",1),
						(try_end),
					(else_try), #allies
						(agent_is_ally,":cur_agent"),
						(try_begin),
							(agent_is_alive,":cur_agent"),
							(val_add,":num_allies_ready",1),
						(else_try),
							(agent_is_wounded,":cur_agent"),
							(val_add,":num_allies_wounded",1),
						(else_try),
							(agent_is_routed,":cur_agent"),
							(val_add,":num_allies_routed",1),
						(else_try),
							(val_add,":num_allies_dead",1),
						(try_end),
					(else_try), #enemies
						(try_begin),
							(agent_is_alive,":cur_agent"),
							(val_add,":num_enemies_ready",1),
						(else_try),
							(agent_is_wounded,":cur_agent"),
							(val_add,":num_enemies_wounded",1),
						(else_try),
							(agent_is_routed,":cur_agent"),
							(val_add,":num_enemies_routed",1),
						(else_try),
							(val_add,":num_enemies_dead",1),
						(try_end),
					(try_end),
				(try_end),
			(try_end),
			(try_begin), #update divisions & orders column
				(try_begin), #initial position values
					(position_set_x,pos0, 10), #division bg
					(position_set_x,pos1, 20), #division checkbox
					(position_set_x,pos2, 38), #division name & count
					(position_set_x,pos3,265), #division order: action
					(position_set_x,pos4,399), #division order: firing
					(position_set_x,pos5,512), #division order: weapon
					(position_set_x,pos6,625), #division order: riding
					#these are initial values and are meant to point to the top of 1st displayed row, because each row has code that lowers y from height of the previous row (position_move_y doesn't use fixed point, so it's not precise enough - gotta use a variable and apply position_set_y each time)
					(assign,":bg_y",   750-25-int(round(10*mult_y))-5), #division bg (5 units gap to text of header)
					(assign,":check_y",750-25-int(round(10*mult_y))-5+10), #division checkbox (10 units higher than bottom of bg)
					(assign,":text_y", 750-25-int(round(10*mult_y))-5+5), #division name & count, orders (5 units higher than bottom of bg)
				(try_end),
				(try_begin), #rows of divisions
					(try_begin), #division 1 row - update & show
						(eq,"$prsnt_tac_div1_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div1_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div1_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div1_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div1_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div1_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div1_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div1_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_1),
							(overlay_set_val,"$prsnt_tac_div1_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div1_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div1_bg",250,0x444400),
								(assign,"$prsnt_tac_div1_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div1_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div1_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div1_bg",250,0x000000),
								(assign,"$prsnt_tac_div1_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_1),
						(assign,reg0,":num_us_ready_div1"),
						(overlay_set_text,"$prsnt_tac_div1_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_1),
						(overlay_set_text,"$prsnt_tac_div1_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div1_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div1_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div1_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div1_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div1_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div1_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div1_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div1_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div1_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div1_order_status_riding",1),
					(else_try), #division 1 row - hide
						(assign,"$prsnt_tac_div1_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div1_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div1_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div1_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div1_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div1_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div1_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div1_order_status_riding",0),
					(try_end),
					(try_begin), #division 2 row - update & show
						(eq,"$prsnt_tac_div2_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div2_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div2_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div2_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div2_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div2_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div2_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div2_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_2),
							(overlay_set_val,"$prsnt_tac_div2_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div2_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div2_bg",250,0x444400),
								(assign,"$prsnt_tac_div2_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div2_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div2_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div2_bg",250,0x000000),
								(assign,"$prsnt_tac_div2_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_2),
						(assign,reg0,":num_us_ready_div2"),
						(overlay_set_text,"$prsnt_tac_div2_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_2),
						(overlay_set_text,"$prsnt_tac_div2_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div2_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div2_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div2_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div2_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div2_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div2_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div2_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div2_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div2_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div2_order_status_riding",1),
					(else_try), #division 2 row - hide
						(assign,"$prsnt_tac_div2_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div2_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div2_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div2_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div2_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div2_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div2_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div2_order_status_riding",0),
					(try_end),
					(try_begin), #update division 3 row
						(eq,"$prsnt_tac_div3_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div3_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div3_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div3_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div3_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div3_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div3_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div3_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_3),
							(overlay_set_val,"$prsnt_tac_div3_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div3_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div3_bg",250,0x444400),
								(assign,"$prsnt_tac_div3_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div3_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div3_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div3_bg",250,0x000000),
								(assign,"$prsnt_tac_div3_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_3),
						(assign,reg0,":num_us_ready_div3"),
						(overlay_set_text,"$prsnt_tac_div3_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_3),
						(overlay_set_text,"$prsnt_tac_div3_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div3_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div3_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div3_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div3_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div3_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div3_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div3_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div3_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div3_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div3_order_status_riding",1),
					(else_try), #division 3 row - hide
						(assign,"$prsnt_tac_div3_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div3_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div3_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div3_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div3_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div3_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div3_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div3_order_status_riding",0),
					(try_end),
					(try_begin), #division 4 row - update & show
						(eq,"$prsnt_tac_div4_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div4_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div4_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div4_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div4_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div4_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div4_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div4_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_4),
							(overlay_set_val,"$prsnt_tac_div4_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div4_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div4_bg",250,0x444400),
								(assign,"$prsnt_tac_div4_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div4_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div4_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div4_bg",250,0x000000),
								(assign,"$prsnt_tac_div4_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_4),
						(assign,reg0,":num_us_ready_div4"),
						(overlay_set_text,"$prsnt_tac_div4_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_4),
						(overlay_set_text,"$prsnt_tac_div4_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div4_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div4_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div4_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div4_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div4_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div4_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div4_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div4_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div4_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div4_order_status_riding",1),
					(else_try), #division 4 row - hide
						(assign,"$prsnt_tac_div4_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div4_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div4_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div4_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div4_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div4_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div4_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div4_order_status_riding",0),
					(try_end),
					(try_begin), #division 5 row - update & show
						(eq,"$prsnt_tac_div5_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div5_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div5_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div5_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div5_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div5_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div5_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div5_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_5),
							(overlay_set_val,"$prsnt_tac_div5_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div5_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div5_bg",250,0x444400),
								(assign,"$prsnt_tac_div5_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div5_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div5_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div5_bg",250,0x000000),
								(assign,"$prsnt_tac_div5_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_5),
						(assign,reg0,":num_us_ready_div5"),
						(overlay_set_text,"$prsnt_tac_div5_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_5),
						(overlay_set_text,"$prsnt_tac_div5_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div5_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div5_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div5_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div5_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div5_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div5_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div5_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div5_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div5_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div5_order_status_riding",1),
					(else_try), #division 5 row - hide
						(assign,"$prsnt_tac_div5_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div5_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div5_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div5_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div5_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div5_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div5_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div5_order_status_riding",0),
					(try_end),
					(try_begin), #division 6 row - update & show
						(eq,"$prsnt_tac_div6_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div6_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div6_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div6_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div6_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div6_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div6_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div6_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_6),
							(overlay_set_val,"$prsnt_tac_div6_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div6_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div6_bg",250,0x444400),
								(assign,"$prsnt_tac_div6_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div6_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div6_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div6_bg",250,0x000000),
								(assign,"$prsnt_tac_div6_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_6),
						(assign,reg0,":num_us_ready_div6"),
						(overlay_set_text,"$prsnt_tac_div6_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_6),
						(overlay_set_text,"$prsnt_tac_div6_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div6_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div6_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div6_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div6_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div6_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div6_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div6_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div6_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div6_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div6_order_status_riding",1),
					(else_try), #division 6 row - hide
						(assign,"$prsnt_tac_div6_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div6_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div6_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div6_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div6_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div6_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div6_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div6_order_status_riding",0),
					(try_end),
					(try_begin), #division 7 row - update & show
						(eq,"$prsnt_tac_div7_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div7_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div7_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div7_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div7_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div7_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div7_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div7_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_7),
							(overlay_set_val,"$prsnt_tac_div7_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div7_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div7_bg",250,0x444400),
								(assign,"$prsnt_tac_div7_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div7_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div7_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div7_bg",250,0x000000),
								(assign,"$prsnt_tac_div7_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_7),
						(assign,reg0,":num_us_ready_div7"),
						(overlay_set_text,"$prsnt_tac_div7_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_7),
						(overlay_set_text,"$prsnt_tac_div7_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div7_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div7_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div7_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div7_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div7_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div7_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div7_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div7_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div7_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div7_order_status_riding",1),
					(else_try), #division 7 row - hide
						(assign,"$prsnt_tac_div7_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div7_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div7_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div7_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div7_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div7_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div7_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div7_order_status_riding",0),
					(try_end),
					(try_begin), #division 8 row - update & show
						(eq,"$prsnt_tac_div8_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div8_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div8_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div8_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div8_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div8_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div8_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div8_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_8),
							(overlay_set_val,"$prsnt_tac_div8_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div8_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div8_bg",250,0x444400),
								(assign,"$prsnt_tac_div8_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div8_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div8_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div8_bg",250,0x000000),
								(assign,"$prsnt_tac_div8_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_8),
						(assign,reg0,":num_us_ready_div8"),
						(overlay_set_text,"$prsnt_tac_div8_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_8),
						(overlay_set_text,"$prsnt_tac_div8_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div8_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div8_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div8_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div8_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div8_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div8_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div8_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div8_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div8_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div8_order_status_riding",1),
					(else_try), #division 8 row - hide
						(assign,"$prsnt_tac_div8_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div8_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div8_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div8_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div8_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div8_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div8_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div8_order_status_riding",0),
					(try_end),
					(try_begin), #division 9 row - update & show
						(eq,"$prsnt_tac_div9_has_troops",1),
						#move y down one row
						(val_sub,":bg_y",   40),
						(val_sub,":check_y",40),
						(val_sub,":text_y", 40),
						#update row position (in case division disappeared/appeared due to deaths/routs/reinforcements)
						(position_set_y,pos0,":bg_y"),
						(position_set_y,pos1,":check_y"),
						(position_set_y,pos2,":text_y"),
						(position_set_y,pos3,":text_y"),
						(position_set_y,pos4,":text_y"),
						(position_set_y,pos5,":text_y"),
						(position_set_y,pos6,":text_y"),
						(overlay_set_position,"$prsnt_tac_div9_bg",                 pos0),
						(overlay_set_position,"$prsnt_tac_div9_checkbox",           pos1),
						(overlay_set_position,"$prsnt_tac_div9_name_and_count",     pos2),
						(overlay_set_position,"$prsnt_tac_div9_order_status_action",pos3),
						(overlay_set_position,"$prsnt_tac_div9_order_status_firing",pos4),
						(overlay_set_position,"$prsnt_tac_div9_order_status_weapon",pos5),
						(overlay_set_position,"$prsnt_tac_div9_order_status_riding",pos6),
						#update checkbox (and animate background if value changed)
						(try_begin), #select
							(class_is_listening_order,":player_team",grd_9),
							(overlay_set_val,"$prsnt_tac_div9_checkbox",1),
							(try_begin),
								(neq,"$prsnt_tac_div9_is_selected",1),
								(overlay_animate_to_color,"$prsnt_tac_div9_bg",250,0x444400),
								(assign,"$prsnt_tac_div9_is_selected",1),
							(try_end),
						(else_try), #unselect
							(overlay_set_val,"$prsnt_tac_div9_checkbox",0),
							(try_begin),
								(neq,"$prsnt_tac_div9_is_selected",0),
								(overlay_animate_to_color,"$prsnt_tac_div9_bg",250,0x000000),
								(assign,"$prsnt_tac_div9_is_selected",0),
							(try_end),
						(try_end),
						#update agent count in division
						(str_store_class_name,s0,grd_9),
						(assign,reg0,":num_us_ready_div9"),
						(overlay_set_text,"$prsnt_tac_div9_name_and_count","@{s0} ({reg0})"),
						#update order statuses
						(call_script,"script_tactical_overlay_store_order_names_for_division",":player_team",grd_9),
						(overlay_set_text,"$prsnt_tac_div9_order_status_action",s0),
						(overlay_set_text,"$prsnt_tac_div9_order_status_firing",s1),
						(overlay_set_text,"$prsnt_tac_div9_order_status_weapon",s2),
						(overlay_set_text,"$prsnt_tac_div9_order_status_riding",s3),
						#update visibility
						(overlay_set_display,"$prsnt_tac_div9_bg",                 1),
						(overlay_set_display,"$prsnt_tac_div9_checkbox",           1),
						(overlay_set_display,"$prsnt_tac_div9_name_and_count",     1),
						(overlay_set_display,"$prsnt_tac_div9_order_status_action",1),
						(overlay_set_display,"$prsnt_tac_div9_order_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div9_order_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div9_order_status_riding",1),
					(else_try), #division 9 row - hide
						(assign,"$prsnt_tac_div9_is_selected",0),
						(overlay_set_display,"$prsnt_tac_div9_bg",                 0),
						(overlay_set_display,"$prsnt_tac_div9_checkbox",           0),
						(overlay_set_display,"$prsnt_tac_div9_name_and_count",     0),
						(overlay_set_display,"$prsnt_tac_div9_order_status_action",0),
						(overlay_set_display,"$prsnt_tac_div9_order_status_firing",0),
						(overlay_set_display,"$prsnt_tac_div9_order_status_weapon",0),
						(overlay_set_display,"$prsnt_tac_div9_order_status_riding",0),
					(try_end),
				(try_end),
				(try_begin), #update & show order controls
					(this_or_next|eq,"$prsnt_tac_div1_has_troops",1),
					(this_or_next|eq,"$prsnt_tac_div2_has_troops",1),
					(this_or_next|eq,"$prsnt_tac_div3_has_troops",1),
					(this_or_next|eq,"$prsnt_tac_div4_has_troops",1),
					(this_or_next|eq,"$prsnt_tac_div5_has_troops",1),
					(this_or_next|eq,"$prsnt_tac_div6_has_troops",1),
					(this_or_next|eq,"$prsnt_tac_div7_has_troops",1),
					(this_or_next|eq,"$prsnt_tac_div8_has_troops",1),
					(             eq,"$prsnt_tac_div9_has_troops",1),
					#move y below last division row
					(store_sub,":order_y",":bg_y",10*mult_y+20),(position_set_y,pos0,":order_y"),(val_sub,":order_y",3), #header - 10 units gap fixed for stretching + text height; after that some extra gap to the background box
					(val_sub,":order_y",35*0.667),(position_set_y,pos1,":order_y"), #order 1
					(val_sub,":order_y",35*0.667),(position_set_y,pos2,":order_y"), #order 2
					(val_sub,":order_y",35*0.667),(position_set_y,pos3,":order_y"), #order 3
					(val_sub,":order_y",35*0.667),(position_set_y,pos4,":order_y"), #order 4
					(val_sub,":order_y",35*0.667),(position_set_y,pos5,":order_y"), #order 5
					(val_sub,":order_y",35*0.667),(position_set_y,pos6,":order_y"), #order 6
					(val_sub,":order_y",35*0.667),(position_set_y,pos7,":order_y"), #order 7
					(val_sub,":order_y",4),(position_set_y,pos8,":order_y"), #bg a bit lower to have some padding between text and bottom edge of bg
					#update position of order controls (in case divisions disappeared/appeared due to deaths/routs/reinforcements)
					(try_begin), #advanced orders
						(eq,module_ini["use_advanced_formation"],1),
						(position_set_x,pos0,((1000-3*10-290)-3*10)/4/2+8), #text is center-aligned, so gotta move the anchor point by half of ((1000-3*10-290)-3*10)/4 which is the background width
						(position_set_x,pos1,((1000-3*10-290)-3*10)/4/2+8), #and add the edge gap of 10, but because the text isn't *exactly* center-aligned, we gotta make the gap a little smaller to compensate
						(position_set_x,pos2,((1000-3*10-290)-3*10)/4/2+8),
						(position_set_x,pos3,((1000-3*10-290)-3*10)/4/2+8),
						(position_set_x,pos4,((1000-3*10-290)-3*10)/4/2+8),
						(position_set_x,pos5,((1000-3*10-290)-3*10)/4/2+8),
						(position_set_x,pos6,((1000-3*10-290)-3*10)/4/2+8),
						(position_set_x,pos7,((1000-3*10-290)-3*10)/4/2+8),
						(position_set_x,pos8,                          10), #simply use the 10 units gap from edge
						(overlay_set_position,"$prsnt_tac_orders_movement_header",pos0),
						(overlay_set_position,"$prsnt_tac_orders_hold",           pos1),
						(overlay_set_position,"$prsnt_tac_orders_follow",         pos2),
						(overlay_set_position,"$prsnt_tac_orders_charge",         pos3),
						(overlay_set_position,"$prsnt_tac_orders_stand_ground",   pos4),
						(overlay_set_position,"$prsnt_tac_orders_retreat",        pos5),
						(overlay_set_position,"$prsnt_tac_orders_advance",        pos6),
						(overlay_set_position,"$prsnt_tac_orders_fall_back",      pos7),
						(overlay_set_position,"$prsnt_tac_orders_movement_bg",    pos8),
						(position_set_x,pos0,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*1), #same values as above, but move them to the right by 1 width of background + 1 width of gap between backgrounds
						(position_set_x,pos1,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos2,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos3,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos4,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos5,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos6,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos7,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos8,                          10+(((1000-3*10-290)-3*10)/4+10)*1),
						(overlay_set_position,"$prsnt_tac_orders_formation_header",pos0),
						(overlay_set_position,"$prsnt_tac_orders_form_1_row",      pos1),
						(overlay_set_position,"$prsnt_tac_orders_form_2_row",      pos2),
						(overlay_set_position,"$prsnt_tac_orders_form_3_row",      pos3),
						(overlay_set_position,"$prsnt_tac_orders_form_4_row",      pos4),
						(overlay_set_position,"$prsnt_tac_orders_form_5_row",      pos5),
						(overlay_set_position,"$prsnt_tac_orders_spread_out",      pos6),
						(overlay_set_position,"$prsnt_tac_orders_stand_closer",    pos7),
						(overlay_set_position,"$prsnt_tac_orders_formation_bg",    pos8),
						(position_set_x,pos0,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*2), #same values as above, but move them to the right by 2 widths of background + 2 widths of gap between backgrounds
						(position_set_x,pos1,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos2,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos3,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos4,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos5,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos6,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos8,                          10+(((1000-3*10-290)-3*10)/4+10)*2),
						(overlay_set_position,"$prsnt_tac_orders_firing_header",     pos0),
						(overlay_set_position,"$prsnt_tac_orders_fire_at_will",      pos1),
						(overlay_set_position,"$prsnt_tac_orders_fire_at_my_command",pos2),
						(overlay_set_position,"$prsnt_tac_orders_all_fire_now",      pos3),
						(overlay_set_position,"$prsnt_tac_orders_left_fire_now",     pos4),
						(overlay_set_position,"$prsnt_tac_orders_middle_fire_now",   pos5),
						(overlay_set_position,"$prsnt_tac_orders_right_fire_now",    pos6),
						(overlay_set_position,"$prsnt_tac_orders_firing_bg",         pos8),
						(position_set_x,pos0,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*3), #same values as above, but move them to the right by 3 widths of background + 3 widths of gap between backgrounds
						(position_set_x,pos1,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*3),
						(position_set_x,pos2,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*3),
						(position_set_x,pos3,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*3),
						(position_set_x,pos4,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*3),
						(position_set_x,pos5,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*3),
						(position_set_x,pos6,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)*3),
						(position_set_x,pos8,                          10+(((1000-3*10-290)-3*10)/4+10)*3),
						(overlay_set_position,"$prsnt_tac_orders_equipment_header",  pos0),
						(overlay_set_position,"$prsnt_tac_orders_use_melee_weapons", pos1),
						(overlay_set_position,"$prsnt_tac_orders_use_ranged_weapons",pos2),
						(overlay_set_position,"$prsnt_tac_orders_use_blunt_weapons", pos3),
						(overlay_set_position,"$prsnt_tac_orders_use_any_weapon",    pos4),
						(overlay_set_position,"$prsnt_tac_orders_mount",             pos5),
						(overlay_set_position,"$prsnt_tac_orders_dismount",          pos6),
						(overlay_set_position,"$prsnt_tac_orders_equipment_bg",      pos8),
						#update visibility of header & order controls
						(overlay_set_display,"$prsnt_tac_div_header_status_action", 1),
						(overlay_set_display,"$prsnt_tac_div_header_status_firing", 1),
						(overlay_set_display,"$prsnt_tac_div_header_status_weapon", 1),
						(overlay_set_display,"$prsnt_tac_div_header_status_riding", 1),
						(overlay_set_display,"$prsnt_tac_orders_movement_header",   1),
						(overlay_set_display,"$prsnt_tac_orders_formation_header",  1),
						(overlay_set_display,"$prsnt_tac_orders_firing_header",     1),
						(overlay_set_display,"$prsnt_tac_orders_equipment_header",  1),
						(overlay_set_display,"$prsnt_tac_orders_movement_bg",       1),
						(overlay_set_display,"$prsnt_tac_orders_formation_bg",      1),
						(overlay_set_display,"$prsnt_tac_orders_firing_bg",         1),
						(overlay_set_display,"$prsnt_tac_orders_equipment_bg",      1),
						(overlay_set_display,"$prsnt_tac_orders_hold",              1),
						(overlay_set_display,"$prsnt_tac_orders_follow",            1),
						(overlay_set_display,"$prsnt_tac_orders_charge",            1),
						(overlay_set_display,"$prsnt_tac_orders_stand_ground",      1),
						(overlay_set_display,"$prsnt_tac_orders_retreat",           1),
						(overlay_set_display,"$prsnt_tac_orders_advance",           1),
						(overlay_set_display,"$prsnt_tac_orders_fall_back",         1),
						(overlay_set_display,"$prsnt_tac_orders_form_1_row",        1),
						(overlay_set_display,"$prsnt_tac_orders_form_2_row",        1),
						(overlay_set_display,"$prsnt_tac_orders_form_3_row",        1),
						(overlay_set_display,"$prsnt_tac_orders_form_4_row",        1),
						(overlay_set_display,"$prsnt_tac_orders_form_5_row",        1),
						(overlay_set_display,"$prsnt_tac_orders_spread_out",        1),
						(overlay_set_display,"$prsnt_tac_orders_stand_closer",      1),
						(overlay_set_display,"$prsnt_tac_orders_fire_at_will",      1),
						(overlay_set_display,"$prsnt_tac_orders_fire_at_my_command",1),
						(overlay_set_display,"$prsnt_tac_orders_all_fire_now",      1),
						(overlay_set_display,"$prsnt_tac_orders_left_fire_now",     1),
						(overlay_set_display,"$prsnt_tac_orders_middle_fire_now",   1),
						(overlay_set_display,"$prsnt_tac_orders_right_fire_now",    1),
						(overlay_set_display,"$prsnt_tac_orders_use_melee_weapons", 1),
						(overlay_set_display,"$prsnt_tac_orders_use_ranged_weapons",1),
						(overlay_set_display,"$prsnt_tac_orders_use_blunt_weapons", 1),
						(overlay_set_display,"$prsnt_tac_orders_use_any_weapon",    1),
						(overlay_set_display,"$prsnt_tac_orders_mount",             1),
						(overlay_set_display,"$prsnt_tac_orders_dismount",          1),
					(else_try), #simple orders
						(val_add,":order_y",35*0.667),(position_set_y,pos8,":order_y"), #simple orders have one row less
						(position_set_x,pos0,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2), #same as advanced orders, but we have 1 less background to show
						(position_set_x,pos1,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2), #so to center it in the available space, we move everything to the right
						(position_set_x,pos2,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2), #by (((1000-3*10-290)-3*10)/4+10)/2 which is half of width of 1 bg and 1 gap
						(position_set_x,pos3,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2),
						(position_set_x,pos4,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2),
						(position_set_x,pos5,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2),
						(position_set_x,pos6,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2),
						(position_set_x,pos8,                          10+(((1000-3*10-290)-3*10)/4+10)/2),
						(overlay_set_position,"$prsnt_tac_orders_movement_header",pos0),
						(overlay_set_position,"$prsnt_tac_orders_hold",           pos1),
						(overlay_set_position,"$prsnt_tac_orders_follow",         pos2),
						(overlay_set_position,"$prsnt_tac_orders_charge",         pos3),
						(overlay_set_position,"$prsnt_tac_orders_stand_ground",   pos4),
						(overlay_set_position,"$prsnt_tac_orders_retreat",        pos5),
						(overlay_set_position,"$prsnt_tac_orders_movement_bg",    pos8),
						(position_set_x,pos0,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos1,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos2,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos3,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos4,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos5,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos6,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*1),
						(position_set_x,pos8,                          10+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*1),
						(overlay_set_position,"$prsnt_tac_orders_formation_header",pos0),
						(overlay_set_position,"$prsnt_tac_orders_advance",         pos1),
						(overlay_set_position,"$prsnt_tac_orders_fall_back",       pos2),
						(overlay_set_position,"$prsnt_tac_orders_spread_out",      pos3),
						(overlay_set_position,"$prsnt_tac_orders_stand_closer",    pos4),
						(overlay_set_position,"$prsnt_tac_orders_mount",           pos5),
						(overlay_set_position,"$prsnt_tac_orders_dismount",        pos6),
						(overlay_set_position,"$prsnt_tac_orders_formation_bg",    pos8),
						(position_set_x,pos0,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos1,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos2,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos3,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos4,((1000-3*10-290)-3*10)/4/2+8+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*2),
						(position_set_x,pos8,                          10+(((1000-3*10-290)-3*10)/4+10)/2+(((1000-3*10-290)-3*10)/4+10)*2),
						(overlay_set_position,"$prsnt_tac_orders_firing_header",    pos0),
						(overlay_set_position,"$prsnt_tac_orders_hold_fire",        pos1),
						(overlay_set_position,"$prsnt_tac_orders_fire_at_will",     pos2),
						(overlay_set_position,"$prsnt_tac_orders_use_blunt_weapons",pos3),
						(overlay_set_position,"$prsnt_tac_orders_use_any_weapon",   pos4),
						(overlay_set_position,"$prsnt_tac_orders_firing_bg",        pos8),
						#update visibility of division headers, order headers & order controls
						(overlay_set_display,"$prsnt_tac_div_header_status_action",1),
						(overlay_set_display,"$prsnt_tac_div_header_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div_header_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div_header_status_riding",1),
						(overlay_set_display,"$prsnt_tac_div_header_status_action",1),
						(overlay_set_display,"$prsnt_tac_div_header_status_firing",1),
						(overlay_set_display,"$prsnt_tac_div_header_status_weapon",1),
						(overlay_set_display,"$prsnt_tac_div_header_status_riding",1),
						(overlay_set_display,"$prsnt_tac_orders_movement_header",  1),
						(overlay_set_display,"$prsnt_tac_orders_formation_header", 1),
						(overlay_set_display,"$prsnt_tac_orders_firing_header",    1),
						(overlay_set_display,"$prsnt_tac_orders_movement_bg",      1),
						(overlay_set_display,"$prsnt_tac_orders_formation_bg",     1),
						(overlay_set_display,"$prsnt_tac_orders_firing_bg",        1),
						(overlay_set_display,"$prsnt_tac_orders_hold",             1),
						(overlay_set_display,"$prsnt_tac_orders_follow",           1),
						(overlay_set_display,"$prsnt_tac_orders_charge",           1),
						(overlay_set_display,"$prsnt_tac_orders_stand_ground",     1),
						(overlay_set_display,"$prsnt_tac_orders_retreat",          1),
						(overlay_set_display,"$prsnt_tac_orders_advance",          1),
						(overlay_set_display,"$prsnt_tac_orders_fall_back",        1),
						(overlay_set_display,"$prsnt_tac_orders_spread_out",       1),
						(overlay_set_display,"$prsnt_tac_orders_stand_closer",     1),
						(overlay_set_display,"$prsnt_tac_orders_mount",            1),
						(overlay_set_display,"$prsnt_tac_orders_dismount",         1),
						(overlay_set_display,"$prsnt_tac_orders_hold_fire",        1),
						(overlay_set_display,"$prsnt_tac_orders_fire_at_will",     1),
						(overlay_set_display,"$prsnt_tac_orders_use_blunt_weapons",1),
						(overlay_set_display,"$prsnt_tac_orders_use_any_weapon",   1),
					(try_end),
				(else_try), #hide order controls
					(overlay_set_display,"$prsnt_tac_div_header_status_action", 0),
					(overlay_set_display,"$prsnt_tac_div_header_status_firing", 0),
					(overlay_set_display,"$prsnt_tac_div_header_status_weapon", 0),
					(overlay_set_display,"$prsnt_tac_div_header_status_riding", 0),
					(overlay_set_display,"$prsnt_tac_orders_movement_header",   0),
					(overlay_set_display,"$prsnt_tac_orders_formation_header",  0),
					(overlay_set_display,"$prsnt_tac_orders_firing_header",     0),
					(overlay_set_display,"$prsnt_tac_orders_equipment_header",  0),
					(overlay_set_display,"$prsnt_tac_orders_movement_bg",       0),
					(overlay_set_display,"$prsnt_tac_orders_formation_bg",      0),
					(overlay_set_display,"$prsnt_tac_orders_firing_bg",         0),
					(overlay_set_display,"$prsnt_tac_orders_equipment_bg",      0),
					(overlay_set_display,"$prsnt_tac_orders_hold",              0),
					(overlay_set_display,"$prsnt_tac_orders_follow",            0),
					(overlay_set_display,"$prsnt_tac_orders_charge",            0),
					(overlay_set_display,"$prsnt_tac_orders_stand_ground",      0),
					(overlay_set_display,"$prsnt_tac_orders_retreat",           0),
					(overlay_set_display,"$prsnt_tac_orders_advance",           0),
					(overlay_set_display,"$prsnt_tac_orders_fall_back",         0),
					(overlay_set_display,"$prsnt_tac_orders_form_1_row",        0),
					(overlay_set_display,"$prsnt_tac_orders_form_2_row",        0),
					(overlay_set_display,"$prsnt_tac_orders_form_3_row",        0),
					(overlay_set_display,"$prsnt_tac_orders_form_4_row",        0),
					(overlay_set_display,"$prsnt_tac_orders_form_5_row",        0),
					(overlay_set_display,"$prsnt_tac_orders_spread_out",        0),
					(overlay_set_display,"$prsnt_tac_orders_stand_closer",      0),
					(overlay_set_display,"$prsnt_tac_orders_hold_fire",         0),
					(overlay_set_display,"$prsnt_tac_orders_fire_at_will",      0),
					(overlay_set_display,"$prsnt_tac_orders_fire_at_my_command",0),
					(overlay_set_display,"$prsnt_tac_orders_all_fire_now",      0),
					(overlay_set_display,"$prsnt_tac_orders_left_fire_now",     0),
					(overlay_set_display,"$prsnt_tac_orders_middle_fire_now",   0),
					(overlay_set_display,"$prsnt_tac_orders_right_fire_now",    0),
					(overlay_set_display,"$prsnt_tac_orders_use_melee_weapons", 0),
					(overlay_set_display,"$prsnt_tac_orders_use_ranged_weapons",0),
					(overlay_set_display,"$prsnt_tac_orders_use_blunt_weapons", 0),
					(overlay_set_display,"$prsnt_tac_orders_use_any_weapon",    0),
					(overlay_set_display,"$prsnt_tac_orders_mount",             0),
					(overlay_set_display,"$prsnt_tac_orders_dismount",          0),
				(try_end),
			(try_end),
			(try_begin), #update flags on minimap
				(try_begin), #infantry flag
					(team_get_movement_order,":order",":player_team",grc_infantry),
					(eq,":order",mordr_hold),
					(team_get_order_position,pos0,":player_team",grc_infantry),
					(call_script,"script_tactical_overlay_convert_scene_pos_to_minimap_pos",pos0),
					(overlay_set_position,"$prsnt_tac_minimap_flag_infantry",pos0),
					(overlay_set_display,"$prsnt_tac_minimap_flag_infantry",1),
				(else_try),
					(overlay_set_display,"$prsnt_tac_minimap_flag_infantry",0),
				(try_end),
				(try_begin), #shooters flag
					(team_get_movement_order,":order",":player_team",grc_shooters),
					(eq,":order",mordr_hold),
					(team_get_order_position,pos0,":player_team",grc_shooters),
					(call_script,"script_tactical_overlay_convert_scene_pos_to_minimap_pos",pos0),
					(overlay_set_position,"$prsnt_tac_minimap_flag_shooters",pos0),
					(overlay_set_display,"$prsnt_tac_minimap_flag_shooters",1),
				(else_try),
					(overlay_set_display,"$prsnt_tac_minimap_flag_shooters",0),
				(try_end),
				(try_begin), #cavalry flag
					(team_get_movement_order,":order",":player_team",grc_cavalry),
					(eq,":order",mordr_hold),
					(team_get_order_position,pos0,":player_team",grc_cavalry),
					(call_script,"script_tactical_overlay_convert_scene_pos_to_minimap_pos",pos0),
					(overlay_set_position,"$prsnt_tac_minimap_flag_cavalry",pos0),
					(overlay_set_display,"$prsnt_tac_minimap_flag_cavalry",1),
				(else_try),
					(overlay_set_display,"$prsnt_tac_minimap_flag_cavalry",0),
				(try_end),
				(try_begin), #skirmishers flag
					(team_get_movement_order,":order",":player_team",grc_skirmishers),
					(eq,":order",mordr_hold),
					(team_get_order_position,pos0,":player_team",grc_skirmishers),
					(call_script,"script_tactical_overlay_convert_scene_pos_to_minimap_pos",pos0),
					(overlay_set_position,"$prsnt_tac_minimap_flag_skirmishers",pos0),
					(overlay_set_display,"$prsnt_tac_minimap_flag_skirmishers",1),
				(else_try),
					(overlay_set_display,"$prsnt_tac_minimap_flag_skirmishers",0),
				(try_end),
			(try_end),
			(try_begin), #update statistics
				(assign,reg0,":num_us_ready"),       (overlay_set_text,"$prsnt_tac_statistics_us_ready",       "@{reg0}"),
				(assign,reg0,":num_us_wounded"),     (overlay_set_text,"$prsnt_tac_statistics_us_wounded",     "@{reg0}"),
				(assign,reg0,":num_us_routed"),      (overlay_set_text,"$prsnt_tac_statistics_us_routed",      "@{reg0}"),
				(assign,reg0,":num_us_dead"),        (overlay_set_text,"$prsnt_tac_statistics_us_dead",        "@{reg0}"),
				(assign,reg0,":num_allies_ready"),   (overlay_set_text,"$prsnt_tac_statistics_allies_ready",   "@{reg0}"),
				(assign,reg0,":num_allies_wounded"), (overlay_set_text,"$prsnt_tac_statistics_allies_wounded", "@{reg0}"),
				(assign,reg0,":num_allies_routed"),  (overlay_set_text,"$prsnt_tac_statistics_allies_routed",  "@{reg0}"),
				(assign,reg0,":num_allies_dead"),    (overlay_set_text,"$prsnt_tac_statistics_allies_dead",    "@{reg0}"),
				(assign,reg0,":num_enemies_ready"),  (overlay_set_text,"$prsnt_tac_statistics_enemies_ready",  "@{reg0}"),
				(assign,reg0,":num_enemies_wounded"),(overlay_set_text,"$prsnt_tac_statistics_enemies_wounded","@{reg0}"),
				(assign,reg0,":num_enemies_routed"), (overlay_set_text,"$prsnt_tac_statistics_enemies_routed", "@{reg0}"),
				(assign,reg0,":num_enemies_dead"),   (overlay_set_text,"$prsnt_tac_statistics_enemies_dead",   "@{reg0}"),
			(try_end),
		]
	),
	("tactical_overlay_store_order_names_for_division", #helper script that returns names for orders currently followed by specified division in given team
		#input: param1 = team, param2 = division
		#output: s0 = movement order, s1 = firing order, s2 = weapon usage order, s3 = riding order
		[
			(store_script_param,":team",1),
			(store_script_param,":division",2),
			#action orders
			(team_get_movement_order,":order",":team",":division"),
			(try_begin), #only action orders - formation orders can't be detected by any means (other maybe than storing formation orders in agent slots when they are given)
				(eq,":order",mordr_hold),        (str_store_string,s0,"@Holding"   ),(else_try),
				(eq,":order",mordr_follow),      (str_store_string,s0,"@Following" ),(else_try),
				(eq,":order",mordr_charge),      (str_store_string,s0,"@Charging"  ),(else_try),
				#mordr_mount                     detectable as rordr_mount
				#mordr_dismount                  detectable as rordr_dismount
				#mordr_advance                   not detectable (issues mordr_hold and moves its position forward)
				#mordr_fall_back                 not detectable (issues mordr_hold and moves its position backward)
				#mordr_stand_closer              not detectable (formation order)
				#mordr_spread_out                not detectable (formation order)
				#mordr_use_blunt_weapons         detectable as wordr_use_blunt_weapons
				#mordr_use_any_weapon            detectable as wordr_use_any_weapon
				(eq,":order",mordr_stand_ground),(str_store_string,s0,"@Standing"  ),(else_try),
				#mordr_hold_fire                 detectable as aordr_hold_your_fire, only available when advanced orders are off
				#mordr_fire_at_will              detectable as aordr_fire_at_will
				(eq,":order",mordr_retreat),     (str_store_string,s0,"@Retreating"),
				#mordr_use_melee_weapons         detectable as wordr_use_melee_weapons
				#mordr_use_ranged_weapons        detectable as wordr_use_ranged_weapons
				#mordr_fire_at_my_command        detectable as aordr_hold_your_fire, only available when advanced orders are on
				#mordr_all_fire_now              not detectable (instant, no status)
				#mordr_left_fire_now             not detectable (instant, no status)
				#mordr_middle_fire_now           not detectable (instant, no status)
				#mordr_right_fire_now            not detectable (instant, no status)
				#mordr_form_1_row                not detectable (formation order)
				#mordr_form_2_row                not detectable (formation order)
				#mordr_form_3_row                not detectable (formation order)
				#mordr_form_4_row                not detectable (formation order)
				#mordr_form_5_row                not detectable (formation order)
			(try_end),
			#firing orders
			(team_get_hold_fire_order,":order",":team",":division"),
			(try_begin),
				(eq,":order",aordr_fire_at_will),                                         (str_store_string,s1,"@At will"  ),(else_try), #caused by mordr_fire_at_will
				(eq,":order",aordr_hold_your_fire),(eq,module_ini["use_advanced_formation"],1),(str_store_string,s1,"@On comm." ),(else_try), #caused by mordr_hold_fire (when advanced orders are off)
				(eq,":order",aordr_hold_your_fire),(eq,module_ini["use_advanced_formation"],0),(str_store_string,s1,"@Hold fire"),            #caused by mordr_fire_at_my_command (when advanced orders are on)
			(try_end),
			#weapon orders
			(team_get_weapon_usage_order,":order",":team",":division"),
			(try_begin),
				(eq,":order",wordr_use_any_weapon),    (str_store_string,s2,"@Any"   ),(else_try), #caused by mordr_use_any_weapon,     no weapon restrictions
				(eq,":order",wordr_use_blunt_weapons), (str_store_string,s2,"@Blunt" ),(else_try), #caused by mordr_use_blunt_weapons,  weapons restricted to blunt only
				(eq,":order",wordr_use_melee_weapons), (str_store_string,s2,"@Melee" ),(else_try), #caused by mordr_use_melee_weapons,  weapons restricted to melee only
				(eq,":order",wordr_use_ranged_weapons),(str_store_string,s2,"@Ranged"),            #caused by mordr_use_ranged_weapons, weapons restricted to ranged only
			(try_end),
			#riding orders
			(team_get_riding_order,":order",":team",":division"),
			(try_begin),
				(eq,":order",rordr_free),    (str_store_string,s3,"@No orders"),(else_try), #caused only by not giving any orders
				(eq,":order",rordr_mount),   (str_store_string,s3,"@Mount"    ),(else_try), #caused by mordr_mount
				(eq,":order",rordr_dismount),(str_store_string,s3,"@Dismount" ),            #caused by mordr_dismount
			(try_end),
		]
	),
	("tactical_overlay_convert_scene_pos_to_minimap_pos", #helper script, overwrites pos0 and pos1 (but works fine if either of those is specified as input/output)
		#input: param1 = scene position
		#output: param1 = minimap position returned to the same pos register as input (as screen position but within the minimap)
		[
			(store_script_param,":pos",1),
			(set_fixed_point_multiplier,1000),
			#get input coordinates
			(position_get_x,":agent_x",":pos"),
			(position_get_y,":agent_y",":pos"),
			#get scene's lower bound
			(get_scene_boundaries,pos0,pos1), #pos1 in this case is irrelevant
			(position_get_x,":scene_x",pos0),
			(position_get_y,":scene_y",pos0),
			#calculate bottom-left corner of the minimap disregarding its border that we added just for better visuals
			(store_div,":half_of_minimap_wdth","$prsnt_tac_minimap_wdth",2),
			(store_div,":half_of_minimap_hght","$prsnt_tac_minimap_hght",2),
			(store_sub,":minimap_x",1000-(10+270/2+10),       ":half_of_minimap_wdth"), #10 units margin from the right screen edge, minimap center-aligned in the remaining space, 10 units of minimap border
			(store_sub,":minimap_y", 750-(10+270/2+10)*mult_y,":half_of_minimap_hght"), #10 units margin from the right screen edge, minimap center-aligned in the remaining space, 10 units of minimap border (all of that with fixes for stretching)
			#move scene coordinate system to range (0,0)~(scene_width,scene_height)
			(val_sub,":agent_x",":scene_x"),
			(val_sub,":agent_y",":scene_y"),
			#scale coordinate system to the minimap scale
			(val_div,":agent_x","$prsnt_tac_minimap_scale_x"),
			(val_div,":agent_y","$prsnt_tac_minimap_scale_y"),
			#move coordinate system's (0,0) point to bottom-left corner of the minimap (disregarding its border)
			(val_add,":minimap_x",":agent_x"),
			(val_add,":minimap_y",":agent_y"),
			#store coordinates to output
			(position_set_x,":pos",":minimap_x"),
			(position_set_y,":pos",":minimap_y"),
		]
	),
	("tactical_overlay_convert_minimap_pos_to_scene_pos", #helper script, overwrites pos0 and pos1 (but works fine if either of those is specified as input/output)
		#input: param1 = screen position (within the minimap)
		#output: param1 = scene position returned to the same pos register as input
		[
			(store_script_param,":pos",1),
			(set_fixed_point_multiplier,1000),
			#get input coordinates
			(position_get_x,":screen_x",":pos"),
			(position_get_y,":screen_y",":pos"),
			#get scene's lower bound
			(get_scene_boundaries,pos0,pos1), #pos1 will be used later
			(position_get_x,":boundary_x",pos0), #lower boundary
			(position_get_y,":boundary_y",pos0), #lower boundary
			#calculate bottom-left corner of the minimap disregarding its border that we added just for better visuals
			(store_div,":half_of_minimap_wdth","$prsnt_tac_minimap_wdth",2),
			(store_div,":half_of_minimap_hght","$prsnt_tac_minimap_hght",2),
			(store_sub,":minimap_x",1000-(10+270/2+10),       ":half_of_minimap_wdth"), #10 units margin from the right screen edge, minimap center-aligned in the remaining space, 10 units of minimap border
			(store_sub,":minimap_y", 750-(10+270/2+10)*mult_y,":half_of_minimap_hght"), #10 units margin from the right screen edge, minimap center-aligned in the remaining space, 10 units of minimap border (all of that with fixes for stretching)
			#move minimap-based coordinate system so that minimap's bottom-left corner has value (0,0)
			(val_sub,":screen_x",":minimap_x"),
			(val_sub,":screen_y",":minimap_y"),
			#clamp values
			(val_max,":screen_x",0),
			(val_max,":screen_y",0),
			(val_min,":screen_x","$prsnt_tac_minimap_wdth"),
			(val_min,":screen_y","$prsnt_tac_minimap_hght"),
			#scale coordinate system to the scene scale
			(val_mul,":screen_x","$prsnt_tac_minimap_scale_x"),
			(val_mul,":screen_y","$prsnt_tac_minimap_scale_y"),
			#now our position matches the scene, but locally, assuming that scene's lower bound is (0,0), so we need to move it
			(store_add,":scene_x",":boundary_x",":screen_x"),
			(store_add,":scene_y",":boundary_y",":screen_y"),
			#store coordinates to output
			(position_set_x,":pos",":scene_x"),
			(position_set_y,":pos",":scene_y"),
		]
	),
	("tactical_overlay_give_order", #helper script to issue an order selected through presentation buttons
		#input: param1 = order, param2 = order's position (only needed if order is mordr_hold, pass -1 to let the script determine it based on player's position)
		#output: none
		[
			(store_script_param,":order",1),
			(store_script_param,":pos",2),
			(get_player_agent_no,":player_agent"),
			(agent_get_team,":player_team",":player_agent"),
			(set_show_messages,0),
			(try_begin),(eq,"$prsnt_tac_div1_is_selected",1),(team_give_order,":player_team",grd_1,":order"),(try_end),
			(try_begin),(eq,"$prsnt_tac_div2_is_selected",1),(team_give_order,":player_team",grd_2,":order"),(try_end),
			(try_begin),(eq,"$prsnt_tac_div3_is_selected",1),(team_give_order,":player_team",grd_3,":order"),(try_end),
			(try_begin),(eq,"$prsnt_tac_div4_is_selected",1),(team_give_order,":player_team",grd_4,":order"),(try_end),
			(try_begin),(eq,"$prsnt_tac_div5_is_selected",1),(team_give_order,":player_team",grd_5,":order"),(try_end),
			(try_begin),(eq,"$prsnt_tac_div6_is_selected",1),(team_give_order,":player_team",grd_6,":order"),(try_end),
			(try_begin),(eq,"$prsnt_tac_div7_is_selected",1),(team_give_order,":player_team",grd_7,":order"),(try_end),
			(try_begin),(eq,"$prsnt_tac_div8_is_selected",1),(team_give_order,":player_team",grd_8,":order"),(try_end),
			(try_begin),(eq,"$prsnt_tac_div9_is_selected",1),(team_give_order,":player_team",grd_9,":order"),(try_end),
			(set_show_messages,1),
			(try_begin), #mordr_hold is the only order that requires setting its position
				(eq,":order",mordr_hold),
				(try_begin),(neg|is_between,":pos",0,128),(assign,":pos",pos0),(agent_get_position,":pos",":player_agent"),(try_end), #if position not given, use player's position
				(try_begin),(eq,"$prsnt_tac_div1_is_selected",1),(team_set_order_position,":player_team",grd_1,":pos"),(try_end),
				(try_begin),(eq,"$prsnt_tac_div2_is_selected",1),(team_set_order_position,":player_team",grd_2,":pos"),(try_end),
				(try_begin),(eq,"$prsnt_tac_div3_is_selected",1),(team_set_order_position,":player_team",grd_3,":pos"),(try_end),
				(try_begin),(eq,"$prsnt_tac_div4_is_selected",1),(team_set_order_position,":player_team",grd_4,":pos"),(try_end),
				(try_begin),(eq,"$prsnt_tac_div5_is_selected",1),(team_set_order_position,":player_team",grd_5,":pos"),(try_end),
				(try_begin),(eq,"$prsnt_tac_div6_is_selected",1),(team_set_order_position,":player_team",grd_6,":pos"),(try_end),
				(try_begin),(eq,"$prsnt_tac_div7_is_selected",1),(team_set_order_position,":player_team",grd_7,":pos"),(try_end),
				(try_begin),(eq,"$prsnt_tac_div8_is_selected",1),(team_set_order_position,":player_team",grd_8,":pos"),(try_end),
				(try_begin),(eq,"$prsnt_tac_div9_is_selected",1),(team_set_order_position,":player_team",grd_9,":pos"),(try_end),
			(try_end),
		]
	),

 

In module_mission_templates find these trigger definitions:

common_battle_order_panel = 
common_battle_order_panel_tick = 

replace them both with this one:

tactical_overlay_every_frame = (ti_every_frame,0,0,
	[(game_key_clicked,gk_view_orders),],
	[
		#both turning on and off must be controlled from here - otherwise both mission trigger and the presentation would detect the keypress at the same frame, causing problems
		(try_begin),
			(neg|is_presentation_active,"prsnt_tactical_overlay"), #tactical overlay is off
			(start_presentation,"prsnt_tactical_overlay"),
		(else_try),
			(assign,"$prsnt_tac_stop",1), #(presentation_set_duration,0), should be called from the presentation, so that no other presentations get stopped as a side effect
		(try_end),
	]
)

Finally find all instances of (should be 2 lines one after another):

common_battle_order_panel,
common_battle_order_panel_tick,

and each pair replace with this one line:

tactical_overlay_every_frame,

 

You're done, enjoy the presentation!

 

You could also remove the old presentation, because it's no longer in use (it's called "battle"). But doing so is optional.


  • Submitter
  • Submitted
    08/26/2025
  • Category
  • Requirements

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...