Advertisement
Guest User

startup

a guest
Jul 24th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.70 KB | None | 0 0
  1. rs.setBundledOutput("bottom", colors.red+colors.blue+colors.lime+colors.yellow)
  2. m = peripheral.wrap("back")
  3.  
  4. function writePos(x,y,txt)
  5.  m.setCursorPos(x,y)
  6.  m.write(txt)
  7. end
  8.  
  9. function writeBox(name,x,y,color)
  10.  m.setCursorPos(x,y)
  11.  m.setBackgroundColor(color)
  12.  m.write("          ")
  13.  m.setCursorPos(x,y+1)
  14.  m.write("          ")
  15.  m.setCursorPos(x,y+2)
  16.  m.write("          ")
  17.  m.setCursorPos(x+2,y+1)
  18.  m.write(name)
  19. end
  20.  
  21. function RemainingTime()
  22.  writePos(4,12,"Remaining Time:  30 sec.")
  23.  sleep(10)
  24.  writePos(4,12,"Remaining Time:  20 sec.")
  25.  sleep(10)
  26.  writePos(4,12,"Remaining Time:  10 sec.")
  27.  sleep(10)
  28.  writePos(4,12,"Remaining Time:   0 sec.")
  29.  sleep(3)
  30.  shell.run("reboot")
  31. end
  32.  
  33. writePos(7,1,"Sappling Selector")
  34. writeBox("Oak",5,4,colors.red)
  35. writeBox("Spruce",17,4,colors.red)
  36. writeBox("Birch",5,8,colors.red)
  37. writeBox("Rubber",17,8,colors.red)
  38.  
  39. while true do
  40.  
  41. event,side,x,y = os.pullEvent()
  42. print(x)
  43. print(y)
  44.  if event == "monitor_touch" then
  45.   if (x>4 and x<15 and y>3 and y<7) then
  46.    writeBox("Oak",5,4,colors.lime)
  47.    rs.setBundledOutput("bottom",colors.blue+colors.lime+colors.yellow)
  48.    RemainingTime()
  49.   end
  50.   if (x>16 and x< 27 and y>3 and y<7) then
  51.    writeBox("Spruce",17,4,colors.lime)
  52.    rs.setBundledOutput("bottom",colors.red+colors.lime+colors.yellow)
  53.    RemainingTime()
  54.   end
  55.   if (x>4 and x<15 and y>7 and y<18) then
  56.    writeBox("Birch",5,8,colors.lime)
  57.    rs.setBundledOutput("bottom",colors.red+colors.blue+colors.yellow)
  58.    RemainingTime()
  59.   end
  60.   if (x>16 and x<27 and y>7 and y<18) then
  61.    writeBox("Rubber",17,8,colors.lime)
  62.    rs.setBundledOutput("bottom",colors.red+colors.blue+colors.lime)
  63.    RemainingTime()
  64.   end  
  65.  end
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement