Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version =
- 5.1
- -- 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 = "5rTHHRhE"
- --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 aktualni")
- 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)
- if message == "tankuj" then
- turtle.suckDown()
- turtle.refuel()
- turtle.suckDown()
- turtle.refuel()
- end
- if message == "tez" then
- turtle.dig()
- while turtle.detect() == true do
- turtle.dig()
- end
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- turtle.dig()
- while turtle.detect() == true do
- turtle.dig()
- end
- end
- if message == "vyp" then
- turtle.select(1)
- turtle.placeDown()
- turtle.select(2)
- turtle.dropDown(64)
- turtle.select(3)
- turtle.dropDown(64)
- turtle.select(4)
- turtle.dropDown(64)
- turtle.select(5)
- turtle.dropDown(64)
- turtle.select(6)
- turtle.dropDown(64)
- turtle.select(7)
- turtle.dropDown(64)
- turtle.select(8)
- turtle.dropDown(64)
- turtle.select(9)
- turtle.dropDown(64)
- turtle.select(10)
- turtle.dropDown(64)
- turtle.select(11)
- turtle.dropDown(64)
- turtle.select(12)
- turtle.dropDown(64)
- turtle.select(13)
- turtle.dropDown(64)
- turtle.select(14)
- turtle.dropDown(64)
- turtle.select(15)
- turtle.dropDown(64)
- turtle.select(16)
- turtle.dropDown(64)
- sleep(16)
- turtle.digDown()
- end
- if message == "dig" then
- turtle.dig()
- end
- if message == "d" then
- turtle.dig()
- end
- if message == "reboot" then
- print("Rebootuji computer")
- os.reboot()
- end
- if message == "digUp" then
- print("Tento prikaz bude osetren, aby se nerobila Turtla nad turtlou. Zatim nefunguje.")
- --zde je treba napsat osetreni proti zniceni turtly nad
- --turtle.digUp()
- end
- if message == "forward" then
- print("Turtla jede dopredu.")
- turtle.forward()
- end
- if message == "f" then
- print("Turtla jede dopredu.")
- turtle.forward()
- end
- if message == "back" then
- print("Turtla jede dozadu.")
- turtle.back()
- end
- if message == "up" then
- print("Turtla jede nahoru.")
- turtle.up()
- end
- if message == "turnleft" then
- print("Turtla se otocila doleva.")
- turtle.turnLeft()
- end
- if message == "turnright" then
- print("Turtla se otocila doprava.")
- turtle.turnRight()
- end
- if message == "refuel" then
- print("Turtla se natankovala uhlim na 64.")
- turtle.select(1)
- turtle.refuel(64)
- end
- if message == "refuel2" then
- print("Turtla se natankovala z 2 slotu uhlim na 64.")
- turtle.select(2)
- turtle.refuel(64)
- end
- if message == "drop" then
- print("Turtl upustila 64 itemu.")
- turtle.drop(64)
- end
- print("Konec provadeni prikazu")
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement