Advertisement
Telerabi

Monitor Schloss

Jun 28th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. mon = peripheral.wrap("top")
  2.  
  3. mon.setBackgroundColor(colors.white)
  4. mon.clear()
  5.  
  6. while true do
  7.     event, side, x, y = os.pullEvent("monitor_touch")
  8.     if(event) then
  9.         mon.setCursorPos(x, y)
  10.         if(x==1 and y==1) then
  11.             mon.setTextColor(colors.green)
  12.         else
  13.             mon.setTextColor(colors.red)
  14.         end
  15.         mon.write("*")
  16.         sleep(0.25)
  17.     end
  18.     if(event and x==1 and y==1) then
  19.         mon.setCursorPos(1, 3)
  20.         mon.setTextColor(colors.green)
  21.         mon.write("come in")
  22.         rs.setOutput("right", true)
  23.         sleep(1)
  24.         rs.setOutput("right", false)
  25.     else
  26.         mon.setCursorPos(1, 3)
  27.         mon.setTextColor(colors.red)
  28.         mon.write("go away")
  29.         sleep(1)
  30.     end
  31.     mon.clear()
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement