Advertisement
Guest User

startup

a guest
Sep 19th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. term.clear()
  2. m = peripheral.wrap("back")
  3. xB1 = 1
  4. xB2 = 1
  5.  m.setTextScale(1)
  6.  m.setBackgroundColor(colors.red)
  7. function Reactor1()
  8.  m.setCursorPos(2,4)
  9.  m.write("           ")
  10.  m.setCursorPos(2,5)
  11.  m.write("           ")
  12.  m.setCursorPos(2,6)
  13.  m.write("           ")
  14.  m.setCursorPos(2,7)
  15.  m.write("           ")
  16.  m.setCursorPos(2,8)
  17.  m.write("           ")
  18.  m.setCursorPos(2,9)
  19.  m.write("           ")
  20.  m.setTextColor(colors.white)
  21.  m.setCursorPos(4,6)
  22.  m.write("Reactor")
  23.  m.setCursorPos(4,7)
  24.  m.write("   1   ")
  25.  end
  26.  
  27. function Reactor2()
  28.  m.setCursorPos(18,4)
  29.  m.write("           ")
  30.  m.setCursorPos(18,5)
  31.  m.write("           ")
  32.  m.setCursorPos(18,6)
  33.  m.write("           ")
  34.  m.setCursorPos(18,7)
  35.  m.write("           ")
  36.  m.setCursorPos(18,8)
  37.  m.write("           ")
  38.  m.setCursorPos(18,9)
  39.  m.write("           ")
  40.  m.setTextColor(colors.white)
  41.  m.setCursorPos(20,6)
  42.  m.write("Reactor")
  43.  m.setCursorPos(20,7)
  44.  m.write("   2   ")
  45.  end
  46.  
  47. while true do
  48.  
  49. local cn = peripheral.getNames()
  50. local energy = {}
  51. print("h")
  52.  
  53. for k,v in pairs(cn) do
  54. if peripheral.getType(v) == "BigReactors-Reactor" then
  55. local r = peripheral.wrap(v)
  56. energy[k] = r.getMaxEnergyStored()
  57. print("i")
  58. end
  59. end
  60.  
  61. local u = 0
  62. print(reactor," / hi")
  63.  
  64. for k,v in pairs(energy) do
  65. x,x,a,b = os.pullEvent("monitor_touch")
  66. print(u)
  67.  
  68.   if u == 0 then
  69.   Reactor1()
  70.    --Reactor1
  71.    if a > 1 then
  72.     if a < 13 then
  73.    if b > 3 then
  74.    if b < 10 then
  75.    if xB1== 0 then
  76.    xB1 = 1
  77.    m.setBackgroundColor(colors.red)
  78.        
  79.    else
  80.    xB1 = 0
  81.    m.setBackgroundColor(colors.green)
  82.    rs.setOutput("right", true)
  83.    end
  84.    Reactor1()
  85.    end
  86.    end
  87.    end
  88.    end
  89.    
  90.   elseif u == 1 then
  91.    Reactor2()
  92.    --Reactor2
  93.    if a > 17 then
  94.       if a < 29 then
  95.    if b > 3 then
  96.    if b < 10 then
  97.    if xB2== 0 then
  98.    xB2 = 1
  99.    m.setBackgroundColor(colors.red)
  100.    rs.setOutput("left", false)
  101.    else
  102.    xB2 = 0
  103.    m.setBackgroundColor(colors.green)
  104.    rs.setOutput("left", true)
  105.    end
  106.   Reactor2()
  107.   end
  108.   end
  109.   end
  110.   end
  111. end
  112.  
  113.  
  114. end
  115. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement