	[set_menu_item]
		id=search
		description=_ "Search"
		[show_if]
			[variable]
				name=scenario_number
				equals={SCEN}
			[/variable]
		[/show_if]
		[filter_location]
			[filter]
				side=1
			[/filter]			
		[/filter_location]
		[command]
			{VARIABLE check_floor true}
			[if]
				[variable]
					name=p_$x1|_$y1|_q_0
					equals=1
				[/variable]
			[then]
				{VARIABLE_OP check_floor value false}
				[message]
					x=$x1
					y=$y1
					message=_ "Which of the following shall I do?"
					[option]
						message=_ "Investigate $p_$x1|_$y1|_q_name"
						[command]
							{FM_INVESTIGATE $x1 $y1}
						[/command]
					[/option]
					[option]
						message=_ "Check the floor for items"
						[command]
							{VARIABLE_OP check_floor value true}
						[/command]
					[/option]
					[option]
						message=_ "Ignore"
						[command]
						[/command]
					[/option]
				[/message]
			[/then]
			[/if]
			
			[if]
				[variable]
					name=check_floor
					equals=true
				[/variable]
			[then]
				[store_unit]
					variable=item_unit
					[filter]
						x=$x1
						y=$y1
						side=1
					[/filter]
				[/store_unit]
				[if]
					[variable]
						name=p_$x1|_$y1|_s_0
						not_equals=0
					[/variable]
				[then]
					{VARIABLE_OP pos_1 to_variable p_$x1|_$y1|_s_1}
					{VARIABLE_OP pos_1_name to_variable p_$x1|_$y1|_s_1_name}
					{VARIABLE_OP pos_1_file to_variable p_$x1|_$y1|_s_1_file}
					{VARIABLE_OP pos_1_type to_variable p_$x1|_$y1|_s_1_type}
					{VARIABLE_OP pos_2 to_variable p_$x1|_$y1|_s_2}
					{VARIABLE_OP pos_2_name to_variable p_$x1|_$y1|_s_2_name}
					{VARIABLE_OP pos_2_file to_variable p_$x1|_$y1|_s_2_file}
					{VARIABLE_OP pos_2_type to_variable p_$x1|_$y1|_s_2_type}
					{VARIABLE_OP pos_3 to_variable p_$x1|_$y1|_s_3}
					{VARIABLE_OP pos_3_name to_variable p_$x1|_$y1|_s_3_name}
					{VARIABLE_OP pos_3_file to_variable p_$x1|_$y1|_s_3_file}
					{VARIABLE_OP pos_3_type to_variable p_$x1|_$y1|_s_3_type}
					{VARIABLE_OP pos_4 to_variable p_$x1|_$y1|_s_4}
					{VARIABLE_OP pos_4_name to_variable p_$x1|_$y1|_s_4_name}
					{VARIABLE_OP pos_4_file to_variable p_$x1|_$y1|_s_4_file}
					{VARIABLE_OP pos_4_type to_variable p_$x1|_$y1|_s_4_type}
					{VARIABLE_OP pos_5 to_variable p_$x1|_$y1|_s_5}
					{VARIABLE_OP pos_5_name to_variable p_$x1|_$y1|_s_5_name}
					{VARIABLE_OP pos_5_file to_variable p_$x1|_$y1|_s_5_file}
					{VARIABLE_OP pos_5_type to_variable p_$x1|_$y1|_s_5_type}
					
					[message]
						x=$x1
						y=$y1
						message=_ "I found something on the floor. What shall I do?"
						
						[option]
							[show_if]
								[variable]
									name=pos_1
									not_equals=0
								[/variable]
							[/show_if]
							
							message=_ "Pick up $pos_1_name"
							[command]
								[if]
									[variable]
										name=item_unit.variables.isholdingitem
										equals=0
									[/variable]
								[then]
									[removeitem]
										x=$x1
										y=$y1
									[/removeitem]
									{VARIABLE_OP item_unit.variables.theitem format $pos_1}
									{VARIABLE_OP item_unit.variables.isholdingitem value 1}
									{VARIABLE_OP item_unit.variables.theitemname format $pos_1_name}
									{VARIABLE_OP item_unit.variables.theitemfile format $pos_1_file}
									{VARIABLE_OP item_unit.variables.theitemtype format $pos_1_type}
									[unstore_unit]
										variable=item_unit
									[/unstore_unit]
									[unit_overlay]
										x=$x1
										y=$y1
										image=$pos_1_file
									[/unit_overlay]
									{VARIABLE_OP p_$x1|_$y1|_s_1 value 0}
									{VARIABLE_OP p_$x1|_$y1|_s_0 add -1}
									
									{VARIABLE Repeat_i 1}
									[while]
										[variable]
											name=Repeat_i
											less_than=6
										[/variable]

										[do]
											[if]
												[variable]
													name=p_$x1|_$y1|_s_$Repeat_i
													not_equals=0
												[/variable]
											[then]
												{VARIABLE_OP pos_i_file to_variable p_$x1|_$y1|_s_$Repeat_i|_file}
												[item]
													x=$x1
													y=$y1
													image=$pos_i_file
												[/item]
											[/then]
											[/if]
											{VARIABLE_OP Repeat_i add 1}
										[/do]
									[/while]
									{CLEAR_VARIABLE Repeat_i}
									{CLEAR_VARIABLE pos_i_file}
								[/then]
								[else]
									[message]
										x=$x1
										y=$y1
										message=_ "I can't carry any more items."
									[/message]
								[/else]
								[/if]
							[/command]
						[/option]
						[option]
							[show_if]
								[variable]
									name=pos_2
									not_equals=0
								[/variable]
							[/show_if]
							
							message=_ "Pick up $pos_2_name"
							[command]
								[if]
									[variable]
										name=item_unit.variables.isholdingitem
										equals=0
									[/variable]
								[then]
									[removeitem]
										x=$x1
										y=$y1
									[/removeitem]
									{VARIABLE_OP item_unit.variables.theitem format $pos_2}
									{VARIABLE_OP item_unit.variables.isholdingitem value 1}
									{VARIABLE_OP item_unit.variables.theitemname format $pos_2_name}
									{VARIABLE_OP item_unit.variables.theitemfile format $pos_2_file}
									{VARIABLE_OP item_unit.variables.theitemtype format $pos_2_type}
									[unstore_unit]
										variable=item_unit
									[/unstore_unit]
									[unit_overlay]
										x=$x1
										y=$y1
										image=$pos_2_file
									[/unit_overlay]
									{VARIABLE_OP p_$x1|_$y1|_s_2 value 0}
									{VARIABLE_OP p_$x1|_$y1|_s_0 add -1}
									
									{VARIABLE Repeat_i 1}
									[while]
										[variable]
											name=Repeat_i
											less_than=6
										[/variable]

										[do]
											[if]
												[variable]
													name=p_$x1|_$y1|_s_$Repeat_i
													not_equals=0
												[/variable]
											[then]
												{VARIABLE_OP pos_i_file to_variable p_$x1|_$y1|_s_$Repeat_i|_file}
												[item]
													x=$x1
													y=$y1
													image=$pos_i_file
												[/item]
											[/then]
											[/if]
											{VARIABLE_OP Repeat_i add 1}
										[/do]
									[/while]
									{CLEAR_VARIABLE Repeat_i}
									{CLEAR_VARIABLE pos_i_file}
								[/then]
								[else]
									[message]
										x=$x1
										y=$y1
										message=_ "I can't carry any more items."
									[/message]
								[/else]
								[/if]
							[/command]
						[/option]
						[option]
							[show_if]
								[variable]
									name=pos_3
									not_equals=0
								[/variable]
							[/show_if]
							
							message=_ "Pick up $pos_3_name"
							[command]
								[if]
									[variable]
										name=item_unit.variables.isholdingitem
										equals=0
									[/variable]
								[then]
									[removeitem]
										x=$x1
										y=$y1
									[/removeitem]
									{VARIABLE_OP item_unit.variables.theitem format $pos_3}
									{VARIABLE_OP item_unit.variables.isholdingitem value 1}
									{VARIABLE_OP item_unit.variables.theitemname format $pos_3_name}
									{VARIABLE_OP item_unit.variables.theitemfile format $pos_3_file}
									{VARIABLE_OP item_unit.variables.theitemtype format $pos_3_type}
									[unstore_unit]
										variable=item_unit
									[/unstore_unit]
									[unit_overlay]
										x=$x1
										y=$y1
										image=$pos_3_file
									[/unit_overlay]
									{VARIABLE_OP p_$x1|_$y1|_s_3 value 0}
									{VARIABLE_OP p_$x1|_$y1|_s_0 add -1}
									
									{VARIABLE Repeat_i 1}
									[while]
										[variable]
											name=Repeat_i
											less_than=6
										[/variable]

										[do]
											[if]
												[variable]
													name=p_$x1|_$y1|_s_$Repeat_i
													not_equals=0
												[/variable]
											[then]
												{VARIABLE_OP pos_i_file to_variable p_$x1|_$y1|_s_$Repeat_i|_file}
												[item]
													x=$x1
													y=$y1
													image=$pos_i_file
												[/item]
											[/then]
											[/if]
											{VARIABLE_OP Repeat_i add 1}
										[/do]
									[/while]
									{CLEAR_VARIABLE Repeat_i}
									{CLEAR_VARIABLE pos_i_file}
								[/then]
								[else]
									[message]
										x=$x1
										y=$y1
										message=_ "I can't carry any more items."
									[/message]
								[/else]
								[/if]
							[/command]
						[/option]
						[option]
							[show_if]
								[variable]
									name=pos_4
									not_equals=0
								[/variable]
							[/show_if]
							
							message=_ "Pick up $pos_4_name"
							[command]
								[if]
									[variable]
										name=item_unit.variables.isholdingitem
										equals=0
									[/variable]
								[then]
									[removeitem]
										x=$x1
										y=$y1
									[/removeitem]
									{VARIABLE_OP item_unit.variables.theitem format $pos_4}
									{VARIABLE_OP item_unit.variables.isholdingitem value 1}
									{VARIABLE_OP item_unit.variables.theitemname format $pos_4_name}
									{VARIABLE_OP item_unit.variables.theitemfile format $pos_4_file}
									{VARIABLE_OP item_unit.variables.theitemtype format $pos_4_type}
									[unstore_unit]
										variable=item_unit
									[/unstore_unit]
									[unit_overlay]
										x=$x1
										y=$y1
										image=$pos_4_file
									[/unit_overlay]
									{VARIABLE_OP p_$x1|_$y1|_s_4 value 0}
									{VARIABLE_OP p_$x1|_$y1|_s_0 add -1}
									
									{VARIABLE Repeat_i 1}
									[while]
										[variable]
											name=Repeat_i
											less_than=6
										[/variable]

										[do]
											[if]
												[variable]
													name=p_$x1|_$y1|_s_$Repeat_i
													not_equals=0
												[/variable]
											[then]
												{VARIABLE_OP pos_i_file to_variable p_$x1|_$y1|_s_$Repeat_i|_file}
												[item]
													x=$x1
													y=$y1
													image=$pos_i_file
												[/item]
											[/then]
											[/if]
											{VARIABLE_OP Repeat_i add 1}
										[/do]
									[/while]
									{CLEAR_VARIABLE Repeat_i}
									{CLEAR_VARIABLE pos_i_file}
								[/then]
								[else]
									[message]
										x=$x1
										y=$y1
										message=_ "I can't carry any more items."
									[/message]
								[/else]
								[/if]
							[/command]
						[/option]
						[option]
							[show_if]
								[variable]
									name=pos_5
									not_equals=0
								[/variable]
							[/show_if]
							
							message=_ "Pick up $pos_5_name"
							[command]
								[if]
									[variable]
										name=item_unit.variables.isholdingitem
										equals=0
									[/variable]
								[then]
									[removeitem]
										x=$x1
										y=$y1
									[/removeitem]
									{VARIABLE_OP item_unit.variables.theitem format $pos_5}
									{VARIABLE_OP item_unit.variables.isholdingitem value 1}
									{VARIABLE_OP item_unit.variables.theitemname format $pos_5_name}
									{VARIABLE_OP item_unit.variables.theitemfile format $pos_5_file}
									{VARIABLE_OP item_unit.variables.theitemtype format $pos_5_type}
									[unstore_unit]
										variable=item_unit
									[/unstore_unit]
									[unit_overlay]
										x=$x1
										y=$y1
										image=$pos_5_file
									[/unit_overlay]
									{VARIABLE_OP p_$x1|_$y1|_s_5 value 0}
									{VARIABLE_OP p_$x1|_$y1|_s_0 add -1}
									
									{VARIABLE Repeat_i 1}
									[while]
										[variable]
											name=Repeat_i
											less_than=6
										[/variable]

										[do]
											[if]
												[variable]
													name=p_$x1|_$y1|_s_$Repeat_i
													not_equals=0
												[/variable]
											[then]
												{VARIABLE_OP pos_i_file to_variable p_$x1|_$y1|_s_$Repeat_i|_file}
												[item]
													x=$x1
													y=$y1
													image=$pos_i_file
												[/item]
											[/then]
											[/if]
											{VARIABLE_OP Repeat_i add 1}
										[/do]
									[/while]
									{CLEAR_VARIABLE Repeat_i}
									{CLEAR_VARIABLE pos_i_file}
								[/then]
								[else]
									[message]
										x=$x1
										y=$y1
										message=_ "I can't carry any more items."
									[/message]
								[/else]
								[/if]
							[/command]
						[/option]
						[option]
							message=_ "Ignore"
							[command]
							[/command]
						[/option]
					[/message]
				[/then]
				[else]
					[message]
						x=$x1
						y=$y1
						message=_ "There is nothing of interest here."
					[/message]
				[/else]
				[/if]
			[/then]
			[/if]
		[/command]
	[/set_menu_item]