Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- WEB TOTLES!
- -- Korbin Ancell 1/25/2016
- local direction = 'f'
- local headers = {
- ["User-Agent"] = "turtle",
- ["firstTime"] = "true"
- }
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- clear()
- print("Waiting for Scottie to beam down the next instruction")
- local input = http.get("http://zsi.duckdns.org/webturtle.php", headers)
- headers["firstTime"] = "false"
- while(true) do
- while(true) do
- sleep(.5)
- input = http.get("http://zsi.duckdns.org/webturtle.php", headers)
- local msg = input.readAll()
- if msg == "nil" then break end
- --Movement--
- if msg == "f" then turtle.forward() break end
- if msg == "b" then turtle.back() break end
- if msg == "r" then turtle.turnRight() break end
- if msg == "l" then turtle.turnLeft() break end
- if msg == "u" then turtle.up() break end
- if msg == "d" then turtle.down() break end
- --Actions--
- if msg == "m" then
- if direction == "f" then turtle.dig() break end
- if direction == "u" then turtle.digUp() break end
- if direction == "d" then turtle.digDown() break end
- end
- if msg == "place" then
- if direction == "f" then turtle.place() break end
- if direction == "u" then turtle.placeUp() break end
- if direction == "d" then turtle.placeDown() break end
- end
- if msg == "pickup" then
- if direction == "f" then turtle.suck() break end
- if direction == "u" then turtle.suckUp() break end
- if direction == "d" then turtle.suckDown() break end
- end
- --Directions--
- if msg =="mf" then direction ="f" break end
- if msg =="md" then direction ="d" break end
- if msg =="mu" then direction ="u" break end
- --Exit--
- if msg =="exit" then os.reboot() end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment