Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version =
- 3.0
- -- Program pro prijem zprav pres modem
- -- Pri zmene programu je treba na radku 2 zmenit verzi, aby se program automaticky aktualizoval
- -- local code je treba zmenit dle potreby
- local code = "VuM50bxj"
- --check version
- term.clear()
- term.setCursorPos(1,1)
- print("Program loading...")
- print("Current version: "..version)
- local updateSite= http.get("http://pastebin.com/raw.php?i="..code)
- updateSite.readLine()
- local newVersion = updateSite.readLine()
- if tonumber(newVersion) > version then
- print("Update required. Updating now...")
- local updateSite = http.get("http://pastebin.com/raw.php?i="..code)
- local siteFile = updateSite.readAll()
- local writeFile = fs.open(shell.getRunningProgram(),"w")
- writeFile.write(siteFile)
- writeFile.close()
- print("The program will now restart your computer.")
- sleep(1)
- os.reboot()
- end
- function start()
- while true do
- print ("Program je aktuåA1lnåAD")
- print ("Program bezi...")
- rednet.open("right")
- print ("Oteviram medem right.")
- print("Cekam na zpravu...")
- id, message = rednet.receive(10000000000000)
- print ("Computer ".. id .. " has sent us a message")
- print ("The message is")
- print (message)
- provedPrikaz(message)
- end
- end
- function turtlesuckdrop()
- turtle.suck()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.drop()
- turtle.turnRight()
- turtle.turnRight()
- end
- function testcondenseru()
- local success, data = turtle.inspect()
- if success then
- print("Block name: ", data.name)
- print("Block metadata: ", data.metadata)
- local datan = data.name
- if datan == "ProjectE:condenser_mk1" then
- turtlesuckdrop()
- return true
- else
- return false
- end
- end
- end
- function provedPrikaz(message)
- if message == "as" then
- --prvni test
- local a = testcondenseru()
- if a == false then
- turtle.turnRight()
- end
- local b = testcondenseru()
- if b == false then
- turtle.turnRight()
- end
- local c = testcondenseru()
- if c == false then
- turtle.turnRight()
- end
- local d = testcondenseru()
- if d == false then
- turtle.turnRight()
- print("condenser_mk1 nenalezen...")
- end
- print("Konec provadeni prikazu")
- end
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement