// screen.txt v1.0
// M. G. Slack - 2006
// (slack at attglobal dot net)
// Simple script, displays some value on a screen-like device when viewed/searched.
// Value read from sdf (if not set displays empty screen).
//
// Memory Cells - 
//   0,1 - Coordinates for a stuff done flag. If these are 0 and 0, screen is blank,
//         otherwise, displays value on screen.

beginterrainscript; 

variables;

short val, choice;
string valline;

body;

beginstate INIT_STATE;
break;

beginstate START_STATE;
break;

beginstate SEARCH_STATE;
	if ((get_memory_cell(0) > 0) || (get_memory_cell(1) > 0)) {
		val = get_flag(get_memory_cell(0), get_memory_cell(1));
		clear_buffer();
		append_string("It is: (");
		append_number(val);
		append_string(")");
		get_buffer_text(valline);
		reset_dialog();
		add_dialog_str(0, "There is a value glowing in the center of the screen.", 0);
		add_dialog_str(1, valline, 20);
		add_dialog_choice(0, "Ok");
		choice = run_dialog(1);
	}
	else {
		message_dialog("The shiny screen is blank and lifeless.", "You can see yourself in it.");
	}
break;
