Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version =
- 5.0
- -- EMP 666 - 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 = "DtHAXJSQ"
- --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ální")
- 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 provedPrikaz(message)
- turtla_label = os.getComputerLabel()
- if message == "tr1sd" and turtla_label == "tr1" then
- turtle.suckUp()
- turtle.dropDown()
- end
- if message == "alldrop" then
- turtle.drop()
- end
- if message == "allsdd" then
- turtle.suckDown()
- turtle.drop()
- end
- if message == "reboot" then
- print("Rebootuji computer")
- os.reboot()
- end
- if message == "refuel" then
- print("Turtla se natankovala uhlím na 64.")
- turtle.select(1)
- turtle.refuel(64)
- end
- print("Konec provadeni prikazu")
- end
- start()
Add Comment
Please, Sign In to add comment