Usecode for a door?
Posted: Sat Mar 01, 2003 2:00 pm
I'm trying to figure out how to create Usecode for simple objects like doors so they open and close. I think I have the general idea; I just need a few specifics. Specifically, how do I find out the frame number of an object whose Usecode function was invoked, and how do i change the displayed frame of that object.
Also, I want to confirm that I have the right idea of how to create the code for the object. I assume it would be something like the following:
horizontal_door 0x1B0
{
if( event == 0 )
{
// Nothing
return;
}
else if( event != 1)
return;
if( [frame is closed door] )
[set frame to open door]
else if( [frame is open door] )
[set frame to closed door]
.
.
.
etc (add code for locked doors, magically-locked doors, and so on)
}
-Karl
Also, I want to confirm that I have the right idea of how to create the code for the object. I assume it would be something like the following:
horizontal_door 0x1B0
{
if( event == 0 )
{
// Nothing
return;
}
else if( event != 1)
return;
if( [frame is closed door] )
[set frame to open door]
else if( [frame is open door] )
[set frame to closed door]
.
.
.
etc (add code for locked doors, magically-locked doors, and so on)
}
-Karl