Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- id=8767
- x=20
- y=7
- dir=1
- term.clear()
- term.setCursorPos(x,y)
- while true do
- local sEvent, param = os.pullEvent("key")
- if param == 200 then
- rednet.send(id,"Forward")
- sleep(0.2)
- end
- if param == 203 then
- rednet.send(id,"Left")
- sleep(0.2)
- end
- if param == 205 then
- rednet.send(id,"Right")
- sleep(0.2)
- end
- if param == 208 then
- rednet.send(id,"Back")
- sleep(0.2)
- end
- if param == 52 then
- rednet.send(id,"Dig")
- sleep(0.2)
- end
- if param == 12 then
- rednet.send(id,"Place")
- sleep(0.2)
- end
- if param == 17 then
- rednet.send(id,"Up")
- sleep(0.2)
- end
- if param == 31 then
- rednet.send(id,"Down")
- sleep(0.2)
- end
- id,recall,distance=rednet.receive()
- if recall=="Right" then
- dir=dir+1
- end
- if recall=="Left" then
- dir=dir-1
- end
- if dir<1 then
- dir=4
- end
- if dir>4 then
- dir=1
- end
- if dir==1 then
- look="^"
- end
- if dir==2 then
- look=">"
- end
- if dir==3 then
- look="v"
- end
- if dir==4 then
- look="<"
- end
- if recall=="Forward" then
- if dir==1 then
- y=y-1
- end
- if dir==2 then
- x=x+1
- end
- if dir==3 then
- y=y+1
- end
- if dir==4 then
- x=x-1
- end
- end
- if recall=="Back" then
- if dir==1 then
- y=y+1
- end
- if dir==2 then
- x=x-1
- end
- if dir==3 then
- y=y-1
- end
- if dir==4 then
- x=x+1
- end
- end
- if recall=="blocked" then
- end
- term.setCursorPos(x,y)
- term.write(look)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement