Advertisement
avartoon15

quarry

Apr 18th, 2020
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. m = peripheral.wrap("top")
  2. rs.setBundledOutput("right", 0)
  3.  
  4. print("Hossz:")
  5. local hossz = read()
  6. print("Miningwell DB:")
  7. local db = read()
  8. print("white time?")
  9. local tim = read()
  10.  
  11.  
  12. function msg(txt,col)
  13.   m.setBackgroundColor(colors.cyan)
  14.   m.clear()
  15.   m.setCursorPos(2,2)
  16.   if col == nil then
  17.     m.setTextColor(colors.green)
  18.   else
  19.     m.setTextColor(col)
  20.   end
  21.   m.write(txt)
  22.   m.setCursorPos(14,5)
  23.   m.setTextColor(colors.red)
  24.   m.write("By avartoon15 :)")
  25. end
  26.  
  27. function quarry(pro)
  28.   msg("Break")
  29.   rs.setBundledOutput("right", colors.white)
  30.   sleep(1)
  31.   rs.setBundledOutput("right", 0)
  32.   if f == 0 then
  33.      msg("Forward")
  34.    else
  35.      msg("Back")
  36.    end
  37.   sleep(1)
  38.   rs.setBundledOutput("right", pro)
  39.   sleep(2)
  40.   msg("Deploy")
  41.   rs.setBundledOutput("right", colors.red)
  42.   sleep(1)
  43.   rs.setBundledOutput("right", 0)
  44.   for i = 1,tim do
  45.     msg("Dolgozom     s", colors.yellow)
  46.     m.setTextColor(colors.yellow)
  47.     m.setCursorPos(11,2)
  48.     m
  49.     m.write(%tim - i)
  50.     m.setTextScale(1)
  51.     m.setCursorPos(13,4 )
  52.    if f == 0 then
  53.       m.write("Forward")
  54.     else
  55.       m.write("Back")
  56.     end
  57.     sleep(1)
  58.   end
  59. end
  60.  
  61. function ford()
  62.   msg("Quarry Turn", colors.yellow)
  63.   rs.setBundledOutput("right", colors.white)
  64.   sleep(1)
  65.   rs.setBundledOutput("right", 0)
  66.   for i = 1,db do
  67.       stop()
  68.       rs.setBundledOutput("right", colors.blue)
  69.       sleep(1)
  70.       rs.setBundledOutput("right", 0)
  71.       sleep(1)
  72.   end
  73. end
  74.  
  75. function stop()
  76.   while rs.getInput("left") == true do
  77.     msg("Quarry Off", colors.red)
  78.     rs.setBundledOutput("right", 0)
  79.     sleep(1)
  80.   end
  81. end
  82. function irany(szin)
  83.   for i = 1,hossz do
  84.     stop()
  85.     quarry(szin)
  86.   end
  87. end
  88.  
  89.   f = 0
  90.   stop()
  91.   irany(colors.yellow)
  92.   ford()
  93.   f = 1
  94.   stop()
  95.   irany(colors.orange)
  96.   ford()
  97.   msg("Quarry end")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement