Advertisement
Guest User

startup

a guest
May 27th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.03 KB | None | 0 0
  1. term.clear()
  2. local sideOrange = "front"
  3. local sideLightBlue = "left"
  4. local sideBlue = "back"
  5. local sideWhite = "right"
  6.  
  7.  local Opened = rednet.isOpen("top")
  8. if Opened == false then
  9.   rednet.open("top")
  10.   rednet.host("ruben","solars")
  11. end
  12.  
  13.  
  14. function checkAllCables()
  15.   boolOrange = redstone.getInput(sideOrange)
  16.   boolLightBlue = redstone.getInput(sideLightBlue)
  17.   boolBlue = redstone.getInput(sideBlue)
  18.   boolWhite = redstone.getInput(sideWhite)
  19. end
  20.  
  21. function display()
  22.    term.setCursorPos(5,5)
  23.    term.clearLine()
  24.    term.setTextColor(colors.orange)
  25.    term.write("Naranja(N): " .. tostring(boolOrange))
  26.    
  27.    term.setCursorPos(5,6)
  28.    term.clearLine()
  29.    term.setTextColor(colors.lightBlue)
  30.    term.write("Azul Claro(C): " .. tostring(boolLightBlue))
  31.    
  32.    term.setCursorPos(5,7)
  33.    term.clearLine()
  34.    term.setTextColor(colors.blue)
  35.    term.write("Azul(A): " .. tostring(boolBlue))
  36.    
  37.    term.setCursorPos(5,8)
  38.    term.clearLine()
  39.    term.setTextColor(colors.white)
  40.    term.write("Blanco(B): " .. tostring(boolWhite))
  41.    
  42. end
  43.  
  44. function whenPressKey()
  45.  local event, scancode = os.pullEvent("key")
  46.  if scancode == 49 then
  47.    if boolOrange == true then
  48.      redstone.setOutput(sideOrange, false)
  49.    else
  50.      redstone.setOutput(sideOrange, true)
  51.    end
  52.  elseif scancode == 46 then
  53.    if boolLightBlue == true then
  54.      redstone.setOutput(sideLightBlue, false)
  55.    else
  56.      redstone.setOutput(sideLightBlue, true)
  57.    end
  58.  elseif scancode == 30 then
  59.    if boolBlue == true then
  60.      redstone.setOutput(sideBlue, false)
  61.    else
  62.      redstone.setOutput(sideBlue, true)
  63.    end
  64.  elseif scancode == 48 then
  65.    if boolWhite == true then
  66.      redstone.setOutput(sideWhite, false)
  67.    else
  68.      redstone.setOutput(sideWhite, true)
  69.     end
  70.  else
  71.  end
  72. end
  73.  
  74. local i = 0
  75. repeat
  76. checkAllCables()
  77. display()
  78. whenPressKey()
  79. rednet.send(rednet.lookup("ruben","gafas"),tostring(boolOrange) .. "," .. tostring(boolLightBlue) .. "," .. tostring(boolBlue) .. "," .. tostring(boolWhite),"ruben")
  80. sleep(0.1)
  81. until i == 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement