// teleport.txt
// Pylons for the teleporter system
// Cell 0 - Which pylon this is.

beginobjectscript; // talking object

variables;

body;

beginstate INIT_STATE;
	if (get_flag(171,get_memory_cell(0)) > 0)
		set_object_icon(ME,4);
	break;

beginstate DEAD_STATE;
	break;

beginstate START_STATE; 
	break;

beginstate USE_STATE;
	if ((get_memory_cell(0) == 17) && (gf(170,8) == 0)) {
		begin_talk_mode(6);
		}
	if ((get_memory_cell(0) == 18) && (gf(23,15) == 0)) {
		talk_no_exit(30);
		}
	if ((get_memory_cell(0) == 18) && (gf(23,12) == 0) && (gf(23,13) == 0)) {
		talk_no_exit(37);
		}
	if ((get_memory_cell(0) == 19) && (gf(6,11) == 0)) {
		begin_talk_mode(10);
		}
		
	if ((get_flag(170,2) == 0) && (get_flag(171,get_memory_cell(0)) > 0)) {
		print_str_color("The pylon is still glowing slightly, but you don't know",2);
		print_str_color("  what to do with it. Perhaps someone will teach you someday.",2);			
		}
		else {
			if (get_flag(171,get_memory_cell(0)) == 0) {
				print_str_color("You rest your hand on this stone obelisk. A shock",2);
				print_str_color("  of energy runs up your arm. A flickering orb",2);			
				print_str_color("  of power appears in the top, slowly rotating.",2);			
				set_flag(171,get_memory_cell(0),1);
				play_sound(179);
				run_sparkles_on_object(ME,4,12,1);
				set_object_icon(ME,4);
				}
				else {
					// teleport
					telep_to_ft_aver();
					}
			}
break;


beginstate RUN_ANIM_STATE;
	if (get_flag(171,get_memory_cell(0)) > 0) {
		if (get_ran(1,0,100) < 25) 
			run_sparkles_on_object(ME,5,4,1);
		}
		
		
	break;