//The different states:
//0: Closed
//1: Open
//------------------------------------------------------------------
//Just in case
IfSpawned
  tmpargument = passage
  ClosePassage

//------------------------------------------------------------------
// Someone cast an unlock spell
IfOrdered
  tmpx = selforder
  tmpy = 491  			// The unique code for an unlock order
  IfXIsEqualToY
    tmpargument = 0		    // Is it closed?
    IfStateIs
      tmpargument = 1
      SendMessageNear		//Tell it dint work
      PlaySound
//------------------------------------------------------------------
// Handle the animation and sound
tmpargument = passage	// Is the passage clear?
IfPassageOpen			//
  IfStateIs0			  // State 0 ( Closed )
    tmpargument = ACTIONMG	    //
    DoAction			    //
      tmpargument = 1		      // Open it
      SetState			      //
      tmpargument = 0		      //Spooky sounds
      PlayFullSound
      KeepAction
      SendMessage
Else
  IfStateIs1			  // State 1 ( Open )
    tmpargument = ACTIONMJ
    DoAction
      tmpargument = 0		      // Close it
      SetState
      KeepAction

//------------------------------------------------------------------
End				// Finished with this character
//------------------------------------------------------------------
