// Reset Mirror v1.0
// resetmirror.txt
// by Kelandon (tomwatts@berkeley.edu)
//
// When this script finds a mirror on itself, it sends the
// mirror to a place that you specify in the memory cells. Ideally, that should
// be a "safe" place, one where other objects (like mirrors) can't be, because 
// if there is an object of any kind there, it will get written over.

// Memory Cells - 
//   0,1 - x,y coordinates to send the mirror

beginterrainscript; 

variables;

body;

beginstate INIT_STATE;
	set_script_mode(3);
break;

beginstate START_STATE;
if ((is_object_on_space(my_loc_x(),my_loc_y(),5) == 0) && (is_object_on_space(my_loc_x(),my_loc_y(),6) == 0))
	end();
	
	if (is_object_on_space(my_loc_x(),my_loc_y(),5) == 1)
		{put_object_on_space(my_loc_x(),my_loc_y(),-1);
		put_object_on_space(get_memory_cell(0),get_memory_cell(1),5);
		print_str("The mirror vanishes and reappears elsewhere!"); }
		
	if (is_object_on_space(my_loc_x(),my_loc_y(),6) == 1)
		{put_object_on_space(my_loc_x(),my_loc_y(),-1);
		put_object_on_space(get_memory_cell(0),get_memory_cell(1),6);
		print_str("The mirror vanishes and reappears elsewhere!"); }
break;

beginstate SEARCH_STATE;
break;
