//Start with door closed
IfSpawned
  tmpargument = passage
  ClosePassage
  tmpargument = ACTIONMJ	    //Closed
  DoAction	
  KeepAction

//Check if someone used a key
IfOrdered
  tmpx = selforder
  tmpy = [OPEN]
  IfXIsEqualToY
    GetContent
    tmpargument = tmpargument +1	//Add one key used
    SetContent

//Do we have enough keys?
tmpargument = 4
IfContentIs			//Need four
  tmpargument = passage
  IfPassageOpen
    DoNothing
  Else
    OpenPassage
    tmpargument = 0
    PlaySound		//Sound and messaging
    SendMessageNear
    tmpargument = ACTIONMG      //Open
    DoAction
    KeepAction
    tmpargument = 14		//Play winnin music
    tmpdistance = 0
    PlayMusic
    BeatModule		//Win it all and such
    EnableExport
    tmpargument = [BEAT]
    AddIDSZ

End
