Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- maxSpawner = 0
- function funcClicked(name)
- print("you clicked on"..name)
- rednet.send(mainMonitor, resolveName[name], "SCREEN")
- button.flash(name)
- end
- function Mreboot(name)
- rednet.send(mainMonitor, "REBOOT", "SCREEN")
- button.flash(name)
- sleep(1)
- os.reboot()
- end
- function drawButton(txt, pos, state)
- x = pos * 11
- y = 0
- while x > 30 do
- y = y + 4
- x = x - 30
- end
- print("button "..txt.." X = "..x.." Y ="..y)
- x = x + 1
- y = y + 4
- button.setTable(txt, funcClicked, x, x + 10, y, y + 3)
- end
- function getClick()
- event, side, x, y = os.pullEvent("monitor_touch")
- print("CLICK!!! = X = "..x.." Y = "..y)
- button.checkxy(x, y)
- end
- rednet.open("back")
- term = peripheral.wrap("left")
- listSpawners = {}
- listSpawnerState = {}
- resolveName = {}
- mainMonitor = nil
- while mainMonitor == nil do
- mainMonitor = rednet.receive("SCREEN")
- end
- rednet.send(mainMonitor, "SCREEN", "SCREEN")
- tmpTxt = "nope"
- pos = 0
- useless = 1
- tmpTxt2 = "nope"
- button.setTable("Reboot", Mreboot, 1, 11, 1, 3)
- while tmpTxt ~= "END" do
- useless, tmpTxt = rednet.receive("SCREEN")
- listSpawners[pos] = tmpTxt
- resolveName[tmpTxt] = pos
- if tmpTxt == "END" then break end
- rednet.send(mainMonitor, "SCREEN", "SCREEN")
- useless, tmpTxt2 = rednet.receive("SCREEN")
- listSpawnerState[pos] = tmpTxt2
- rednet.send(mainMonitor, "SCREEN", "SCREEN")
- print("RES = "..tmpTxt.." pos "..pos.." res2 = "..tmpTxt2)
- drawButton(tmpTxt, pos, tmpTxt2)
- pos = pos + 1
- end
- button.heading("ScreenMobSoul")
- button.screen()
- while true do
- getClick()
- end
- -- TODO : send if click
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement