Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local term = require("term")
- local gpu = require("component").proxy("gpu")
- local button = require("component").proxy("dc1f7a58-4c50-489f-86bb-a6bcc3419bd4")
- local floor = require("component").proxy("0c14f10e-d910-4e05-b478-9c9f8accab6c")
- local ele = require("component").proxy("ddd486f4-dd98-4fa4-8ca8-dff0e8909499")
- local door = require("component").proxy("9bce80eb-6f12-48fc-97d7-1521156d2a63")
- local event = require("event")
- --for a=0,15 do
- -- button.setBundledOutput(3,a,0)
- -- floor.setBundledOutput(3,a,0)
- ele.setBundledOutput(3,a,0)
- door.setBundledOutput(3,a,0)
- --end
- function screenCheck(_,_,eventX,eventY)
- if eventX ~= nil then
- print("Event registered at "..eventX.." / "..eventY)
- end end
- event.listen("touch",screenCheck)
- function buttonCheck ()
- for a=0,15 do
- if button.getBundledInput(3,a) ~= 0 then
- idling = 0
- moveTo(a)
- -- button.setBundledOutput(3,a,0)
- end end end
- function moveTo (a)
- ele.setBundledOutput(3,a,15)
- os.sleep(0.1)
- ele.setBundledOutput(3,a,0)
- end
- function doors ()
- for a=0,15 do
- if floor.getBundledInput(3,a) ~= 0 then
- door.setBundledOutput(3,a,15)
- os.sleep(5)
- door.setBundledOutput(3,a,0)
- idling = 1
- end end end
- idling = 1
- while true do
- if idling == 1 then
- buttonCheck()
- screenCheck()
- end
- if idling == 0 then
- doors()
- end
- os.sleep(0.01)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement