Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Etage1 = {"Etage1",colors.white, colors.orange}
- local Etage2 = {"Etage2",colors.magenta, colors.lightBlue}
- local Etage3 = {"Etage3",colors.yellow, colors.lime}
- local Etage4 = {"Etage4",colors.pink, colors.gray}
- local Etage5 = {"Etage5",colors.lightGray, colors.cyan}
- --local Etage6 = {"Etage6",colors.purple, colors.blue}
- --local Etage7 = {"Etage7",colors.brown, colors.green}
- --local Etage8 = {"Etage8",colors.red, colors.black}
- local etagen = {Etage1,Etage2,Etage3,Etage4,Etage5}--,Etage6,Etage7,Etage8}
- for i=1,#etagen do
- etagen[i][4] = false
- end
- local Bside = "left"
- local openTime = 4
- function check()
- if rs.getBundledInput(Bside) then
- for E = 1,#etagen do
- if colors.test(rs.getBundledInput(Bside), etagen[E][2]) == true then
- etagen[E][4] = true
- end
- if colors.test(rs.getBundledInput(Bside), etagen[E][3]) == true then
- etagen[E][4] = false
- sleep(openTime)
- end
- end
- end
- end
- data = {}
- data[1] = 3
- data[2] = "up"
- rs.setBundledOutput(Bside,etagen[3][3])
- sleep(0.5)
- rs.setBundledOutput(Bside,0)
- sleep(0.1)
- function move()
- local stop = false
- for i=1,#etagen do
- if etagen[i][4] == true then
- stop = true
- break
- end
- end
- if stop == false then
- data[1] = 3
- data[2] = "up"
- if colors.test(rs.getBundledInput(Bside), etagen[3][3]) == false then
- rs.setBundledOutput(Bside, etagen[3][3])
- sleep(0.5)
- rs.setBundledOutput(Bside,0)
- end
- print("stopped")
- else
- if etagen[data[1]][4] == true then
- print("faehrt noch...")
- return
- end
- if data[2] == "down" then
- for i=data[1],#etagen do
- if etagen[i][4] == true then
- rs.setBundledOutput(Bside, etagen[i][3])
- sleep(0.5)
- rs.setBundledOutput(Bside,0)
- print("moving")
- --etagen[i][4] = false
- data[1] = i
- data[2] = "up"
- move()
- return
- end
- end
- data[1] = #etagen
- data[2] = "down"
- move()
- else
- for i=0,#etagen-1 do
- if etagen[#etagen-i][4] == true then
- rs.setBundledOutput(Bside, etagen[#etagen-i][3])
- sleep(0.5)
- rs.setBundledOutput(Bside,0)
- print("moving")
- --etagen[i][4] = false
- data[1] = #etagen-i
- data[2] = "down"
- move()
- return
- end
- end
- data[1] = 1
- data[2] = "up"
- move()
- end
- end
- end
- while true do
- event,arg1,arg2,arg3 = os.pullEvent()
- if event == "redstone" then
- print(data[1]..", "..data[2])
- check()
- move()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement