This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
bbqroast's profile picture

Computer Craft TURBO Elevator (RP2, RC) (Doors, call buttons, +)

Started by bbqroast, 09 July 2012 - 05:53 AM
bbqroast #1
Posted 09 July 2012 - 07:53 AM
Hey!
This was my afternoon's project, the Computer Craft controlled turbo elevator. I've used Rail Craft, Red Power and Computer Craft (all of these are needed to run the world, I believe all of them have altered configs- which I have included in the downloads).

The tower, seamless doors with buttons to call the elevator. The server was not started so all the doors are closed in this shot (normally the one which the elevator is at will be open).

The server after I have started it.

I hit the call button and the elevator appears, the door opens as well!

A rather simplistic interface, hit any number key to go to that floor.

I hit 2 and was promptly taken to the second floor, the door opens.

The door is closed, but I simply hit the button to bring the elevator to my floor and open it.

The wiring for the doors (on the left) and the vertical elevator track (on the right).
The wiring linking the server to the call buttons and the computers on each floor.

The system consists of two sets of jacketed bundled cable running up and down the building. The first links the client computers and the server together. The second links the server to the vertical Rail Craft elevator rails. There is no rednet usage in this build, I did this because the rednet wires have always failed me and the wireless is publicly broadcasted. On SMP in a populated area (especially on servers with high ranges) this could become a big issue (just the lag from sorting through the messages would be bad enough).

Sadly this means the system is limited to 15 (or 16, I forget) floors (note as of current the clients can only handle numbers 1-9).
World download (install the required mods, then the config and redpower folders go in your .minecraft).
1. Boot up the server (hole in the glass outer wall) run the "elevator" command.
2. Press the call button on the first floor to open the door.
3. Get in the cart, boot up the client computer within the elevator shaft. Run the "elevator" command.
4. Hit 1-9 to be taken to the respective floors (currently only 4 are installed).
World & config download:
http://www.mediafire...ldl5ra4lce9pdh0
Code:
Elevator Server:

quit = false
while quit == false do
local i, i2, i3, i4 = os.pullEvent()
if i == "char" then
  quit = true
end
if i =="redstone" then
  local a = rs.getBundledInput("right")
  if a ~= 0 then
  local b = a/2
  rs.setBundledOutput("left",:)/>/>
  rs.setOutput("front", false)
  end
  if a == 1 then
  rs.setBundledOutput("left",0)
  rs.setOutput("front", true)
  end
end
end
Elevator client (FLOOR is set to the bundled output for that floor, it goes 1,2,4,8 etc).

FLOOR = 4
rsno = {1,2,4,8,16,32,64,128}
pie = true
while pie do
term.clear()
term.setCursorPos(1,1)
write("Floor Number:")
local i, i2 = os.pullEvent()
if i == "char" then
  if i2 == "q" then
   pie = false
  else
   i2 = i2 - 1
   i3 = 2^i2
   rs.setBundledOutput("back",i3)
   sleep(1)
   rs.setBundledOutput("back",0)
  end  
end
if i == "redstone" then
  if rs.getBundledOutput("left") == FLOOR then
   rs.setOutput("back",true)
  end
end
end
Sorry for the crap format, I used the in game editor to whip these together.
The client (or button) sends a flicker of redstone signal on the required channel over the bundled cabling to the server. (White is floor one, Orange floor two, etc). The server then sets the output to the doors and elevator rails (the server is basically just a memory cell storing the last redstone pulse).
Elevator rails move a minecart up when they are powered and down when they are unpowered - they only power rails below them (so if you want to go to floor 3, I turn on floor 3, and all the rails below are powered bringing the Minecart to floor 3).
The whole thing is 6x5, it would be 5x5 if it wasn't for those damn doors!
CHANGELOG
- Made all the PCs autostart with the elevator code
- Doors now shut after 2 seconds (this is far longer than it sounds)
Xfel #2
Posted 09 July 2012 - 03:56 PM
That's amazing! I always thought about building such a thing. You did it.
bbqroast #3
Posted 09 July 2012 - 09:00 PM
That's amazing! I always thought about building such a thing. You did it.
Thanks :)/>/>. It would be great on SMP except the damn computers switch off when you get to far away.
VInethrel #4
Posted 10 July 2012 - 05:12 AM
If they switch off, why not set it up so that the program replaces startup, and stores the data in a file
bbqroast #5
Posted 10 July 2012 - 07:51 AM
If they switch off, why not set it up so that the program replaces startup, and stores the data in a file
No data needs to be stored, well I guess I could store the floor number… But if everyone leaves the chunk then perhaps it is more convenient for the elevator to come back to floor 1? I will replace the startup file now…
Startup file done, I'll work on saving data. I also want to move the door controls to a separate circuit, ideally they would close after 5~ seconds (but the elevator would remain in position).
EDIT: Doors moved to separate circuit, they close 2 seconds after the cart is sent (which is more than enough time, trust me).