Community

SCI Programming => Mega Tokyo SCI Archive => Topic started by: AndyPanda on June 27, 2004, 02:51:29 PM

Title: Automatic doors
Post by: AndyPanda on June 27, 2004, 02:51:29 PM
Hi again...
Is there anyone who have a smart way to make automatic sliding doors? I have this:

 (method (doit)
 (super:doit())
    (if(== (send gEgo:onControl()) ctlNAVY)
        (aDoor:(open))
    )(else
    (aDoor:(close))
    )
)

...which obviously doesn't work, since the doors will open constantly while ego is on the Navy control color, and because of that goes into a loop  :P

Title: Re:Automatic doors
Post by: Nychold on June 27, 2004, 04:10:11 PM
Keep an active record of what state the door is in:  closed, opening, open, and closing.  Then, when you hit the navy control line, you just need to examine the state, and change it if necessary.  Exact source code would depend on your implementation and idea. ^^
Title: Re:Automatic doors
Post by: Doan Sephim on June 27, 2004, 04:33:19 PM
for this one i wouldnt use the door class at all. i would just set up a variable (local open = 0) and a view of a door with (for example) ctlGREY as the control color in front and ctlMAROON as the color behind and then do this:
(if(== (send gEgo:onControl()) ctlGREY)
(if(not(open))
(aDoor:setCycle(End)cel(0)loop(0))//draw it to slide or open
= open 1
)(else
)
)
and then to close it, you could draw another control (for example) ctlSILVER around the ctlGREY and put in:
(if(== (send gEgo:onControl()) ctlSILVER)
(if(open)
(aDoor:setCycle(End)cel(0)loop(1))//this loop would need to be the opposite of the other.
= open 0
)(else
)
)
i think that would work...
doan
Title: Re:Automatic doors
Post by: AndyPanda on June 27, 2004, 06:13:22 PM
Just a little misunderstanding from my part. It worked at last. Thanks guys!