Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hostIDs = {32, 72, 95}
- local teleports = {}
- local textScale = 0.9
- local function startOperations()
- rednet.open("left")
- rednet.send(126, "", "dns_list")
- local senderID, message, protocol = rednet.receive("dns_list_response")
- teleports = textutils.unserialize(message)
- for k, v in pairs(teleports) do
- print(k, v)
- end
- end
- local function display()
- local monitor = peripheral.wrap("top")
- monitor.setTextScale(textScale)
- monitor.setBackgroundColour(colors.blue)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- local function dispNewLine()
- local x, y = monitor.getCursorPos()
- monitor.setCursorPos(1, y + 1)
- end
- local function displayLine()
- local width = monitor.getSize()
- for i = 1, width do
- monitor.write("-")
- end
- dispNewLine()
- end
- for k, v in pairs(teleports) do
- displayLine()
- monitor.write(k .. " " .. v)
- dispNewLine()
- displayLine()
- end
- end
- local function work()
- while true do
- local event, side, x, y = os.pullEvent("monitor_touch")
- local btnClicked = math.ceil(y / 3)
- print(event.."; x="..x.."; y="..y)
- print("Button clicked = "..btnClicked)
- print(teleports[btnClicked])
- if btnClicked <= #teleports and btnClicked > 0 then
- end
- end
- end
- startOperations()
- display()
- work()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement