OscarXcore

Simple Agricraft Computer Controller Analyzer

Jul 27th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.69 KB | None | 0 0
  1. screen = peripheral.wrap('top')
  2. seed = peripheral.wrap('right')
  3. screen.setTextScale(1.25)
  4.  
  5. -- GET SEED STATS --
  6. function getStats()
  7.  
  8.   if seed.getSpecimenStats() ~= nil then
  9.  
  10.     stat1, stat2, stat3 = seed.getSpecimenStats()
  11.     screen.clear()
  12.     screen.setCursorPos(1,1)
  13.     screen.write(seed.getSpecimen())
  14.     screen.setCursorPos(1,2)
  15.     screen.write('Growth: ' .. stat1)
  16.     screen.setCursorPos(1,3)
  17.     screen.write('Gain: ' .. stat2)
  18.     screen.setCursorPos(1,4)
  19.     screen.write('Strength: ' .. stat3)
  20.  
  21.   end
  22.  
  23. end
  24.  
  25. -- CREATE WAITING SCREEN --
  26. function loadingDots()
  27.  
  28.   screen.clear()
  29.   screen.setBackgroundColor(colors.blue)
  30.   screen.setCursorPos(1,1)
  31.  
  32.   screen.write('Waiting')
  33.   sleep(.2)
  34.   screen.setCursorPos(8,1)
  35.  
  36.   screen.write('.')
  37.   sleep(.2)
  38.   screen.setCursorPos(9,1)
  39.  
  40.   screen.write('.')
  41.   sleep(.2)
  42.   screen.setCursorPos(10,1)
  43.  
  44.   screen.write('.')
  45.   sleep(.2)
  46.  
  47. end
  48.  
  49. -- ANALYZE SEEDS IN ANALYZER --
  50. function analyzeSeeds()
  51.  
  52.   if seed.getSpecimen() == nil then
  53.  
  54.     screen.clear()
  55.     screen.setCursorPos(1,1)
  56.     screen.setBackgroundColor(colors.red)
  57.     screen.write('There is no seed...')
  58.  
  59.   else
  60.     seed.analyze()
  61.  
  62.     repeat
  63.       sleep(.1)
  64.     until seed.getSpecimenStats() ~= nil
  65.  
  66.     if seed.getSpecimenStats() ~= nil then
  67.       getStats()
  68.     end
  69.  
  70.   end
  71.  
  72. end
  73.  
  74. -- WAIT FOR REDSTONE INPUT --
  75. function check()
  76.  
  77.   if redstone.getInput('left') == false then
  78.  
  79.     repeat
  80.       loadingDots()
  81.     until redstone.getInput('left') == true
  82.  
  83.     if redstone.getInput('left') == true then
  84.       analyzeSeeds()
  85.     end
  86.  
  87.   end
  88.  
  89. end
  90.  
  91. -- LOOP CONTAINER TO KEEP APPLICATION RUNNING --
  92. while true do
  93.   os.pullEvent()
  94.   check()
  95. end
Advertisement
Add Comment
Please, Sign In to add comment