/////////////////////adding sounds to locked doors /////////////////
SOUND door_lock (locked.wav);// html wouldn't let me use "< >"
SOUND go_away (gway.wav);//change the "(" to "<" around .wav

function _doorevent_check()

{

 handle_touch(); // show mouse touch text, if any

  if(MY.__MOVING == ON) { goto(ignore); }               // don't handle a moving door

  if((EVENT_TYPE == EVENT_SCAN) && (indicator == _HANDLE))

  || (EVENT_TYPE == EVENT_CLICK)

{

  if(MY.__SILENT == OFF) { play_sound(trigger_snd,10); }

   goto(try_key);

}

  if(EVENT_TYPE == EVENT_TRIGGER)

{

  if((MY._CURRENTPOS != MY._ENDPOS) && (TOTAL_FRAMES > (MY._TRIGGERFRAME + 2)))

{

 MY._TRIGGERFRAME = TOTAL_FRAMES;

   goto(try_key);

}

  MY._TRIGGERFRAME = TOTAL_FRAMES;

  _doorevent_close();

}

  if(EVENT_TYPE == EVENT_SONAR)

{

  if(TOTAL_FRAMES > (MY._TRIGGERFRAME + 5))

{

  MY._TRIGGERFRAME = TOTAL_FRAMES;

   goto(try_key);

}

  MY._TRIGGERFRAME = TOTAL_FRAMES;

}

   ignore:

               RESULT = 0;

               return(0);

    try_key:

  if((MY._KEY == 1)&&(key1 == 0)) { msg.STRING = need_key1_str; GOTO message; }

  if((MY._KEY == 2)&&(key2 == 0)) { msg.STRING = need_key2_str; GOTO message; }

  if((MY._KEY == 3)&&(key3 == 0)) { msg.STRING = need_key3_str; GOTO message; }

  if((MY._KEY == 4)&&(key4 == 0)) { msg.STRING = need_key4_str; GOTO message; }

  if((MY._KEY == 5)&&(key5 == 0)) { msg.STRING = need_key5_str;  GOTO message; }

  if((MY._KEY == 6)&&(key6 == 0)) { msg.STRING = need_key6_str;GOTO message;}

  if((MY._KEY == 7)&&(key7 == 0)) { msg.STRING = need_key7_str; GOTO message; }

  if((MY._KEY == 8)&&(key8 == 0)) { msg.STRING = need_key8_str; GOTO message; }

    operate:

               RESULT = 1;

               return(1);

     message:

  if(MY.__SILENT != ON) { show_message(); }

  if(MY.__SILENT != ON)&&(MY._KEY == 4) {play_sound(door_lock,150); }

  if(MY.__SILENT != ON)&&(MY._KEY == 6) {play_sound(go_away,150); }

//if(MY.__SILENT != ON)&&(MY._KEY == 2) {play_sound(door_lock,150); }

                 RESULT = 0;

               return(0);

}

/*

Copy and paste the wdl script file in your level's wdl and it will over ride the default

door function for displaying locked doors.

To add more wav's for other keys just add the lines with the key number

like the ones above. You can place your sound name and which wav file

just above the "function _doorevent_check()" like it is here.

*/

 ////////////////////////////////////////////////////