rules54

Untitled

Aug 18th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local monitor = peripheral.wrap("top")
  2. local function fillScreen(color)
  3.   monitor.setBackgroundColor(color)
  4.   local x,y = monitor.getSize()
  5.   for i=1, y do
  6.     monitor.setCursorPos(1,i)
  7.     monitor.write(string.rep(" ", x))
  8.   end
  9. end
  10.  
  11. local function rsTimer(value)
  12.   while true do
  13.     rs.setBundledOutput("bottom", value)
  14.     sleep(.5)
  15.     rs.setBundledOutput("bottom", 0)
  16.     sleep(.5)
  17.   end
  18. end
  19.  
  20. local selection = 1
  21.  
  22. while true do
  23.   local event = os.pullEvent()
  24.   if event == "monitor_touch" then
  25.     if selection == 1 then
  26.       fillScreen(colors.green)
  27.       selection = 2
  28.     else
  29.       fillScreen(colors.blue)
  30.       selection = 1
  31.     end
  32.   elseif event == "redstone" then
  33.     while rs.getInput("left") do
  34.       rsTimer(selection)
  35.     end
  36.   end
  37.   sleep(0)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment