Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version =
- 7.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 = "7cn2k2cT"
- --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 modem right.")
- print("Zadej prikaz: ")
- local input = read()
- print("Odesilam prikaz:")
- print(input)
- if input == "tank" then
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t1
- sleep(3)
- turtle.dig()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t2
- sleep(3)
- turtle.dig()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t3
- sleep(3)
- turtle.dig()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t4
- sleep(3)
- turtle.dig()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t5
- sleep(3)
- turtle.dig()
- turtle.up()
- turtle.up()
- turtle.up()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t6
- sleep(3)
- turtle.dig()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t7
- sleep(3)
- turtle.dig()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t8
- sleep(3)
- turtle.dig()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t9
- sleep(3)
- turtle.dig()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.select(1)
- turtle.place()
- rednet.broadcast("tankuj") -- tankovani t10
- sleep(3)
- turtle.dig()
- turtle.down()
- turtle.down()
- turtle.down()
- turtle.back()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- if input == "tez" then
- turtle.forward()
- end
- print("..pres modem...")
- rednet.broadcast(input)
- print("Prikaz odeslan...")
- 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