#include "zcommon.acs"

int bookslot = 0;
int librarianState = 0;
int librarianPos[3][2];
int playerPos[8][3];
int librarianTID = 12;

bool doorLock[4] = {false,false,false,false};

SCRIPT 01 OPEN	//Sets line and sector specials
{

}

SCRIPT 02 (VOID)
{
	int buttons;
	bool talk = false;
				
				str classFace = "SQAR";
				int color = CR_PURPLE;
				LocalAmbientSound("misc/chat", 127);
				switch (PlayerClass(PlayerNumber()))
				{
					case 0:
						classFace = "SQAR";
						color = CR_TAN;
						break;
					case 1:
					classFace = "SINE";
						color = CR_TAN;
						break;
					default:
						classFace = "SQAR";
						color = CR_TAN;
						break;
				}
				
				SetPlayerProperty(0,1,PROP_TOTALLYFROZEN); 
				
				//begin a conversation scenario
				if (librarianState == 0 && bookslot < 4 && GameType () != GAME_NET_DEATHMATCH)
				{
				
					talk = false;
					messageBox_Clear();
					messageBox_Plain("...","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("... Um... hello?","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("... Yes?\nI'm the librarian.  Can I help you?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("... Well... I was looking for... um...\ncan you tell me where... uh...","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("Something bothering you?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("Oh no, it's nothing, really.","BILFONT",classFace,0,CR_TAN);
					delay(8);
					
					
					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("It's my head, isn't it?","BILFONT",0,CR_TAN);
					delay(8);
					
					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("Well, um...","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("Yes, my head's on backwards.\nCan you please stop staring at it and tell me what you're looking for?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("Oh, right, sorry.\nI think there's supposed to be a passage to the underworld\naround here somewhere.  Can you\ntell me where it is?","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("Well, I DO know what you're talking about,\nbut before I help you, I want you to help me.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("I was put here because I'm a bit too offputting\nto be out with regular people.  Some books are\nmissing from the shelves over there, and it's a bit\nhard for me to find them with my condition and all.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("Could you scout out the missing books?\nThen I'll give you what you need to go underground.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					librarianState = 1;

					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);
				}// end this convo scenario
				
				//begin a conversation scenario
				else if (librarianState == 1 && bookslot == 0 && GameType () != GAME_NET_DEATHMATCH)
				{
					talk = false;
					messageBox_Plain("Those books should be lying around somewhere.\nJust keep looking.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					talk = false;
					messageBox_Plain("AND STOP STARING AT MY HEAD!","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					librarianState = 1;

					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);

				}// end this convo scenario
				
				//begin a conversation scenario
				else if (librarianState == 1 && bookslot > 0 && bookslot < 4 && GameType () != GAME_NET_DEATHMATCH)
				{
					talk = false;
					messageBox_Plain("I'm afraid there are still some more\nbooks missing.  Come back when you find them.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);
				}// end this convo scenario
				
				//begin a conversation scenario
				else if (bookslot == 4 && GameType () != GAME_NET_DEATHMATCH)
				{
					talk = false;
					messageBox_Plain("GREAT!\nNow I won't get fired for inadequacy!","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Plain("Oh, right, you want to go to the underworld?\nLucky for you I have the key right here...","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Plain("...","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Plain("What?\nIt's hard to look through your pockets when\nYOUR HEAD'S ON BACKWARDS!","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					LocalAmbientSound("menu/change", 127);
					thing_spawnNoFog(15,T_REDKEYHUGE,0,0);
					
					talk = false;
					messageBox_Plain("There you go.\nIt's a pretty big key!\nWhatever reasons you have for going to the underworld,\nI hope you have fun down there!","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					librarianState = 2;

					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);
				}// end this convo scenario
				
				//begin a conversation scenario
				else if (librarianState==2 && GameType () != GAME_NET_DEATHMATCH)
				{
					talk = false;
					messageBox_Plain("Are you going to stare at my head all day?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					LocalAmbientSound("menu/change", 127);
					
					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);
				}// end this convo scenario
}//end script

/*
//Talk to woman with her head on backwards
SCRIPT 02 ENTER
{
	librarianPos[0][0] = (GetActorX(librarianTID) - 4800000);
	librarianPos[0][1] = (GetActorX(librarianTID) + 4800000);
	librarianPos[1][0] = (GetActorY(librarianTID) - 4800000);
	librarianPos[1][1] = (GetActorY(librarianTID) + 4800000);
	librarianPos[2][0] = GetActorZ(librarianTID);
	librarianPos[2][1] = (GetActorZ(librarianTID) + 6400000);
	
	int buttons;
	bool talk = false;

	while (TRUE)
  	{
    	buttons = GetPlayerInput(-1, INPUT_BUTTONS);
    	if (buttons & BT_USE)
		{
		
			if (GetActorX(0) >= librarianPos[0][0] && GetActorX(0) <= librarianPos[0][1] &&
				GetActorY(0) >= librarianPos[1][0] && GetActorY(0) <= librarianPos[1][1] &&
				GetActorZ(0) >= librarianPos[2][0] && GetActorZ(0) <= librarianPos[2][1])
			{
       			talk = true;
				
				str classFace = "SQAR";
				int color = CR_PURPLE;
				LocalAmbientSound("misc/chat", 127);
				switch (PlayerClass(PlayerNumber()))
				{
					case 0:
						classFace = "SQAR";
						color = CR_TAN;
						break;
					case 1:
					classFace = "SINE";
						color = CR_TAN;
						break;
					default:
						classFace = "SQAR";
						color = CR_TAN;
						break;
				}
				
				SetPlayerProperty(0,1,PROP_TOTALLYFROZEN); 
				
				//begin a conversation scenario
				if (librarianState == 0 && bookslot < 4 && GameType () != GAME_NET_DEATHMATCH)
				{
				
					talk = false;
					messageBox_Clear();
					messageBox_Plain("...","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("... Um... hello?","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("... Yes?\nI'm the librarian.  Can I help you?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("... Well... I was looking for... um.../ncan you tell me where... uh...","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("Something bothering you?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("Oh no, it's nothing, really.","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("It's my head, isn't it?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("Well, um...","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("Yes, my head's on backwards.\nCan you please stop staring at it and tell me what you're looking for?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Portrait("Oh, right, sorry.\nI think there's supposed to be a passage to the underworld\naround here somewhere.  Can you\ntell me where it is?","BILFONT",classFace,0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("Well, I DO know what you're talking about,\nbut before I help you, I want you to help me.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("I was put here because I'm a bit too offputting\nto be out with regular people.  Some books are\nmissing from the shelves over there, and it's a bit\nhard for me to find them with my condition and all.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Clear();
					messageBox_Plain("Could you scout out the missing books?\nThen I'll give you what you need to go underground.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					librarianState = 1;

					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);
				}// end this convo scenario
				
				//begin a conversation scenario
				else if (librarianState == 1 && bookslot == 0 && GameType () != GAME_NET_DEATHMATCH)
				{
					talk = false;
					messageBox_Plain("Those books should be lying around somewhere.\nJust keep looking.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Plain("AND STOP STARING AT MY HEAD!","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					librarianState = 1;

					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);

				}// end this convo scenario
				
				//begin a conversation scenario
				else if (librarianState == 1 && bookslot > 0 && bookslot < 4 && GameType () != GAME_NET_DEATHMATCH)
				{
					talk = false;
					messageBox_Plain("I'm afraid there are still some more\nbooks missing.  Come back when you find them.","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}

					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);
				}// end this convo scenario
				
				//begin a conversation scenario
				else if (bookslot == 4 && GameType () != GAME_NET_DEATHMATCH)
				{
					talk = false;
					messageBox_Plain("GREAT!\nNow I won't get fired for inadequacy!","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Plain("Oh, right, you want to go to the underworld?\nLucky for you I have the key right here...","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Plain("...","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					talk = false;
					messageBox_Plain("What?\nIt's hard to look through your pockets when\nYOUR HEAD'S ON BACKWARDS!","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					thing_spawnNoFog(15,T_REDKEYHUGE,0,0);
					
					talk = false;
					messageBox_Plain("There you go.\nIt's a pretty big key!\nWhatever reasons you have for going to the underworld,\nI hope you have fun down there!","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}
					
					librarianState = 2;

					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);
				}// end this convo scenario
				
				//begin a conversation scenario
				else if (librarianState==2 && GameType () != GAME_NET_DEATHMATCH)
				{
					talk = false;
					messageBox_Plain("Are you going to stare at my head all day?","BILFONT",0,CR_TAN);
					delay(8);

					while (talk == false)
					{
						buttons = GetPlayerInput(-1, INPUT_BUTTONS);
						if (buttons & BT_USE)
							talk = true;
						delay(1);
					}

					talk = false;
					messageBox_Clear();
					SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
					delay(8);
				}// end this convo scenario
				
    		} //end convo tree
  		} //end buttonpress
		delay(1);
	}//end while true
}//end script
*/

//Used for locked doors that open via polyobjects.
//Speed determines direction (positive = clockwise, negative = counter)
SCRIPT 03 (int poly)
{
	Polyobj_DoorSwing(poly,32,64,64);
}

//Used for locked doors that require dinky keys
SCRIPT 04 (int doorNum, int poly) // locked door
{
 if (doorLock[doorNum] == true || GameType () == GAME_NET_DEATHMATCH)
	Polyobj_DoorSwing(poly, 32, 64, 64);

 else if (CheckInventory("DinkyKey") == 0 && doorLock[doorNum] == false && GameType () != GAME_NET_DEATHMATCH)
	Print(s:"THIS DOOR IS LOCKED");
  
 else if (CheckInventory("DinkyKey") > 0 && doorLock[doorNum] == false && GameType () != GAME_NET_DEATHMATCH)
 {
  doorLock[doorNum] = true;
  TakeInventory("DinkyKey", 1);
  SectorSound("DOORUNLOCKED",127);
  delay(16);
  Polyobj_DoorSwing(poly, 32, 64, 64);
 }
}


//Locked door that raises up instead of swinging
SCRIPT 05 (int doorNum, int tag)
{
 If (doorLock[doorNum] == true || GameType () == GAME_NET_DEATHMATCH)
	Door_raise(tag, 24, 32, 64);

 Else If (CheckInventory("DinkyKey") == 0 && doorLock[doorNum] == false && GameType () != GAME_NET_DEATHMATCH)
	Print(s:"THIS DOOR IS LOCKED");
  
 else if (CheckInventory("DinkyKey") > 0 && doorLock[doorNum] == false && GameType () != GAME_NET_DEATHMATCH)
 {
  doorLock[doorNum] = true;
  TakeInventory("DinkyKey", 1);
  SectorSound("DOORUNLOCKED",127);
  delay(16);
  Door_raise(tag, 24, 32, 64);
 }
}

script 06 (int slot, int line)
{
	str tex = "HLIB_001";
	switch (slot)
	{
		case 0:	tex = "HLIB_002";
				break;
		case 1:	tex = "HLIB_003";
				break;
		case 2:	tex = "HLIB_004";
				break;
		case 3:	tex = "HLIB_005";
				break;
		
	}
    SetLineTexture(line, SIDE_FRONT, TEXTURE_BOTTOM, tex); //remove middle 
	bookslot++;
}

//Raises platforms to key
script 07 (int startTag, int endTag, int amount)
{
	int time = 32;
	for (int count = startTag; count <= endTag; count++)
	{
		Floor_RaiseByValue(count,32,amount);
		if (time > 0)
			delay(time);
		else if (time == 0)
			tagWait(count);
	}
}

/*  
	Function to make platforms that raise to the same level
	in a sequence, beginning with starttag and ending with
	endtag.  If delay time is 0, the next platform waits
	for the previous one to finish moving before rising.
*/

/*
special 66: Plat_raiseSequence(int startTag,int endTag,int speed,int amount,int time)
{
	for (int count = startTag; count <= endTag; count++)
	{
		Floor_RaiseByValue(count,speed,amount);
		if (time > 0)
			delay(time);
		else if (time == 0)
			tagWait(count);
	}
}
*/

/*
//Keeps track of the players positions
SCRIPT 02 ENTER
{
	while (TRUE)
	{
		librarianPos[0][0] = (GetActorX(librarianTID) - 4800000);
		librarianPos[0][1] = (GetActorX(librarianTID) + 4800000);
		librarianPos[1][0] = (GetActorY(librarianTID) - 4800000);
		librarianPos[1][1] = (GetActorY(librarianTID) + 4800000);
		librarianPos[2][0] = GetActorZ(librarianTID);
		librarianPos[2][1] = (GetActorZ(librarianTID) + 6400000);
	
		printbold(s:"TARGET: X: ",d:librarianPos[0][0],s:" - ",d:librarianPos[0][1],s:" Y: ",d:librarianPos[1][0],s:" - ",d:librarianPos[1][1],s:" Z: ",d:librarianPos[2][0],s:" - ",d:librarianPos[2][1],s:"\nYOUR LOCATION: X: ",d:GetActorX(0),s:" Y: ",d:GetActorY(0),s:" Z: ",d:GetActorZ(0));
		delay(1);
	}
}
*/