Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Coded by Wyvern
- portals = {"Age 1", "Age 2", "Age 3"}
- numberOfButtonsPerLine = 1
- monitorSide = "left"
- modemSide = "top"
- nexusTurtleID = 153
- m = peripheral.wrap(monitorSide)
- rednet.open(modemSide)
- shell.run("pastebin", "get", "vcRXLMhn", "gui") -- My personnal buttons api
- os.loadAPI("gui")
- print(os.getComputerID()..": Starting to work...")
- gui.registerPeripheral(monitorSide)
- gui.setBackgroundColor("white")
- sWidth, sHeight = m.getSize()
- width = math.floor((sWidth-5)/numberOfButtonsPerLine)
- btn = {}
- for i=0, #portals-1 do
- x = math.floor( (sWidth/numberOfButtonsPerLine) * (i%3) + 2)
- --2,14,26,2,14,26,2,14,26,2,14,26...
- y = math.floor(i/numberOfButtonsPerLine)*6+2 --2,2,2,8,8,8,14,14,14,20,20,20...
- btn[i+1] = gui.guiCreateButton(portals[i+1], x, y, width, 4)
- end
- function sendTonexusTurtleID(text)
- rednet.send(nexusTurtleID, text)
- end
- while true do
- nMsg = gui.guiGetMsg()
- for i=1, #btn do
- if nMsg == btn[i] then
- print(i)
- sendTonexusTurtleID(i)
- end
- end
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement