Advertisement
krejcar25

6-way Miner v0.1BETA

Dec 21st, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. m = peripheral.wrap("monitor_0")
  2. shutdown = false
  3. forwardOn, backOn, rightOn, leftOn = true
  4. while not shutdown do
  5.   --white     = back
  6.   --orange    = right
  7.   --magenta   = forward
  8.   --lightBlue = left
  9.   --yellow    = down
  10.   --lime      = up
  11.   m.setBackgroundColor(colors.black)
  12.   m.clear()
  13.   m.setCursorPos(12,1)
  14.   m.setBackgroundColor(colors.lightGray)
  15.   m.setTextColor(colors.yellow)
  16.   m.write("DRIVER")
  17.   m.setBackgroundColor(colors.black)
  18.   --buttons
  19.   m.setCursorPos(9,2)
  20.   m.setTextColor(colors.brown)
  21.   m.setBackgroundColor(colors.yellow)
  22.   m.write("Onetime")
  23.   m.setCursorPos(18,2)
  24.   m.write("Switch")
  25.  
  26.   m.setCursorPos(1,3)
  27.   m.setTextColor(colors.white)
  28.   m.setBackgroundColor(colors.black)
  29.   m.write("Forward")
  30.   m.setCursorPos(9,3)
  31.   m.setBackgroundColor(colors.brown)
  32.   m.write("  NOW  ")
  33.   if forwardOn then
  34.     m.setCursorPos(18,3)
  35.     m.setBackgroundColor(colors.lime)
  36.     m.setTextColor(colors.white)
  37.     m.write("  ON  ")
  38.   else
  39.     m.setCursorPos(18,3)
  40.     m.setBackgroundColor(colors.red)
  41.     m.setTextColor(colors.white)
  42.     m.write("  OFF ")
  43.   end
  44.  
  45.   m.setCursorPos(1,4)
  46.   m.setTextColor(colors.white)
  47.   m.setBackgroundColor(colors.black)
  48.   m.write("Back")
  49.   m.setCursorPos(9,4)
  50.   m.setBackgroundColor(colors.brown)
  51.   m.write("  NOW  ")
  52.   if forwardOn then
  53.     m.setCursorPos(18,4)
  54.     m.setBackgroundColor(colors.lime)
  55.     m.setTextColor(colors.white)
  56.     m.write("  ON  ")
  57.   else
  58.     m.setCursorPos(18,4)
  59.     m.setBackgroundColor(colors.red)
  60.     m.setTextColor(colors.white)
  61.     m.write("  OFF ")
  62.   end
  63.  
  64.   m.setCursorPos(1,5)
  65.   m.setTextColor(colors.white)
  66.   m.setBackgroundColor(colors.black)
  67.   m.write("Left")
  68.   m.setCursorPos(9,5)
  69.   m.setBackgroundColor(colors.brown)
  70.   m.write("  NOW  ")
  71.   if forwardOn then
  72.     m.setCursorPos(18,5)
  73.     m.setBackgroundColor(colors.lime)
  74.     m.setTextColor(colors.white)
  75.     m.write("  ON  ")
  76.   else
  77.     m.setCursorPos(18,5)
  78.     m.setBackgroundColor(colors.red)
  79.     m.setTextColor(colors.white)
  80.     m.write("  OFF ")
  81.   end
  82.  
  83.   m.setCursorPos(1,6)
  84.   m.setTextColor(colors.white)
  85.   m.setBackgroundColor(colors.black)
  86.   m.write("Right")
  87.   m.setCursorPos(9,6)
  88.   m.setBackgroundColor(colors.brown)
  89.   m.write("  NOW  ")
  90.   if forwardOn then
  91.     m.setCursorPos(18,6)
  92.     m.setBackgroundColor(colors.lime)
  93.     m.setTextColor(colors.white)
  94.     m.write("  ON  ")
  95.   else
  96.     m.setCursorPos(18,6)
  97.     m.setBackgroundColor(colors.red)
  98.     m.setTextColor(colors.white)
  99.     m.write("  OFF ")
  100.   end
  101.  
  102.   m.setCursorPos(1,7)
  103.   m.setTextColor(colors.white)
  104.   m.setBackgroundColor(colors.black)
  105.   m.write("Up")
  106.   m.setCursorPos(9,7)
  107.   m.setBackgroundColor(colors.brown)
  108.   m.write("  NOW  ")
  109.   if forwardOn then
  110.     m.setCursorPos(18,7)
  111.     m.setBackgroundColor(colors.lime)
  112.     m.setTextColor(colors.white)
  113.     m.write("  ON  ")
  114.   else
  115.     m.setCursorPos(18,7)
  116.     m.setBackgroundColor(colors.red)
  117.     m.setTextColor(colors.white)
  118.     m.write("  OFF ")
  119.   end
  120.  
  121.   m.setCursorPos(1,8)
  122.   m.setTextColor(colors.white)
  123.   m.setBackgroundColor(colors.black)
  124.   m.write("Right")
  125.   m.setCursorPos(9,8)
  126.   m.setBackgroundColor(colors.brown)
  127.   m.write("  NOW  ")
  128.   if forwardOn then
  129.     m.setCursorPos(18,8)
  130.     m.setBackgroundColor(colors.lime)
  131.     m.setTextColor(colors.white)
  132.     m.write("  ON  ")
  133.   else
  134.     m.setCursorPos(18,8)
  135.     m.setBackgroundColor(colors.red)
  136.     m.setTextColor(colors.white)
  137.     m.write("  OFF ")
  138.   end
  139.  
  140.   --control
  141.   event, side, x, y = os.pullEvent()
  142.  
  143.   if event=="monitor_touch" then
  144.     if x==3 and 8<y<16 then
  145.       rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.magenta))
  146.       sleep(1)
  147.       rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.magenta))
  148.    else if x==4 and 8<y<16 then
  149.       rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.white))
  150.       sleep(1)
  151.       rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.white))
  152.    else if x==5 and 8<y<16 then
  153.       rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.lightBlue))
  154.       sleep(1)
  155.       rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.lightBlue))
  156.    else if x==6 and 8<y<16 then
  157.       rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.orange))
  158.       sleep(1)
  159.       rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.orange))
  160.    else if x==7 and 8<y<16 then
  161.       rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.lime))
  162.       sleep(1)
  163.       rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.lime))
  164.    else if x==8 and 8<y<16 then
  165.       rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.yellow))
  166.       sleep(1)
  167.       rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.yellow))
  168.     end
  169.   end
  170. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement