Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get rU7eAYTj ftw
- -- -------------------------------------------
- -- 3x3 door -Sinkir-
- -- Version 1
- -- setup :
- -- Computer with 3 repater on 3 side
- -- 1 dust under the computer whith block and repeater
- -- 1 restone signal in front (input).
- -- 3 output rednet cable (3 colors)
- -- view from top
- -- r r r
- -- r R r
- -- rRCRr
- -- I
- -- r = rednet cable
- -- R = repeater
- -- C = Computer
- -- I = Input (redstone)
- -- -------------------------------------------
- function fileGet(path)
- if(fs.exists(path))then
- tabFile = fs.open(path, "r")
- text = tabFile.readAll()
- tabFile.close()
- return text
- else
- print("fileGet() File not found.")
- print(path)
- return false
- end
- end
- function fileSet(path, text)
- if(fs.isReadOnly(path))then
- print("fileSet() File is read only.")
- print(path)
- return false
- else
- tabFile = fs.open(path, "w")
- tabFile.write(text)
- tabFile.close()
- return true
- end
- end
- function savedata()
- fileSet("data", a)
- end
- function input(side)
- redstone.setOutput(side, true)
- sleep(0.1)
- redstone.setOutput(side, false)
- end
- if(fs.exists("data")==true)then
- --Shaundi()
- else
- fileSet("data", "0")
- end
- a = fileGet("data")
- flag = false
- while(2)do
- if(redstone.getInput("front") == true and flag == false)then
- --
- if(a == "0")then
- --opening
- input("right")
- sleep(0.1)
- input("bottom")
- sleep(0.1)
- input("left")
- sleep(0.1)
- input("back")
- sleep(0.1)
- input("left")
- sleep(0.1)
- input("right")
- a = "1"
- else
- --closing
- input("right")
- input("back")
- input("bottom")
- input("right")
- a = "0"
- end
- savedata()
- flag = true
- end
- if(redstone.getInput("front") == false)then
- flag = false
- end
- sleep(0.2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement