Advertisement
Guest User

lcars

a guest
Jan 22nd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1.  
  2. mon = peripheral.wrap("top")
  3. mon2= peripheral.wrap("right")
  4.  
  5. bulkheads = false
  6. bulkheads_id = 0
  7.  
  8. function raw()
  9.   bRead = true
  10.   while(bRead) do
  11.     local sEvent, param = os.pullEvent("key")
  12.     if(sEvent == "key") then
  13.       return param
  14.     end
  15.   end
  16. end
  17.  
  18. function n()
  19.   _,y=mon.getCursorPos()
  20.   mon.setCursorPos(1, y+1)
  21. end
  22.  
  23. function draw()
  24.   mon.clear()
  25.   mon.setCursorPos(1, 1)
  26.   mon2.setCursorPos(1, 1)
  27.   mon2.clear()
  28.  
  29.   mon.setTextColor(colors.black)
  30.   mon.setBackgroundColor(colors.yellow)
  31.  
  32.   mon.write("LCARS_USS_CONSTELLATION      ")
  33.  
  34.   mon.setTextColor(colors.white)
  35.   mon.setBackgroundColor(colors.black)
  36.  
  37.   n()
  38.  
  39.   if bulkheads == true then
  40.     mon.setBackgroundColor(colors.green)
  41.     mon.write("BULKHEADS_ON")
  42.   else
  43.     mon.setBackgroundColor(colors.red)
  44.     mon.write("BULKHEADS_OFF")
  45.   end
  46.   n()
  47.  
  48.   mon.setBackgroundColor(colors.black)
  49.   mon.write(" ")
  50.  
  51.   term.clear()
  52.   term.setCursorPos(1, 1)
  53.   term.setTextColor(colors.white)
  54.   term.write("(B)ulkheads")
  55.  
  56. end
  57.  
  58. function poll()
  59.  
  60.   if raw() == 48 then
  61.     bulkheads = not bulkheads
  62.   end
  63. end
  64.  
  65. function redupdate()
  66.   if bulkheads == true then
  67.     rednet.send(bulkheads_id, "on")
  68.   else
  69.     rednet.send(bulkheads_id, "off")
  70.   end
  71. end
  72.  
  73. while true do
  74.   draw()
  75.   poll()
  76.   redupdate()
  77. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement