//flaglever.txt - Lever which, when pulled, flips a flag from 0 to 1 and back. No locks
// or other trickery.
//Cell 0,1 - The sdf which is set to 1 or 0 when lever is pulled.
// Cell 2 - skill needed, if 0 none
// Cell 3 - If 1, can't flip back
beginobjectscript; 

variables;

body;

variables;
	short range = 0;
body;

beginstate INIT_STATE;
		if (get_flag(get_memory_cell(0),get_memory_cell(1)) > 0) 
				set_object_icon(ME,11);
				else set_object_icon(ME,10);
	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; // door closed, waiting
break;

beginstate USE_STATE;

	if ((get_memory_cell(0) > 0) || (get_memory_cell(1) > 0)) {
		if (get_flag(get_memory_cell(0),get_memory_cell(1)) > 0) {

				print_str("Pull Lever: You shift the lever to the left position.");
					set_flag(get_memory_cell(0),get_memory_cell(1),0);
					set_object_icon(ME,10);
			}
			else {
				print_str("Pull Lever: You shift the lever to the right position.");
				set_flag(get_memory_cell(0),get_memory_cell(1),1);
				set_object_icon(ME,11);
				}
		}
	play_sound(21);
break;
