Advertisement
Guest User

startupp

a guest
Apr 28th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. function reverseDoor()
  2.  
  3.  if state == true then
  4.   state = false
  5.   redstone.setOutput("back", false)
  6.   mon.clear()
  7.   mon.setBackgroundColor(colors.red)
  8.   mon.clear()
  9.   mon.setTextColor(colors.white)
  10.   mon.setCursorPos(9,5)
  11.   mon.write("Porte Ouverte")
  12.  else
  13.   state =true
  14.   redstone.setOutput("back", true)
  15.   mon.clear()
  16.   mon.setBackgroundColor(colors.blue)
  17.   mon.clear()
  18.   mon.setTextColor(colors.blue)
  19.   mon.setCursorPos(9,5)
  20.   mon.write("Porte Fermee")
  21.  end
  22. end
  23.  
  24. mon = peripheral.wrap("back")
  25. w = peripheral.wrap("right")
  26. state = nil
  27.  
  28. w.open(0)
  29. mon.setTextScale(1)
  30.  
  31. redstone.setOutput("back", true)
  32. state = false --false : close, true : open
  33.  
  34. while true do
  35.  
  36.  while event ~= "modem_message" or event ~= "monitor_touch" do
  37.   event, side, xpos, ypos = os.pullEvent()
  38.  end
  39.  
  40.  if event == "monitor_touch" then
  41.   reverseDoor()
  42.  
  43.  elseif event == "modem_message" then
  44.   if message = 1 then
  45.     w.transmit(0, 0, state)
  46.   end
  47.   reverseDoor()
  48.   redstone.setOutput("back",true)
  49.   mon.clear()
  50.   mon.setBackgroundColor(colors.blue)
  51.   mon.clear()
  52.   mon.setTextColor(colors.white)
  53.   mon.setCursorPos(9,5)
  54.   mon.write("Porte fermee")
  55.  end
  56.  
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement