Hi!
This is just something that has been bugging me for quite sometime now.
I have made a keyframe, that makes the 09_octdoor turn a full 360° and then move down when I open it, and then go back up and turn another 360° when I close it. Problem is that when I open fine, when I close it won't come up! Why I post this here is because I suspect there is something wrong in the code.
The tempalte of the matter:
And keys: (open)
(close)
Please help!
/Edward
This is just something that has been bugging me for quite sometime now.
I have made a keyframe, that makes the 09_octdoor turn a full 360° and then move down when I open it, and then go back up and turn another 360° when I close it. Problem is that when I open fine, when I close it won't come up! Why I post this here is because I suspect there is something wrong in the code.
Code:
# Door with Keyframe opening.
#
# By Edward
symbols
message activated
message startup
thing door
surface switch1
surface switch2
surface walls1
surface walls2
keyframe opened
keyframe close
sound opening
sound closing
sound closed
int keys=-1 local
int open=0 local
end
#
code
startup:
ClearAdjoinFlags(walls1,0x2);
ClearAdjoinFlags(walls2,0x2);
return;
activated:
If(GetSenderRef()==switch1)
{
if(open==0)
{
open=2;
StopKey(door,keys,0.1);
keys=PlayKey(door,opened,1,0x4);
PlaySoundThing(opening,door,1,-1,10,0xC0);
SetWallCel(switch1,1);
SetWallCel(switch2,1);
sleep(GetKeyLen(opened));
SetAdjoinFlags(walls1,0x2);
SetAdjoinFlags(walls2,0x2);
open=1;
}
else if(open==1)
{
open=2;
StopKey(door,keys,0.1);
ClearAdjoinFlags(walls1,0x2);
ClearAdjoinFlags(walls2,0x2);
keys=PlayKey(door,close,1,0x4);
PlaySoundThing(closing,door,1,-1,10,0xC0);
SetWallCel(switch1,0);
SetWallCel(switch2,0);
sleep(GetKeyLen(close));
open=0;
}
}
Else If(GetSenderRef()==switch2)
{
if(open==0)
{
open=2;
StopKey(door,keys,0.1);
keys=PlayKey(door,opened,1,0x4);
PlaySoundThing(opening,door,1,-1,10,0xC0);
SetWallCel(switch1,1);
SetWallCel(switch2,1);
sleep(GetKeyLen(opened));
SetAdjoinFlags(walls1,0x2);
SetAdjoinFlags(walls2,0x2);
open=1;
}
else if(open==1)
{
open=2;
StopKey(door,keys,0.1);
ClearAdjoinFlags(walls1,0x2);
ClearAdjoinFlags(walls2,0x2);
keys=PlayKey(door,close,1,0x4);
PlaySoundThing(closing,door,1,-1,10,0xC0);
SetWallCel(switch1,0);
SetWallCel(switch2,0);
sleep(GetKeyLen(close));
open=0;
}
}
else if(GetSenderRef()==door)
{
PlaySoundThing(closed,door,1,1,10,0xC0);
}
return;
endThe tempalte of the matter:
Code:
octadoor _decor size=.19204 movesize=.19204 model3d=09doct1.3do puppet=ra.pup collide=0
And keys: (open)
Code:
# KEYFRAME OctaClose.key created by Puppet Jedi 0.6
###############
SECTION: HEADER
FLAGS 0x0000
TYPE 0xFFFF
FRAMES 97
FPS 16
JOINTS 1
###############
SECTION: KEYFRAME NODES
NODES 1
NODE 0
MESH NAME OBJECT01
ENTRIES 5
# num: frame: flags: x: y: z: p: y: r:
# dx: dy: dz: dp: dy: dr:
0: 0 0x0003 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 -0.00006250 0.00000000 0.00000000 0.00000000 11.25000000
1: 16 0x0003 0.00000000 -0.00100000 0.00000000 0.00000000 0.00000000 180.00000000
0.00000000 0.00006250 0.00000000 0.00000000 0.00000000 11.25000000
2: 32 0x0000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
3: 48 0x0001 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 -0.00822917 0.00000000 0.00000000 0.00000000
4: 96 0x0001 0.00000000 0.00000000 -0.39500000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000(close)
Code:
# KEYFRAME Untitled.key created by Puppet Jedi 0.6
###############
SECTION: HEADER
FLAGS 0x0000
TYPE 0xFFFF
FRAMES 49
FPS 16
JOINTS 1
###############
SECTION: KEYFRAME NODES
NODES 1
NODE 0
MESH NAME OBJECT01
ENTRIES 8
# num: frame: flags: x: y: z: p: y: r:
# dx: dy: dz: dp: dy: dr:
0: 0 0x0001 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 -0.39600000 0.00000000 0.00000000 0.00000000
1: 1 0x0001 0.00000000 0.00000000 -0.39600000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.02640000 0.00000000 0.00000000 0.00000000
2: 16 0x0003 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 -0.00012500 0.00000000 0.00000000 0.00000000 11.25000000
3: 24 0x0003 0.00000000 -0.00100000 0.00000000 0.00000000 0.00000000 90.00000000
0.00000000 0.00012500 0.00000000 0.00000000 0.00000000 11.25000000
4: 32 0x0003 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 180.00000000
0.00000000 0.00012500 0.00000000 0.00000000 0.00000000 11.25000000
5: 40 0x0003 0.00000000 0.00100000 0.00000000 0.00000000 0.00000000 270.00000000
0.00000000 -0.00012500 0.00000000 0.00000000 0.00000000 11.25000000
6: 48 0x0000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
7: 56 0x0000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000Please help!
/Edward

![http://forums.massassi.net/html/biggrin.gif [http://forums.massassi.net/html/biggrin.gif]](http://forums.massassi.net/html/biggrin.gif)