Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- local sg = peripheral.wrap("bottom")
- local sg = peripheral.wrap("stargate_2")
- local aI = 0
- local user_1 = 0
- local user_2 = 0
- mouseWidth = 0
- mouseHeight = 0
- monitor = peripheral.wrap("left")
- monitor.clear()
- monitor.setCursorPos(1,1)
- w, h = monitor.getSize()
- -- print("w:", w, "h:", h)
- while true do
- -- Monitor info --
- local St, C = sg.stargateState()
- local lA = sg.localAddress()
- local iS = sg.irisState()
- local rA = sg.remoteAddress()
- monitor.clear()
- monitor.setCursorPos(2, 2)
- monitor.write("The Stargate: " ..St)
- monitor.setCursorPos(2, 4)
- monitor.write("Local Addres " ..sg.localAddress())
- monitor.setCursorPos(2, 6)
- monitor.write("Locked Chevrons: " ..C)
- monitor.setCursorPos(2, 8)
- monitor.write("Iris State: " ..iS)
- monitor.setCursorPos(2, 10)
- monitor.write("Dialling to " ..rA)
- -- Connection to --
- if user_1 == 1 then
- monitor.setBackgroundColour((colours.lime))
- else
- monitor.setBackgroundColour((colours.red))
- end
- monitor.setCursorPos(27, 2)
- monitor.write(" Lucas ")
- if user_2 == 1 then
- monitor.setBackgroundColour((colours.lime))
- else
- monitor.setBackgroundColour((colours.red))
- end
- monitor.setCursorPos(27, 4)
- monitor.write(" Pierrick ")
- -- Control iris --
- if iS == "Open" or iS == "Opening" then
- monitor.setBackgroundColour((colours.red))
- else
- monitor.setBackgroundColour((colours.lime))
- end
- monitor.setCursorPos(27, 14)
- monitor.write(" Lock Iris ")
- if iS == "Closed" or iS == "Closing" then
- monitor.setBackgroundColour((colours.red))
- else
- monitor.setBackgroundColour((colours.lime))
- end
- monitor.setCursorPos(27, 16)
- monitor.write(" Unlock Iris")
- monitor.setBackgroundColour((colours.orange))
- monitor.setCursorPos(27, 18)
- monitor.write(" Disconnect ")
- if aI == 1 then
- monitor.setBackgroundColour((colours.lime))
- else
- monitor.setBackgroundColour((colours.red))
- end
- monitor.setCursorPos(2, 18)
- monitor.write(" Auto Iris ")
- monitor.setBackgroundColour((colours.black))
- -- check button --
- function checkClickPosition()
- if mouseWidth > 26 and mouseWidth < 39 and mouseHeight == 2 then
- address = "Q70C-071-RO"
- ok, result = pcall(sg.dial, address)
- if ok then
- user_1 = 1
- print("success")
- else
- print("error")
- end
- elseif mouseWidth > 26 and mouseWidth < 39 and mouseHeight == 4 then
- address = "Q70C-071-RO"
- ok, result = pcall(sg.dial, address)
- if ok then
- user_2 = 1
- print("success")
- else
- print("error")
- end
- elseif mouseWidth > 26 and mouseWidth < 39 and mouseHeight == 14 then
- aI = 0
- sg.closeIris()
- elseif mouseWidth > 26 and mouseWidth < 39 and mouseHeight == 16 then
- aI = 0
- sg.openIris()
- elseif mouseWidth > 26 and mouseWidth < 39 and mouseHeight == 18 then
- sg.disconnect()
- user_1, user_2 = 0, 0
- elseif mouseWidth > 1 and mouseWidth < 14 and mouseHeight == 18 then
- aI = 1
- end
- end
- -- Auto iris --
- if aI == 1 then
- local id, command, pos = rednet.receive()
- if command == "on" then
- sg.openIris()
- else
- sg.closeIris()
- end
- end
- event, p1, p2, p3 = os.pullEvent()
- if event == "monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement