Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Programma Switch
- -- Creato da Vorakh
- redstone.setOutput("front", true)
- -- Switch
- sw = "l"
- -- Control
- co = false
- -- Position
- po = "front"
- -- Case
- ex = true
- -- Key
- l = 38
- u = 22
- e = 18
- print("Gate Locked.")
- sleep(2)
- while ex do
- term.clear()
- term.setCursorPos(1,1)
- print("Press:")
- print("\"l\" to lock the gate")
- print("\"u\" to unlock the gate")
- print("\"e\" to exit program")
- event, scancode = os.pullEvent("key")
- sw = tostring(scancode)
- term.clear()
- term.setCursorPos(1,1)
- if scancode == l then
- redstone.setOutput(po, true)
- co = true
- print("Gate Locked.")
- end
- if scancode == u then
- redstone.setOutput(po, false)
- co = true
- print("Gate Unlocked.")
- end
- if scancode == e then
- ex = false
- co = true
- print("Good Bye :)")
- end
- if co then
- co = false
- else
- print("Wrong key, retry!")
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement