Author Topic: Simple Automatic doors  (Read 4749 times)

0 Members and 1 Guest are viewing this topic.

Offline Cloudee1

Simple Automatic doors
« on: December 17, 2006, 04:26:51 PM »
When using Doors and AutoDoors, I am not sure why but things always seemed to go awry. This little tutorial will have a simple Automatic Door (when the player walks near them, they open) up and running with two simple lines of code.

We begin at the very top of the script. We will need to tell the script that we are going to be using an automaic door and to include that functionality. This is done simply by adding in another use command where all of the others are.

Code: [Select]
(use "autodoor")
Now that one line is finished, lets go on to the second one, the hard one. Just kidding, there is nothing hard to this method of using automatic doors. The script can now handle AutoDoor instances now, but we are not making one of those, at least not the traditional way. In the rooms init method, where you init() your rooms views and actors, you will need to add in the call that inits the automatic door. the parameters are of the basic type, and I don't think it's necesary to go into detail about them.

Code: [Select]
(send (AutoDoor:new()):view(211)
                       posn(161 62)

At this point, as long as you have added the doors view, and have set up the doors control colors Navy and Green (you won't need a Yellow one because this type of door does not get blocked) for when to open or transport to a new room. We don't need to create an instance or anything else, we are all done coding.

This simple type of door has some limitations though, because there is not an instance name to reference you won't be able to program interactions with it as the code stands now. So keep this in mind. This door can't be locked or blocked, if all you need is a door that opens when you near it, then you are all set.
« Last Edit: December 17, 2006, 10:23:14 PM by Cloudee1 »

Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline gumby

Re: Simple Automatic doors
« Reply #1 on: June 15, 2010, 09:54:33 PM »
I have no problem setting up a single autodoor, but will the autodoor script support multiple doors in a single room?  I attempted to set the roomCtrl & doorCtrl values in the initialization, but all hell broke loose when I have multiple doors.

Furthermore, looking at the default values for the roomCtrl & doorCtrl (4 and 2, respectively) in the autodoor script, they don't make sense to me.  It seems to me that the roomCtrl should have the value of 2 (for green) and the doorCtrl should have the value of 1 (for blue).  Maybe these values have nothing to do with the colors...  or do I need to specify something additionally in a color pallet somewhere?
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Simple Automatic doors
« Reply #2 on: June 16, 2010, 09:12:54 PM »
Ah!  Sure enough, I was missing something.  The colors are all enumerated here in the tutorial 'Advanced Use of Control Areas'.

I highly recommend anyone wanting to do anything special with doors (or any other control based logic) to read this section!
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.098 seconds with 25 queries.