Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Forward(x)
- y=0
- while y<x do
- while turtle.forward() == false do
- if turtle.detect() == true then
- turtle.dig()
- else
- turtle.attack()
- end
- end
- y=y+1
- end
- end
- function Left()
- turtle.turnLeft()
- end
- function Right()
- turtle.turnRight()
- end
- function Turn()
- turtle.turnRight()
- turtle.turnRight()
- end
- function Up(x)
- y=0
- while y<x do
- while turtle.up() == false do
- if turtle.detectUp() == true then
- turtle.digUp()
- else
- turtle.attackUp()
- end
- end
- y=y+1
- end
- end
- function Down(x)
- y=0
- while y<x do
- while turtle.down() == false do
- if turtle.detectDown() == true then
- turtle.digDown()
- else
- turtle.attackDown()
- end
- end
- y=y+1
- end
- end
- function Help()
- print("---------------------------------------")
- print("------------- Commands -------------")
- print("---------------------------------------")
- print("------------- Forward - w -------------")
- print("------------- Left - a -------------")
- print("------------- Right - d -------------")
- print("------------- Turn - s -------------")
- print("------------- Up - W -------------")
- print("------------- Down - S -------------")
- print("------------- Exit - e -------------")
- print("---------------------------------------")
- print("---------------------------------------")
- end
- ----main--------------------------------------
- Help()
- while true do
- Input = read()
- if Input == "w" then
- Forward(1)
- elseif Input == "a" or Input == "Left" or Input == "left" or Input == "l" or Input == "L" then
- Left()
- elseif Input == "d" or Input == "Right" or Input == "right" or Input == "r" or Input == "R" then
- Right()
- elseif Input == "s" then
- Turn()
- elseif Input == "W" then
- Up(1)
- elseif Input == "S" then
- Down(1)
- elseif Input == "e" or Input == "E" or Input == "Exit" or Input == "exit" or Input == "q" or Input == "Q" then
- shell.run("clear")
- return false
- elseif Input == "Forward" or Input == "forward" or Input == "Move" or Input == "move" or Input == "F" or Input == "f" then
- write("Forward: ")
- x = tonumber(read())
- Forward(x)
- elseif Input == "Up" or Input == "up" or Input == "u" or Input == "U" then
- write("Up: ")
- x = tonumber(read())
- Up(x)
- elseif Input == "Down" or Input == "down" then
- write("Down: ")
- x = tonumber(read())
- Down(x)
- end
- Help()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement