Advertisement
karelvysinka

regulator blazerodu v chest turtle

Jul 19th, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. local version =
  2. 3.0
  3. -- Program pro prijem zprav pres modem
  4. -- Pri zmene programu je treba na radku 2 zmenit verzi, aby se program automaticky aktualizoval
  5. -- local code je treba zmenit dle potreby
  6.  
  7. local code = "a4g0sQJL"
  8.  
  9. --check version
  10. term.clear()
  11. term.setCursorPos(1,1)
  12. print("Program loading...")
  13. print("Current version: "..version)
  14. local updateSite= http.get("http://pastebin.com/raw.php?i="..code)
  15. updateSite.readLine()
  16. local newVersion = updateSite.readLine()
  17. if tonumber(newVersion) > version then
  18.         print("Update required. Updating now...")
  19.         local updateSite = http.get("http://pastebin.com/raw.php?i="..code)
  20.         local siteFile = updateSite.readAll()
  21.         local writeFile = fs.open(shell.getRunningProgram(),"w")
  22.         writeFile.write(siteFile)
  23.         writeFile.close()
  24.         print("The program will now restart your computer.")
  25.         sleep(1)
  26.         os.reboot()
  27. end
  28.  
  29. function start()
  30.     while true do
  31.             turtle.select(1)
  32.             turtle.suck()
  33.             if turtle.getItemCount( turtle.getSelectedSlot() ) > 63 then
  34.                 print("Ve slotu je více jak jeden item. Uložíme do condenzeru....")
  35.                 turtle.dropUp()
  36.             else
  37.                 print("SLot je prázdný. Nebudeme nasávat a budeme blazerod vkládat...")
  38.                 turtle.suckDown()
  39.                 turtle.drop()
  40.             end  
  41.     end  
  42. end
  43.  
  44. --start programu
  45. local a=0
  46. while true do
  47.     start()
  48.     a=a+1
  49.     print(a)
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement