Advertisement
Stravides

ReactorOnOFF

Nov 25th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. os.unloadAPI("button")
  2. os.loadAPI("button")
  3. button.setMon("top")
  4.  
  5. function setbuttons()
  6.   button.add("status", "On/Off","toggle",2,2,12,4,colors.red,colors.green,colors.white,function() prepMsg() end)
  7.   button.setState("status",false)
  8.   button.draw()
  9. end
  10.  
  11. m=peripheral.wrap("top")
  12. m.setTextScale(1)
  13. m.setTextColor(5)
  14.  
  15. function writeAt(x,y,text)
  16.   m.setCursorPos(x,y)
  17.   m.write(text)
  18. end
  19.  
  20. function prepMsg()
  21.   msg="toggleActive|sdf"
  22.   rednet.open("bottom")
  23.   shell.run("clear")
  24.   rednet.send(80,msg) -- Reactor Control Screen
  25. end
  26.  
  27. --Main Program
  28.  
  29. m.clear()
  30. setbuttons()
  31. while true do
  32.   button.check() -- This goes into a wait loop and does not come out again....
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement