//secdoor.txt - A switch that opens a secret door.
// Cell 0,1 - The coordinate of the door.
// Cell 2 - The necessary tool use skill.
// Cell 3,4 - The SDF to set to 1 when used, ignored if left at 0.

beginobjectscript; // door lever

variables;


body;


beginstate INIT_STATE;

	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; 

break;

beginstate USE_STATE;
	if (get_terrain(on_which_layer(),get_memory_cell(0),get_memory_cell(1)) == 0) {
		print_str_color("Hidden Switch: You press the button. There is a soft click.",2);
		print_str_color("  Nothing else happens.",2);
		end();
		}

	if (get_stat_total(24) < get_memory_cell(2)) {
		print_str_color("Hidden Switch: You think that there is a concealed control here,",2);
		print_str_color("  but you can't figure out how to get it to work.",2);
		end();
		}

	print_str_color("Hidden Switch: You press the button. You hear stone grinding on stone.",2);
	run_hardcode(1023);
	set_terrain(on_which_layer(),get_memory_cell(0),get_memory_cell(1),0);
	play_sound(16); 
	play_sound(20); 
	sf(190,6,1); 
	if ((get_memory_cell(3) != 0) || (get_memory_cell(4) != 0))
		inc_flag(get_memory_cell(3),get_memory_cell(4),1);
break;
