beginoutdoorscript;

variables;
short choice = 0;

body;

beginstate 0; //INIT_STATE
break;

beginstate 1; //EXIT_STATE
break;

beginstate 2; //START_STATE
break;

beginstate 10; //Leaving the scenario

	reset_dialog();
	if(get_flag(10,0) < 8) {
		add_dialog_str(0,"The plains of Torlus stretch out ahead of you, undoubtedly full of other adventures to be had. If you wanted to, you could leave this place behind.",0);
		}
	else if((get_flag(4,0) == 0) && (get_flag(5,0) == 0)) {
		add_dialog_str(0,"Having survived the ravages of time, you are awestruck by the beauty of Torlus's wide open plains.",0);
		add_dialog_str(1,"You still don't know what happened to Ethalia and Martha, but that's not stopping you from getting out of here. You're alive, and that's what matters.",0);
		}
	else {
		add_dialog_str(0,"Having survived the ravages of time, you are awestruck by the beauty of Torlus's wide open plains.",0);
		add_dialog_str(1,"Now that you know what happened to Ethalia and Martha, there's nothing really keeping you here. Best of all, you're alive.",0);
		}
	add_dialog_choice(0,"Stay here.");
	add_dialog_choice(1,"Leave the scenario.");
	choice = run_dialog(0);
	
	block_entry(1);
	
	if(choice == 2) {
		reset_dialog();
		//if you didn't follow through on the quest
		if(get_flag(10,0) < 8) {
			add_dialog_str(0,"You wander off into the sunset, happy to let someone else take care of this problem.",0);
			add_dialog_str(1,"THE END",30);
			run_dialog(1);
			end_scenario(0);
			}
		//if you followed through but didn't go see the ending
		else if((get_flag(4,0) == 0) && (get_flag(5,0) == 0)) {
			add_dialog_str(0,"You wander off to the nearest town. Specifically, the nearest tavern. A few strong drinks later and you're pretty certain that the world wasn't destroyed.",0);
			add_dialog_str(1,"Occasionally, one of the tavern's patrons asks you about your adventures. You start trying to explain what you went through, but you can't keep the story straight.",0);
			add_dialog_str(2,"In any event, you made it out alive. You never hear from Martha or Ethalia again.",0);
			add_dialog_str(3,"THE END",30);
			run_dialog(1);
			end_scenario(1);
			}
		//if you banished Ethalia and saw the ruin
		else if(get_flag(4,0) == 1) {
			add_dialog_str(0,"You wander off to the nearest town. Specifically, the nearest tavern. Unfortunately, a few strong drinks aren't enough to stave off your guilty conscience.",0);
			add_dialog_str(1,"Occasionally, one of the tavern's patrons asks you about your adventures. But you don't feel like telling any stories today.",0);
			add_dialog_str(2,"THE END",30);
			run_dialog(1);
			end_scenario(1);
			}
		//if you banished the demon and saw the lab
		else if(get_flag(5,0) == 1) {
			add_dialog_str(0,"You wander off to the nearest town. Specifically, the nearest tavern. After a few strong drinks, you're reasonably certain that you avoided unraveling all of existence.",0);
			add_dialog_str(1,"Eventually, you ask around, and it seems that not a whole lot has changed. Martha is in fact the new director of the lab, and Ethalia left the region over a decade ago.",0);
			add_dialog_str(2,"Still, when people ask you about your adventures, you usually skip over this one. Even you're not sure you believe it, after all.",0);
			add_dialog_str(3,"THE END",30);
			run_dialog(1);
			end_scenario(1);
			}
		}

break;