Advertisement
meuced

Control WorkFlow

Jan 20th, 2013
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. function affiche_etat()
  2.     term.clear()
  3.     term.setCursorPos(8,1)
  4.     term.setTextColor(colors.yellow)
  5.     print("Controle des flux")
  6.     term.setTextColor(colors.white)
  7.     term.setCursorPos(4,4)
  8.     write("Macerator ")
  9.     if redstone.getOutput("top") == true then
  10.         term.setTextColor(colors.green)
  11.         rednet.send(67,"true")
  12.     else
  13.         term.setTextColor(colors.red)
  14.         rednet.send(67,"false")
  15.     end
  16.     write("<===> ")
  17.     term.setTextColor(colors.white)
  18.     write("Iron Furnace ")
  19.     if redstone.getOutput("bottom") == true then
  20.         term.setTextColor(colors.green)
  21.         rednet.send(69,"true")
  22.     else
  23.         term.setTextColor(colors.red)
  24.         rednet.send(69,"false")
  25.     end
  26.     write("<===> ")
  27.     term.setTextColor(colors.white)
  28.     write("Compressor")
  29.     term.setCursorPos(15,5)
  30.     print("(1)")
  31.     term.setCursorPos(34,5)
  32.     print("(2)")
  33.     term.setCursorPos(1,9)
  34. end
  35.  
  36. rednet.open("left")
  37.  
  38. while true do
  39.     affiche_etat()
  40.     print("Flux a activer ou desactiver : ")
  41.     local choix = read()
  42.     if choix == "1" then
  43.         if redstone.getOutput("top") == true then
  44.             redstone.setOutput("top",false)
  45.             rednet.send(67,"false")
  46.         else
  47.             redstone.setOutput("top",true)
  48.             rednet.send(67,"true")
  49.         end
  50.     elseif choix == "2" then
  51.         if redstone.getOutput("bottom") == true then
  52.             redstone.setOutput("bottom",false)
  53.             rednet.send(69,"false")
  54.         else
  55.             redstone.setOutput("bottom",true)
  56.             rednet.send(69,"true")
  57.         end
  58.     else
  59.         print("Mauvaix choix !!")
  60.         sleep(2)
  61.     end
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement