ampayne2 Posted October 27, 2012 Posted October 27, 2012 Hey guys! Just been working on something all day today and wanted to post it here so I can show you guys my progress on it. When Its done I will make a youtube video for it (and possibly a tutorial) Anyway, some pics: Survival spawn, you can see the elevator there in the middle. There are 6 floors each with player bought and owned shops on them (The higher the shops, the nicer, bigger, and more expensive they are) Each floor has 4 entrances to the elevator, one on each side, and each entrance has a 'call elevator' button to bring the elevator to that floor. Inside of the elevator with buttons to go up a floor and down a floor: Shaft without elevator; you can see the 4 bundled cables that handle the 'call elevator' buttons and the two bundled cables that handle the 'floor up' and 'floor down' buttons. Shaft almost completely covered with gold covers (I got everything covered up but the elevator is in the shaft now and I cant take a screen of it anymore ) The 6 wire outputs of the call elevator buttons; one for every floor: The 10 wire outputs of the floor up and floor down buttons; they are currently hooked to lamps so I could see which floor the elevator was on (Dont have the wiring done yet) I only needed 10 wires because although there are 6 floors, the top floor doesnt need the up button to be wired, and the bottom one doesnt need the down one to be wired. Up and down buttons (Again, just temporary until I get the circuit done) The huge area underneath spawn (kinda overboard), with 45 thermopiles, a bunch of battery boxes, and 2 obsidian towers which the blue alloy wires go up on; when the elevator is on the first floor, it will actually fit all the way down between the two towers perfectly, in the picture it is on the 6th floor: Random view from underneath the elevator looking up: Anyway, I will be working on the circuit that actually controls the whole thing on saturday and sunday, and keep you guys posted If you have any suggestions please let me know! If you would like to help, PM me. (I don't have a server post up yet) And finally, if you have any questions, please ask ^.^ EDIT: I am excited about this project because it is the first major project I have started since building a programmable ticker display in vanilla minecraft. EDIT EDIT: Oops I forgot one picture! This picture shows what the entrance looks like when the elevator is not on your floor, and shows the call elevator button:
The_DarthMoogle Posted October 27, 2012 Posted October 27, 2012 So, when the elevator is on the sixth floor, and you are on the ground floor, you intend to build either - A circuit for each combination of floors? A single circuit that sends the elevator or down down one floor? A single multipurpose circuit capable of changing the length of the output based on the input? Cheat and do it with ComputerCraft?
ampayne2 Posted October 27, 2012 Author Posted October 27, 2012 So, when the elevator is on the sixth floor, and you are on the ground floor, you intend to build either - A circuit for each combination of floors? A single circuit that sends the elevator or down down one floor? A single multipurpose circuit capable of changing the length of the output based on the input? Cheat and do it with ComputerCraft? Ok, here is what I was thinking: Say the height in blocks at ground level is 0, floor 1 is 5, 2 = 10, 3 = 15, 4 = 20, 5 = 25, 6 = 30 (This is not accurate as the total of the floors is 41 and each floor's height varies) The up/down buttons in the elevator would: 1. Get the current height of the elevator 2. Get the height of the floor above/below 3. Do math and figure out how many blocks up/down it needs to move 4. Move up/down to the next floor The call elevator buttons are almost the same but will be a little more complicated: 1. Get the height of the floor the user is on 2. Get the height of the elevator 3. Do math 4. Bring the elevator up/down to the user I could cheat and do this with computercraft, but I am going to try to do this legit. If I fail I will resort to computercraft xD Also, I would say it sounds most like option 3
The_DarthMoogle Posted October 27, 2012 Posted October 27, 2012 Eh.Three is the trickiest, I'm still working out the kinks. And I only have three evenly spaced floors.
ampayne2 Posted October 27, 2012 Author Posted October 27, 2012 3 floors would be... 6 different combinations/circuits 6 floors is 39 different combinations/circuits plus a huge circuit to actually tell the elevator which circuit to use. I think I am going to go with computercraft, but I will still post the program here for anyone who wants to use it :)
The_DarthMoogle Posted October 27, 2012 Posted October 27, 2012 Not necessarily. Check this out. http://forums.technicpack.net/threads/moogles-frames-and-circuits.28990/ What I'm now doing to it, is ramping up the number of inputs, and adding extra counters and timers. It's one circuit, compacted, with multiple inputs altering the length of the two outputs driving the motors.
ampayne2 Posted October 27, 2012 Author Posted October 27, 2012 Not necessarily. Check this out. http://forums.technicpack.net/threads/moogles-frames-and-circuits.28990/ What I'm now doing to it, is ramping up the number of inputs, and adding extra counters and timers. It's one circuit, compacted, with multiple inputs altering the length of the two outputs driving the motors. Ummmmmm I've been up all night and I am not awake enough to do that xD Here is my update on the computercraft setup: 3 Bundled cables, one to get the current floor #, one to get the inputs (call elevator and floor up/down), and one to power the 2 frame motors. Programming in progress. The floor detection:
Lethosos Posted October 27, 2012 Posted October 27, 2012 Awesome build. Quick question: do you have a locking system that prevents an another person from making a second call in the middle of a current call? Answering that question will determine the type of elevator that you're building.
ampayne2 Posted October 27, 2012 Author Posted October 27, 2012 Awesome build. Quick question: do you have a locking system that prevents an another person from making a second call in the middle of a current call? Answering that question will determine the type of elevator that you're building. There is no locking system in place but the way it is setup, it will not do anything else until it is done with its current process etc. The up and down buttons inside the elevator will work correctly from any floor; The only thing I have left is the 'call elevator' buttons Here is my code: while true do sleep(0) local floor1 = redstone.testBundledInput("back", colors.lime) local floor2 = redstone.testBundledInput("back", colors.white) local floor3 = redstone.testBundledInput("back", colors.yellow) local floor4 = redstone.testBundledInput("back", colors.lightBlue) local floor5 = redstone.testBundledInput("back", colors.magenta) local floor6 = redstone.testBundledInput("back", colors.orange) local floor1up = redstone.testBundledInput("right", colors.pink) local floor2up = redstone.testBundledInput("right", colors.gray) local floor3up = redstone.testBundledInput("right", colors.lightGray) local floor4up = redstone.testBundledInput("right", colors.cyan) local floor5up = redstone.testBundledInput("right", colors.purple) local floor6down = redstone.testBundledInput("right", colors.blue) local floor5down = redstone.testBundledInput("right", colors.brown) local floor4down = redstone.testBundledInput("right", colors.green) local floor3down = redstone.testBundledInput("right", colors.red) local floor2down = redstone.testBundledInput("right", colors.black) local floor1height = 0 local floor2height = 6 local floor3height = 12 local floor4height = 18 local floor5height = 28 local floor6height = 34 local floor1call = redstone.testBundledInput("right", colors.white) local floor2call = redstone.testBundledInput("right", colors.orange) local floor3call = redstone.testBundledInput("right", colors.magenta) local floor4call = redstone.testBundledInput("right", colors.yellow) local floor5call = redstone.testBundledInput("right", colors.lightBlue) local floor6call = redstone.testBundledInput("right", colors.lime) function getFloor() if (floor1) then local elevatorFloor = 1 elseif (floor2) then local elevatorFloor = 2 elseif (floor3) then local elevatorFloor = 3 elseif (floor4) then local elevatorFloor = 4 elseif (floor5) then local elevatorFloor = 5 elseif (floor6) then local elevatorFloor = 6 else local elevatorFloor = 0 end end function getHeight() if elevatorFloor = 1 then local elevatorHeight = 0 elseif elevatorFloor = 2 then local elevatorHeight = 6 elseif elevatorFloor = 3 then local elevatorHeight = 12 elseif elevatorFloor = 4 then local elevatorHeight = 18 elseif elevatorFloor = 5 then local elevatorHeight = 28 elseif elevatorFloor = 6 then local elevatorHeight = 34 else local elevatorHeight = 0 end end function moveElevator(currentFloor, destination) local movedistance = destination-currentFloor if movedistance > 0 then for loop = 1, movedistance, 1 do redstone.setBundledOutput("left", colors.orange) sleep(2) redstone.setBundledOutput("left", 0) sleep(1) end end if movedistance < 0 then for loop = -1, movedistance, -1 do redstone.setBundledOutput("left", colors.white) sleep(2) redstone.setBundledOutput("left", 0) sleep(1) end end end if (floor1) and (floor1up) then moveElevator(floor1height,floor2height) end if (floor2) and (floor2down) then moveElevator(floor2height,floor1height) end if (floor2) and (floor2up) then moveElevator(floor2height,floor3height) end if (floor3) and (floor3down) then moveElevator(floor3height,floor2height) end if (floor3) and (floor3up) then moveElevator(floor3height,floor4height) end if (floor4) and (floor4down) then moveElevator(floor4height,floor3height) end if (floor4) and (floor4up) then moveElevator(floor4height,floor5height) end if (floor5) and (floor5down) then moveElevator(floor5height,floor4height) end if (floor5) and (floor5up) then moveElevator(floor5height,floor6height) end if (floor6) and (floor6down) then moveElevator(floor6height,floor5height) end if (floor1call) then getFloor() getHeight() moveElevator(elevatorHeight,0) end if (floor2call) then getFloor() getHeight() moveElevator(elevatorHeight,6) end if (floor3call) then getFloor() getHeight() moveElevator(elevatorHeight,12) end if (floor4call) then getFloor() getHeight() moveElevator(elevatorHeight,18) end if (floor5call) then getFloor() getHeight() moveElevator(elevatorHeight,28) end if (floor6call) then getFloor() getHeight() moveElevator(elevatorHeight,34) end end For example, when the elevator is on floor two and I am on floor one, and I hit the call elevator button, it gives me this error: attempted to perform arithmetic __sub on number and nil Any ideas how to fix? excuse the horrible code :)
ampayne2 Posted October 27, 2012 Author Posted October 27, 2012 So I got this working! It is fully functional with the elevator up/down buttons, and the 'call elevator' buttons! I may get a video up tomorrow but here is the final code: while true do sleep(0) local floor1 = redstone.testBundledInput("back", colors.lime) local floor2 = redstone.testBundledInput("back", colors.white) local floor3 = redstone.testBundledInput("back", colors.yellow) local floor4 = redstone.testBundledInput("back", colors.lightBlue) local floor5 = redstone.testBundledInput("back", colors.magenta) local floor6 = redstone.testBundledInput("back", colors.orange) local floor1up = redstone.testBundledInput("right", colors.pink) local floor2up = redstone.testBundledInput("right", colors.gray) local floor3up = redstone.testBundledInput("right", colors.lightGray) local floor4up = redstone.testBundledInput("right", colors.cyan) local floor5up = redstone.testBundledInput("right", colors.purple) local floor6down = redstone.testBundledInput("right", colors.blue) local floor5down = redstone.testBundledInput("right", colors.brown) local floor4down = redstone.testBundledInput("right", colors.green) local floor3down = redstone.testBundledInput("right", colors.red) local floor2down = redstone.testBundledInput("right", colors.black) local floor1height = 0 local floor2height = 6 local floor3height = 12 local floor4height = 18 local floor5height = 28 local floor6height = 34 local floor1call = redstone.testBundledInput("right", colors.white) local floor2call = redstone.testBundledInput("right", colors.orange) local floor3call = redstone.testBundledInput("right", colors.magenta) local floor4call = redstone.testBundledInput("right", colors.yellow) local floor5call = redstone.testBundledInput("right", colors.lightBlue) local floor6call = redstone.testBundledInput("right", colors.lime) function moveElevator(currentFloor, destination) local movedistance = destination-currentFloor if movedistance > 0 then for loop = 1, movedistance, 1 do redstone.setBundledOutput("left", colors.orange) sleep(2) redstone.setBundledOutput("left", 0) sleep(1) end end if movedistance < 0 then for loop = -1, movedistance, -1 do redstone.setBundledOutput("left", colors.white) sleep(2) redstone.setBundledOutput("left", 0) sleep(1) end end end function callElevator(destinationFloorHeight) if (floor1) then moveElevator(floor1height,destinationFloorHeight) end if (floor2) then moveElevator(floor2height,destinationFloorHeight) end if (floor3) then moveElevator(floor3height,destinationFloorHeight) end if (floor4) then moveElevator(floor4height,destinationFloorHeight) end if (floor5) then moveElevator(floor5height,destinationFloorHeight) end if (floor6) then moveElevator(floor6height,destinationFloorHeight) end end if (floor1) and (floor1up) then moveElevator(floor1height,floor2height) end if (floor2) and (floor2down) then moveElevator(floor2height,floor1height) end if (floor2) and (floor2up) then moveElevator(floor2height,floor3height) end if (floor3) and (floor3down) then moveElevator(floor3height,floor2height) end if (floor3) and (floor3up) then moveElevator(floor3height,floor4height) end if (floor4) and (floor4down) then moveElevator(floor4height,floor3height) end if (floor4) and (floor4up) then moveElevator(floor4height,floor5height) end if (floor5) and (floor5down) then moveElevator(floor5height,floor4height) end if (floor5) and (floor5up) then moveElevator(floor5height,floor6height) end if (floor6) and (floor6down) then moveElevator(floor6height,floor5height) end if (floor1call) then callElevator(floor1height) end if (floor2call) then callElevator(floor2height) end if (floor3call) then callElevator(floor3height) end if (floor4call) then callElevator(floor4height) end if (floor5call) then callElevator(floor5height) end if (floor6call) then callElevator(floor6height) end end I will also get screenshots!
The_DarthMoogle Posted October 28, 2012 Posted October 28, 2012 Woooooooooooooooow. Fairly shure there should be 'while somethingsomethingdarkside do null' or something in there. It's been a while since I done this.
ampayne2 Posted October 28, 2012 Author Posted October 28, 2012 There was an issue with the up/down floor buttons sticking when someone pressed them twice before the elevator started moving. This caused the elevator to either go all the way to the top or all the way to the bottom and not stop at the next floor like it is supposed to. I added a sleep(3) after and before the for loops so that the the elevator would pause at a floor for 3 seconds before going up, and before being able to do anything else once reaching a floor; sufficient time for the button to unpress. I also moved all of the floor height variables above the while loop since they only need to be stated once. Here is my little control room that I used to test it (kinda annoying to test it from inside the elevator: The 10 input up/down input buttons(1-2, 2-3, 3-4, 4-5, 5-6, 6-5, 5-4, 4-3, 3-2, 2-1) When you are inside the elevator although there are only 2 buttons the input wire will be different depending on which floor you are on, which is why I have 10 input wires in my control room: The 6 'call floor' inputs: (1-6 from left to right) Displays which floor the elevator is currently on: The computer, disk drive, and wiring: The bundled cable that goes up the wooden planks is the main cable with the 6 call floor wires and 10 up/down wires; It plugs into the right side of the computer and is also hooked to my control room inputs The bundled cable that connects to the left side of the computer is the output cable; orange for up and white for down The bundled cable that connects to the back of the computer is the current floor input; It is also hooked to the 6 lamps in my control room The disk drive is just there because I find it easier to type it notepad++, upload the file through ftp, and spawn a disc in. EDIT: Also, what is the 'while bleh do null' for that you suggested? It works great without it, but if it will make it faster/more foolproof then I will add it in EDIT EDIT: Final code (excluding whatever moogle suggested): local floor1height = 0 local floor2height = 6 local floor3height = 12 local floor4height = 18 local floor5height = 28 local floor6height = 34 while true do sleep(0) local floor1 = redstone.testBundledInput("back", colors.lime) local floor2 = redstone.testBundledInput("back", colors.white) local floor3 = redstone.testBundledInput("back", colors.yellow) local floor4 = redstone.testBundledInput("back", colors.lightBlue) local floor5 = redstone.testBundledInput("back", colors.magenta) local floor6 = redstone.testBundledInput("back", colors.orange) local floor1up = redstone.testBundledInput("right", colors.pink) local floor2up = redstone.testBundledInput("right", colors.gray) local floor3up = redstone.testBundledInput("right", colors.lightGray) local floor4up = redstone.testBundledInput("right", colors.cyan) local floor5up = redstone.testBundledInput("right", colors.purple) local floor6down = redstone.testBundledInput("right", colors.blue) local floor5down = redstone.testBundledInput("right", colors.brown) local floor4down = redstone.testBundledInput("right", colors.green) local floor3down = redstone.testBundledInput("right", colors.red) local floor2down = redstone.testBundledInput("right", colors.black) local floor1call = redstone.testBundledInput("right", colors.white) local floor2call = redstone.testBundledInput("right", colors.orange) local floor3call = redstone.testBundledInput("right", colors.magenta) local floor4call = redstone.testBundledInput("right", colors.yellow) local floor5call = redstone.testBundledInput("right", colors.lightBlue) local floor6call = redstone.testBundledInput("right", colors.lime) function moveElevator(currentFloor, destination) local movedistance = destination-currentFloor sleep(3) if movedistance > 0 then for loop = 1, movedistance, 1 do redstone.setBundledOutput("left", colors.orange) sleep(2) redstone.setBundledOutput("left", 0) sleep(1) end sleep(3) end if movedistance < 0 then for loop = -1, movedistance, -1 do redstone.setBundledOutput("left", colors.white) sleep(2) redstone.setBundledOutput("left", 0) sleep(1) end sleep(3) end end function callElevator(destinationFloorHeight) if (floor1) then moveElevator(floor1height,destinationFloorHeight) end if (floor2) then moveElevator(floor2height,destinationFloorHeight) end if (floor3) then moveElevator(floor3height,destinationFloorHeight) end if (floor4) then moveElevator(floor4height,destinationFloorHeight) end if (floor5) then moveElevator(floor5height,destinationFloorHeight) end if (floor6) then moveElevator(floor6height,destinationFloorHeight) end end if (floor1) and (floor1up) then moveElevator(floor1height,floor2height) end if (floor2) and (floor2down) then moveElevator(floor2height,floor1height) end if (floor2) and (floor2up) then moveElevator(floor2height,floor3height) end if (floor3) and (floor3down) then moveElevator(floor3height,floor2height) end if (floor3) and (floor3up) then moveElevator(floor3height,floor4height) end if (floor4) and (floor4down) then moveElevator(floor4height,floor3height) end if (floor4) and (floor4up) then moveElevator(floor4height,floor5height) end if (floor5) and (floor5down) then moveElevator(floor5height,floor4height) end if (floor5) and (floor5up) then moveElevator(floor5height,floor6height) end if (floor6) and (floor6down) then moveElevator(floor6height,floor5height) end if (floor1call) then callElevator(floor1height) end if (floor2call) then callElevator(floor2height) end if (floor3call) then callElevator(floor3height) end if (floor4call) then callElevator(floor4height) end if (floor5call) then callElevator(floor5height) end if (floor6call) then callElevator(floor6height) end end
The_DarthMoogle Posted October 28, 2012 Posted October 28, 2012 That's looking relatively sensible now. Awesome stuff.
ampayne2 Posted October 29, 2012 Author Posted October 29, 2012 Here Is a short video I made showing it in action: Didn't have time today to actually prepare a whole tutorial and/or video with me talking, but that might come soon EDIT: Also sorry for crappy quality. I could've recorded it in 1920x1080 but that will also come later :)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now