#include "zcommon.acs"

int animal[5],		// array for the animal block puzzle
    block[5],		// array for animal block puzzle
    flashtag[11][4],
    simoncount=0,
    maxcount,
    skillspeed,
    flashcount=0,
    ExitDoor=1;
	str string[5];			// array for hint
	bool pad[4];
	bool simonsays[10][4];		// array for flor pad puzzle
	bool trap1=false;

SCRIPT 01 (VOID)
{
 if (block[0] == animal[0] && block[1] == animal[1] && block[2] == animal[2] && block[3] == animal[3] && block[4] == animal[4])
  {
   Thing_Activate(1);
   SectorSound("FANFARE", 127);
   Ceiling_RaiseToNearest(5,16);
  }
 else
 {
   Thing_Deactivate(1);
   Ceiling_LowerToFloor(5,16);
 }
}

SCRIPT 02 (int blocknum)
{
 if (GameType () != GAME_NET_DEATHMATCH)	//does not work in deathmatch
 {
 polyobj_OR_rotateright(blocknum+27,8,64);
 if (block[blocknum] == 3)
  {
   block[blocknum] = 0;
  }
 else
  {
   block[blocknum] ++;
 }
 ACS_EXECUTE(1,0,0,0,0);
 }
}

//look in the mirror
SCRIPT 03 (VOID)
{
 str classFace = "SQAR";
 str classFaceWink = "SQARWINK";
 int color = CR_PURPLE;
 
 int buttons;
 bool ok = false;
 delay(8);
 
 LocalAmbientSound("misc/chat", 127);
 switch (PlayerClass(PlayerNumber()))
 {
 	case CLASS_ADULT_MALE_AKHET :
		classFace = "SQAR";
		classFaceWink = "SQARWINK";
		color = CR_PURPLE;
		break;
	case CLASS_ADULT_FEMALE_AKHET :
		classFace = "SINE";
		classFaceWink = "SINEWINK";
		color = CR_GREEN;
		break;
	default:
		classFace = "SQAR";
		classFaceWink = "SQARWINK";
		color = CR_PURPLE;
		break;
 } 
 SetPlayerProperty(0,1,PROP_TOTALLYFROZEN); 
 messageBox_Portrait("Lookin good!","BILFONT",classFace,0,CR_TAN);
 
 while (ok == false)
	    {
			buttons = GetPlayerInput(-1, INPUT_BUTTONS);
			if (buttons & BT_USE)
				ok = true;
			delay(1);
	    }

 LocalAmbientSound("DING", 127);
 setPortrait(classFaceWink);
 
 ok = false;
 delay(8);
 
 while (ok == false)
	    {
			buttons = GetPlayerInput(-1, INPUT_BUTTONS);
			if (buttons & BT_USE)
				ok = true;
			delay(1);
	    }

 messageBox_Clear();
 SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);  
}

SCRIPT 05 (VOID)
{
 if (GameType () != GAME_NET_DEATHMATCH)
 {
 	SetPlayerProperty(0,1,PROP_TOTALLYFROZEN); 
  	LocalAmbientSound("misc/chat", 127);
	SetFont("BILFONT");
	switch (GameSkill())
	{
	case SKILL_VERY_EASY:
		HudMessage(s:"The ", s:string[2], s:" can unbar the path."; HUDMSG_PLAIN, 1, CR_TAN, -0.01, -0.01, 0);
		break;
	case SKILL_EASY:
		HudMessage(s:"The ", s:string[1], s:" precedes the ", s:string[3], s:"."; 
					 HUDMSG_PLAIN, 1, CR_TAN, -0.01, -0.01, 0);
		break;
	case SKILL_NORMAL:
		HudMessage(s:"The ", s:string[2], s:" is chased by the ", s:string[1], s:"...\n", 
				   s:"And the ", s:string[3], s:" is stalked by the ", s:string[2], s:"."; 
				   HUDMSG_PLAIN, 1, CR_TAN, -0.01, -0.01, 0);
		break;
	case SKILL_HARD:
		HudMessage(s:"The ", s:string[3], s:" outruns the ", s:string[1], s:",\n", 
				   s:"But it cannot catch the ", s:string[4], s:",\n", 
				   s:"And the ", s:string[0], s:" sits behind the ", s:string[1], s:".";
				   HUDMSG_PLAIN, 1, CR_TAN, -0.01, -0.01, 0);
		break;
	case SKILL_VERY_HARD:
		HudMessage(s:"The ", s:string[random(1,2)], s:" cannot catch up to the ", s:string[random(3,4)], s:",\n", 
				   s:"The ", s:string[4], s:" is ahead of the ", s:string[random(2,3)], s:",\n", 
				   s:"The ", s:string[0], s:" looks at the ", s:string[1], s:",\n",
				   s:"And the ", s:string[2], s:" strides ahead of the ", s:string[random(0,1)], s:".";
				   HUDMSG_PLAIN, 1, CR_TAN, -0.01, -0.01, 0);
		break;
	}
	setPlainMsgBox();
	int buttons;
	bool ok = false;
	delay(8);
	while (ok == false)
	{
		buttons = GetPlayerInput(-1, INPUT_BUTTONS);
		if (buttons & BT_USE)
			ok = true;
		delay(1);
	}

	AmbientSound("menu/change",127);
	messageBox_Clear();
	SetPlayerProperty(0,0,PROP_TOTALLYFROZEN); 
 }
}

SCRIPT 06 OPEN // light script
{
 Sector_SetColor(const:10, 255, 255, 255);
 Sector_SetColor(const:11, 255, 255, 255);
 Sector_SetColor(const:12, 255, 255, 255);
 Sector_SetColor(const:13, 255, 255, 255);
 Sector_SetColor(const:14, 255, 255, 255);
 Sector_SetColor(const:15, 255, 255, 255);
 Sector_SetColor(const:16, 255, 255, 255);
 Sector_SetColor(const:9, 0, 255, 255);
 delay(4);
 Sector_SetColor(const:9, 255, 255, 255);
 Sector_SetColor(const:10, 0, 255, 255);
 delay(4);
 Sector_SetColor(const:10, 255, 255, 255);
 Sector_SetColor(const:11, 0, 255, 255);
 delay(4);
 Sector_SetColor(const:11, 255, 255, 255);
 Sector_SetColor(const:12, 0, 255, 255);
 delay(4);
 Sector_SetColor(const:12, 255, 255, 255);
 Sector_SetColor(const:13, 0, 255, 255);
 delay(4);
 Sector_SetColor(const:13, 255, 255, 255);
 Sector_SetColor(const:14, 0, 255, 255);
 delay(4);
 Sector_SetColor(const:14, 255, 255, 255);
 Sector_SetColor(const:15, 0, 255, 255);
 delay(4);
 Sector_SetColor(const:15, 255, 255, 255);
 Sector_SetColor(const:16, 0, 255, 255);
 delay(4);
 Sector_SetColor(const:9, 0, 255, 255);
 Sector_SetColor(const:10, 0, 255, 255);
 Sector_SetColor(const:11, 0, 255, 255);
 Sector_SetColor(const:12, 0, 255, 255);
 Sector_SetColor(const:13, 0, 255, 255);
 Sector_SetColor(const:14, 0, 255, 255);
 Sector_SetColor(const:15, 0, 255, 255);
 Sector_SetColor(const:16, 0, 255, 255);
 delay(8);
 restart;
}

SCRIPT 07 OPEN // light script
{
 Sector_SetColor(const:23, 255, 255, 255);
 Sector_SetColor(const:30, 255, 255, 255);
 Sector_SetColor(const:17, 255, 255, 0);
 Sector_SetColor(const:24, 255, 255, 0);
 delay(4);
 Sector_SetColor(const:17, 255, 255, 255);
 Sector_SetColor(const:24, 255, 255, 255);
 Sector_SetColor(const:18, 255, 255, 0);
 Sector_SetColor(const:25, 255, 255, 0);
 delay(4);
 Sector_SetColor(const:18, 255, 255, 255);
 Sector_SetColor(const:25, 255, 255, 255);
 Sector_SetColor(const:19, 255, 255, 0);
 Sector_SetColor(const:26, 255, 255, 0);
 delay(4);
 Sector_SetColor(const:19, 255, 255, 255);
 Sector_SetColor(const:26, 255, 255, 255);
 Sector_SetColor(const:20, 255, 255, 0);
 Sector_SetColor(const:27, 255, 255, 0);
 delay(4);
 Sector_SetColor(const:20, 255, 255, 255);
 Sector_SetColor(const:27, 255, 255, 255);
 Sector_SetColor(const:21, 255, 255, 0);
 Sector_SetColor(const:28, 255, 255, 0);
 delay(4);
 Sector_SetColor(const:21, 255, 255, 255);
 Sector_SetColor(const:28, 255, 255, 255);
 Sector_SetColor(const:22, 255, 255, 0);
 Sector_SetColor(const:29, 255, 255, 0);
 delay(4);
 Sector_SetColor(const:22, 255, 255, 255);
 Sector_SetColor(const:29, 255, 255, 255);
 Sector_SetColor(const:23, 255, 255, 0);
 Sector_SetColor(const:30, 255, 255, 0);
 delay(4);
 restart;
}

SCRIPT 08 (VOID) // Trap Switch
{
 if (trap1 == false)
 {
 trap1=true;
 Floor_LowerByValue(31,16,32);
 tagwait(31);
 Ceiling_RaiseToNearest(32,16);
 }
}

SCRIPT 09 OPEN // light
{
 light_ChangeToValue(33,160);
 delay(random(0,32));
 light_ChangeToValue(33,150);
 delay(random(0,32));
 light_ChangeToValue(33,140);
 delay(random(0,32));
 light_ChangeToValue(33,130);
 delay(random(0,32));
 light_ChangeToValue(33,120);
 delay(random(0,32));
 light_ChangeToValue(33,110);
 delay(random(0,32));
 light_ChangeToValue(33,100);
 delay(random(0,32));
 light_ChangeToValue(33,110);
 delay(random(0,32));
 light_ChangeToValue(33,120);
 delay(random(0,32));
 light_ChangeToValue(33,130);
 delay(random(0,32));
 light_ChangeToValue(33,140);
 delay(random(0,32));
 light_ChangeToValue(33,150);
 delay(random(0,32));
 restart;
}

SCRIPT 10 (VOID)
{
 if (GameType () != GAME_NET_DEATHMATCH)	//does not work in deathmatch
 {
 Thing_Projectile(2,T_NITARROW,0,128,0);
 /*
 delay(4);
 Thing_Projectile(2,T_NITARROW,0,128,0);
 delay(4);
 Thing_Projectile(2,T_NITARROW,0,128,0);
 delay(4);
 Thing_Projectile(2,T_NITARROW,0,128,0);
 delay(4);
 Thing_Projectile(2,T_NITARROW,0,128,0);
 */
 }
}

SCRIPT 11 OPEN	//Sets line and sector specials
{
 ceiling_Waggle(255,64,8,0,0);	//Water Tide
 
 // Sets sector fade lighting
 Sector_SetFade(const:46, 255, 255, 255);
 Sector_SetFade(const:47, 255, 255, 255);
 Sector_SetFade(const:48, 255, 255, 255);
 Sector_SetFade(const:49, 255, 255, 255);
 Sector_SetFade(const:50, 255, 255, 255);

 /* Sets reflection on the water
 Sector_SetPlaneReflection(255,0,16);
 Sector_SetPlaneReflection(4,32,0);
 Sector_SetPlaneReflection(7,32,0);
 Sector_SetPlaneReflection(8,32,0);
 Sector_SetPlaneReflection(34,32,0);
 */
 if (GameType () != GAME_NET_DEATHMATCH)	//does not work in deathmatch
 {
 // Lineid specials for the simon says pads 
 setlinespecial(5,80,12,1,0);
 setlinespecial(6,80,12,1,1);
 setlinespecial(7,80,12,1,2);
 setlinespecial(8,80,12,1,3);

 // Lineid specials for the animal blocks
 setlinespecial(9,80,2,1,0);
 setlinespecial(10,80,2,1,1);
 setlinespecial(11,80,2,1,2);
 setlinespecial(12,80,2,1,3);
 setlinespecial(13,80,2,1,4);
 }
}

SCRIPT 12 (int padnumber)
{
 // This happens when the player steps on the button.
 // Commented out experimental, unnecessary actions.
 if (pad[padnumber] == false)
 {
  setlinespecial(padnumber+5,0,0,0,0);
 //  Teleport_Nofog(padnumber+4);
  setlineblocking(padnumber+5,BLOCK_EVERYTHING);
  SetPlayerProperty(0,1,PROP_FROZEN);
  Floor_LowerByValue(padnumber+35,16,32);
  tagwait(padnumber+35);
  pad[padnumber] = true;
  ACS_EXECUTE(16,0,0,0,0);
  setlinespecial(padnumber+5,80,12,1,padnumber);
  setlineblocking(padnumber+5,BLOCK_NOTHING);
  SetPlayerProperty(0,0,PROP_FROZEN);
 }

// This happens when the player steps off the button.
else if (pad[padnumber] == true)
 {
  setlinespecial(padnumber+5,0,0,0,0);
  setlineblocking(padnumber+5,BLOCK_EVERYTHING);
  SetPlayerProperty(0,1,PROP_FROZEN);
  Floor_RaiseByValue(padnumber+35,16,32);
  tagwait(padnumber+35);
  pad[padnumber] = false;
  setlinespecial(padnumber+5,80,12,1,padnumber);
  setlineblocking(padnumber+5,BLOCK_NOTHING);
  SetPlayerProperty(0,0,PROP_FROZEN);
 }
}

SCRIPT 16 (VOID)
{
 if (pad[0] == simonsays[simoncount][0] && pad[1] == simonsays[simoncount][1] && pad[2] == simonsays[simoncount][2] && pad[3] == simonsays[simoncount][3])
 {
  simoncount++;
   if (simoncount == maxcount)	//reveals the key
   {
    SectorSound("FANFARE", 127);
    printbold(s:"SEQUENCE COMPLETED!");
    Ceiling_RaiseToNearest(39,16);
    setlinespecial(5,0,0,0,0);
    setlinespecial(6,0,0,0,0);
    setlinespecial(7,0,0,0,0);
    setlinespecial(8,0,0,0,0);
   }
  else
  { 
  SectorSound("ALERT_1", 127);
  print(d:maxcount-simoncount,s:" more to go..."); 
  }
 } 
 else
 {
  SectorSound("ERROR2", 127);
  simoncount=0;
 }  
}

SCRIPT 17 (VOID) // locked door
{
 If (ExitDoor == 2 || GameType () == GAME_NET_DEATHMATCH)
 {
  Polyobj_DoorSwing(15, 16, 64, 32);
 }
 Else If (CheckInventory("DinkyKey") == 0 && ExitDoor == 1 && GameType () != GAME_NET_DEATHMATCH)
 {
  Print(s:"THIS DOOR IS LOCKED");
 }
 else if (CheckInventory("DinkyKey") > 0 && ExitDoor == 1 && GameType () != GAME_NET_DEATHMATCH)
 {
  ExitDoor=2;
  TakeInventory("DinkyKey", 1);
  ThingSound(3,"DOORUNLOCKED",127);
  delay(16);
  Polyobj_DoorSwing(15, 16, 64, 32);
 }
}

SCRIPT 18 OPEN //Sets up for Deathmatch
{
 if (GameType () == GAME_NET_DEATHMATCH)	//ONLY happens in deathmatch
 {
 Ceiling_RaiseToNearest(5,16);
 Ceiling_RaiseToNearest(39,16);
 Door_Open(3,8,0);
 Door_Open(6,16,0);
 }
}

SCRIPT 21 OPEN
{
 if (GameType () != GAME_NET_DEATHMATCH)	//does not work in deathmatch
 {
	For (int count = 0; count < 5; count++)
	{
	 animal[count] = random(0,3);
	 switch (animal[count])
	 {
	  case 0: string[count] = "asp";
		  break;
	  case 1: string[count] = "mau";
		  break;
	  case 2: string[count] = "hawk";
		  break;
	  case 3: string[count] = "jackal";
		  break;
	  default: string[count] = "mysterious animal";
		  break;
	 }
	}

 	if (GameSkill () == SKILL_VERY_EASY)
 	{
	Ceiling_RaiseByValue(43,16,32);
	setlinespecial(9,0,0,0,0);
	setlinespecial(10,0,0,0,0);
	setlinespecial(12,0,0,0,0);
	setlinespecial(13,0,0,0,0);
    	animal[0] = 0;
    	animal[1] = 0;
    	animal[3] = 0;
    	animal[4] = 0;
 	}
 	if (GameSkill () == SKILL_EASY)
 	{
	Ceiling_RaiseByValue(42,16,32);
	Ceiling_RaiseByValue(44,16,32);
	setlinespecial(9,0,0,0,0);
	setlinespecial(11,0,0,0,0);
	setlinespecial(13,0,0,0,0);

    	animal[0] = 0;
    	animal[2] = 0;
    	animal[4] = 0;
 	}
 	if (GameSkill () == SKILL_NORMAL)
 	{
	Ceiling_RaiseByValue(42,16,32);
	Ceiling_RaiseByValue(43,16,32);
	Ceiling_RaiseByValue(44,16,32);
	setlinespecial(9,0,0,0,0);
	setlinespecial(13,0,0,0,0);
    	animal[0] = 0;
    	animal[4] = 0;
 	}
 	if (GameSkill () == SKILL_HARD)
 	{
	Ceiling_RaiseByValue(41,16,32);
	Ceiling_RaiseByValue(42,16,32);
	Ceiling_RaiseByValue(44,16,32);
	Ceiling_RaiseByValue(45,16,32);
	setlinespecial(11,0,0,0,0);
    	animal[2] = 0;
 	}
 	if (GameSkill () == SKILL_VERY_HARD)
 	{
	ceiling_RaiseByValue(41,16,32);
	ceiling_RaiseByValue(42,16,32);
	ceiling_RaiseByValue(43,16,32);
	ceiling_RaiseByValue(44,16,32);
	ceiling_RaiseByValue(45,16,32);
 	}

 }
}

SCRIPT 22 OPEN
{
 //does not happen in deathmatch
 if (GameType () != GAME_NET_DEATHMATCH)
{
 // Changes simonsays amount depending on game skill
 switch (GameSkill ())
 {
  case SKILL_VERY_EASY:	maxcount = 1;
			skillspeed = 5;
			break;
  case SKILL_EASY:	maxcount = random (1,2);
			skillspeed = 4;
			break;
  case SKILL_NORMAL:	maxcount = random (2,3);
			skillspeed = 3;
			break;
  case SKILL_HARD:	maxcount = random (3,4);
			skillspeed = 2;
			break;
  case SKILL_VERY_HARD:	maxcount = random (4,5);
			skillspeed = 1;
			break;
  default:		maxcount = random (1,5);
			skillspeed = random(3,15);
			break;
 }


 // Randomly sets up the simonsays combinations.  In the case of
 // multiple players, pads may need to be pressed SIMULTANEOUSLY!

 for (int count = 0; count < maxcount; count++)
  {
   switch (PlayerCount ())
   {
    case 1:	simonsays[count][random(0,3)] = true;
		break;
    case 2:	simonsays[count][random(0,3)] = true;
		simonsays[count][random(0,3)] = true;
		break;
    case 3:	simonsays[count][random(0,3)] = true;
		simonsays[count][random(0,3)] = true;
		simonsays[count][random(0,3)] = true;
		break;
    default:    simonsays[count][random(0,3)] = true;
		simonsays[count][random(0,3)] = true;
		simonsays[count][random(0,3)] = true;
		simonsays[count][random(0,3)] = true;
		break;
   }
  }

 // Sets up the order the flashing obelisk light hint flashes in.
 for (int count1 = 0; count1 < maxcount; count1++)
 {
  for (int count2 = 0; count2 < 4; count2++)
  {
   switch (simonsays[count1][count2])
   {
    case false:	   flashtag[count1][count2] = 256;
		   break;
    case true:	   flashtag[count1][count2] = count2+46;
		   break;
    default:	   flashtag[count1][count2] = 256;
		   break;
   }
  }
 }
 
 // The last obelisk to flash is always the large one in the middle.
 flashtag[maxcount][0] = 50;
 flashtag[maxcount][1] = 50;
 flashtag[maxcount][2] = 50;
 flashtag[maxcount][3] = 50;
 
 ACS_EXECUTE(23,1,0,0,0);
}
}

SCRIPT 23 (VOID)
{
 // The action of the obelisks changing color as
 // the simonsays puzzle hint.

   Sector_SetColor(flashtag[flashcount][0], 224, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 224, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 224, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 224, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 224, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 224, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 224, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 224, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 192, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 192, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 192, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 192, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 192, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 192, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 192, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 192, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 160, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 160, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 160, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 160, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 160, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 160, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 160, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 160, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 128, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 128, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 128, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 128, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 128, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 128, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 128, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 128, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 96, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 96, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 96, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 96, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 96, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 96, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 96, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 96, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 64, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 64, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 64, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 64, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 64, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 64, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 64, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 64, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 32, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 0, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 0, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 0, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 0, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 0, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 0, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 0, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 0, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 32, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 32, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 32, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 32, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 64, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 64, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 64, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 64, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 64, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 64, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 64, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 64, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 96, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 96, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 96, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 96, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 96, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 96, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 96, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 96, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 128, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 128, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 128, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 128, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 128, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 128, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 128, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 128, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 160, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 160, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 160, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 160, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 160, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 160, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 160, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 160, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 192, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 192, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 192, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 192, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 192, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 192, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 192, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 192, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 224, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 224, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 224, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 224, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 224, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 224, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 224, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 224, 255, 255);
   delay(skillspeed);
   Sector_SetColor(flashtag[flashcount][0], 255, 255, 255);
   Sector_SetColor(flashtag[flashcount][1], 255, 255, 255);
   Sector_SetColor(flashtag[flashcount][2], 255, 255, 255);
   Sector_SetColor(flashtag[flashcount][3], 255, 255, 255);
   Sector_SetFade(flashtag[flashcount][0], 255, 255, 255);
   Sector_SetFade(flashtag[flashcount][1], 255, 255, 255);
   Sector_SetFade(flashtag[flashcount][2], 255, 255, 255);
   Sector_SetFade(flashtag[flashcount][3], 255, 255, 255);
   delay(skillspeed);

// loops back to the start
   
flashcount++;
if (flashcount > maxcount)
   flashcount = 0;

 restart;
}

SCRIPT 24 (VOID)
{
 SetPlayerProperty(0,1,PROP_TOTALLYFROZEN);
 
 //MESSAGE
 LocalAmbientSound("BANANOSAURSIGHT", 127);
 messageBox_Plain("Warble!","BILFONT",0,CR_TAN);
 
 int buttons;
 bool ok = false;
 delay(8);
 while (ok == false)
 {
    buttons = GetPlayerInput(-1, INPUT_BUTTONS);
    if (buttons & BT_USE)
       ok = true;
    delay(1);
 }
 messageBox_Clear();
 
 ok = false;
 
 //MESSAGE
 LocalAmbientSound("menu/change", 127);
 messageBox_Plain("You milked the bananasauros","BILFONT",0,CR_TAN);

 delay(8);
 while (ok == false)
 {
    buttons = GetPlayerInput(-1, INPUT_BUTTONS);
    if (buttons & BT_USE)
       ok = true;
    delay(1);
 }
 
 LocalAmbientSound("PICKUP2", 127);
 delay(32);
 messageBox_Clear();
 
 ACS_EXECUTE(254,0,2,0,0);
 
 //END
 SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
}

//obelisk room hint, since players tend to get stuck.
SCRIPT 25 (VOID)
{
 SetPlayerProperty(0,1,PROP_TOTALLYFROZEN);
 
 //MESSAGE
 LocalAmbientSound("misc/chat", 127);
 messageBox_Plain("To unlock your path,\nmimic the light of the obelisks.","BILFONT",0,CR_TAN);
 
 int buttons;
 bool ok = false;
 delay(8);
 while (ok == false)
 {
    buttons = GetPlayerInput(-1, INPUT_BUTTONS);
    if (buttons & BT_USE)
       ok = true;
    delay(1);
 }
 messageBox_Clear();

 //END
 SetPlayerProperty(0,0,PROP_TOTALLYFROZEN);
}