Someone, I forgot who, posted a request for a locked door script. Just as I was about to post the cog, the thread was deleted. So, to prevent my 30 seconds of work from going to waste, here is the cog.
And no, I did not seXorz this cog.
------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.
JK editing resources.
Code:
# Key - Door script. Variable key.
#
# Version 1.5
#
# 03 - 08/2002 GBK
Symbols
Message Activated
Message Arrived
Message Blocked
Message Timer
Thing Door
Thing Player Local
Flex Door_speed=4.0
Flex Door_sleep=4.0
Int Key_num #Bin number of the required key.
Int Take_away=0 #Take away key after use? 0 = no.
Int UNI_num #UNI string number. -1 for none.
Sound Locked #Sound to play when locked.
Sound Voice #Sound for voice.
Int D=1 Local
End
Code
Activated: Player = Getsourceref();
If(Isthingmoving(Door) != 0 || Getcurframe(Door) != 0) Stop;
If(Getinv(Player, Key_num) == 1) {
If(Take_away != 0) Setinv(Player, Key_num, 0);
Movetoframe(Door, 1, Door_speed); }
Else { If(D) { D=0; Playsoundthing(Voice, Player, 1, 0, 4, 0); }
If(UNI_num != -1) JKprintUNIstring(Player, UNI_num);
Playsoundthing(Locked, Player, 1, 0, 4, 0); } Stop;
Arrived: If(Getcurframe(Door) == 1) Settimer(Door_sleep); Stop;
Blocked: If(Getgoalframe(Door) == 0) { Stopthing(Door);
Movetoframe(Door, 1, Door_speed); }
Else { Stopthing(Door);
Movetoframe(Door, 0, Door_speed); } Stop;
Timer: Movetoframe(Door, 0, Door_speed);
Stop;
EndAnd no, I did not seXorz this cog.
------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.
JK editing resources.
And when the moment is right, I'm gonna fly a kite.

![http://forums.massassi.net/html/smile.gif [http://forums.massassi.net/html/smile.gif]](http://forums.massassi.net/html/smile.gif)
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)
![http://forums.massassi.net/html/frown.gif [http://forums.massassi.net/html/frown.gif]](http://forums.massassi.net/html/frown.gif)