Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("front")
- m.open(3)
- function clear()
- sides = {"right","bottom"}
- for i=1,#sides do
- rs.setOutput(sides[i],false)
- end
- end
- function getmss(me)
- a = {}
- for k,v in string.gmatch(me, "(%w+)=(%w+)") do
- if k == 1 then
- a[1] = v
- else
- a[2] = v
- end
- end
- return a[1],a[2]
- end
- while true do
- local e,p1,p2,p3,me,p4 = os.pullEvent("modem_message")
- if me == "rsClear" then
- clear()
- else
- side,state = getmss(me)
- if state == "true" then
- rs.setOutput(side,true)
- else
- rs.setOutput(side,false)
- end
- end
- if rs.getInput("left") then
- rs.setOutput("right",true)
- sleep(2)
- rs.setOutput("right",false)
- end
- sleep(2)
- if rs.getInput("back") then
- rs.setOutput("bottom",true)
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement