TrovadorUrbano

CC-Wireless Reactor Control

Apr 7th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. local pass=""
  2. local s=false
  3. local p=false
  4.  
  5. rednet.open("left")
  6. rednet.send(24,"415408")
  7. rednet.send(22,"HujeBetoB")
  8.  
  9. function UI()
  10.   term.clear()
  11.   term.setCursorPos(2,2)
  12.   print("Control de Reactor")
  13.   term.setCursorPos(4,4)
  14.   print("1. Encender Reactor")
  15.   term.setCursorPos(4,5)
  16.   print("2. Apagar Reactor")
  17.   term.setCursorPos(4,6)
  18.   print("3. Abrir Puertas")
  19.   term.setCursorPos(4,7)
  20.   print("4. Cerrar Puertas")
  21.   term.setCursorPos(20,11)
  22.   print("Reactor:")
  23.   term.setCursorPos(20,12)
  24.   if s then
  25.     print("Encendido")
  26.   else
  27.     print("Apagado")
  28.   end
  29.   term.setCursorPos(10,11)
  30.   print("Puertas:")
  31.   term.setCursorPos(10,12)
  32.   if p then
  33.     print("Abierto")
  34.   else
  35.     print("Cerrado")
  36.   end
  37. end
  38.  
  39. while true do
  40.   UI()
  41.   local a,b = os.pullEvent()
  42.   if a=="key"then
  43.     if b==2 then
  44.       rednet.send(24,"808825")
  45.       s=true
  46.     elseif b==3 then
  47.       rednet.send(24,"415408")
  48.       s=false
  49.     elseif b==4 then
  50.       rednet.send(22,"HujeBetoA")
  51.       p=true
  52.     elseif b==5 then
  53.       rednet.send(22,"HujeBetoB")
  54.       p=false
  55.     end
  56.   elseif a=="redstone" then
  57.     if rs.getInput("right") then
  58.       rednet.send(24,"415408")
  59.     end
  60.   end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment