Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- API = require("button")
- local event = require("event")
- local gpu = component.gpu
- local dialer = component.rftools_dialing_device
- local receivers = dialer.getReceivers()
- local locations = {}
- local positions = {}
- local dimensions = {}
- local transmitter = dialer.getTransmitters()
- local homePos = 0
- local numLocations = 0
- local dialMode = true --dial once if true
- local colors = { blue = 0x4286F4, purple = 0xB673d6, red = 0xC14141, green = 0xDA841,
- black = 0x000000, white = 0xFFFFFF, grey = 0x47494C, lightGrey = 0xBBBBBB}
- -- set size of the screen for lvl 3
- gpu.setResolution(132, 38)
- gpu.setBackground(colors.black)
- gpu.fill(1, 1, 132, 38, " ")
- function clearScreen()
- local oldColor = gpu.getBackground( false )
- local w,h = gpu.getResolution()
- gpu.setBackground( colors.black, false )
- gpu.fill(1, 1, 132, 38, " ")
- gpu.setBackground( oldColor, false )
- end
- function getNumLocations()
- for k,v in pairs(receivers) do
- numLocations = numLocations + 1
- end
- end
- getNumLocations()
- for i=1, numLocations-1 do
- table.insert(locations, receivers[i].name)
- table.insert(positions, receivers[i].position)
- table.insert(dimensions, receivers[i].dimension)
- if receivers[i].name == "Home" then
- homePos = i
- end
- end
- function setButtons()
- y = 0
- for i=1, numLocations-1 do
- API.setTable(locations[i], tele(i), 10, 2+y, 30, 3+y,locations[i], {on = colors.green, off = colors.red})
- y = y + 3
- end
- end
- function tele(i)
- dialer.dial(transmitter[1].position, receivers[i].position, receivers[i].dimension, dialMode)
- end
- event.listen("touch", API.checkxy)
- --clearScreen()
- setButtons()
- API.screen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement