Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version =
- 10.8
- -- 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 = "KnptMGeR"
- --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()
- print ("TEST:")
- print (newVersion)
- print ()
- print (version)
- print ()
- 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
- term.clear()
- print("Current version: "..version)
- term.setCursorPos(1,1) print ("Program je aktuální")
- print ("Program bezi...")
- rednet.open("right")
- print ("Oteviram modem right.")
- print("Stlač klávesu pro daný režim vyprazdňování condenserů: ")
- print(" ")
- print("A = Automatické vyprazdňování condenserů")
- print("V = Vypnout vyprazdňování")
- print("M = Manualní ovládání - každé stlačení vyprázdní Condensery")
- local stav = 0
- local event, key, isHeld = os.pullEvent("key")
- if key == keys.a then
- term.clear()
- term.setCursorPos(1,1)
- print("Obrazovka vymazana")
- print(stav)
- stav = 1
- print(stav)
- os.sleep(1)
- while not stav==3 do
- os.sleep(1)
- print("Vyprazdnuji condenser")
- rednet.broadcast("as")
- print("Vyprázdněno...")
- term.clear()
- term.setCursorPos(1,1)
- if key2 == keys.v then
- print("Vypínám automat.")
- stav = 3
- os.sleep(1)
- end
- end
- end
- if key == keys.v then
- os.sleep(1)
- stav = 2
- end
- if key == keys.m then
- stav = 3
- rednet.broadcast("as")
- os.sleep(1)
- end
- end
- end
- function provedPrikaz(message)
- if message == "turtledig" then
- turtle.dig()
- end
- if message == "reboot" then
- print("Rebootuji computer")
- os.reboot()
- end
- print("Konec provadeni prikazu")
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement