NMDanny

BigReactors wireless pocket computer control

Jul 18th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. modem=peripheral.wrap("back")
  2. modem.open(156)
  3. pad=0
  4. -- Fields, as defined in the reactor management program.
  5. info={"Energy Stored:","Max Energy:","Energy Percent:","Production:","Fuel usage:","Fuel rod level:"}
  6. values={0,0,0,0,0,0}
  7. units={" RF"," RF","% RF"," RF/t"," b/h","%"}
  8.  
  9. function Receive()
  10.     while true do
  11.         local event,side,sch,rch,message,dist=os.pullEvent("modem_message")
  12.         values=textutils.unserialize(message)
  13.         sleep(2.5)
  14.     end
  15. end
  16.  
  17. function Draw()
  18.     while true do
  19.         term.setBackgroundColor(colors.black)
  20.         term.clear()
  21.         -- Title
  22.         term.setCursorPos(2,2)
  23.         term.setBackgroundColor(colors.purple)
  24.         term.setTextColor(colors.yellow)
  25.         term.write("NMDanny's Reactor Control v1")
  26.        
  27.         -- Print data  
  28.         term.setBackgroundColor(colors.black)
  29.         term.setTextColor(colors.white)
  30.         for i=1,#info,1 do
  31.             term.setCursorPos(2,3+i)
  32.             term.write(info[i]..values[i]..units[i])
  33.         end
  34.        
  35.         sleep(2.5)
  36.     end
  37. end
  38.  
  39.  
  40. while true do
  41.     parallel.waitForAny(Receive,Draw)
  42. end
Advertisement
Add Comment
Please, Sign In to add comment