Advertisement
Wihad

Enter Position

Jun 23rd, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. local coor={"","",""}   --x,y,z
  2. local curPos= {[1]=0, [2]=0, [3]=0}
  3. local turtleFace=2  --1:forward, 2:right, 3:back, 4:left
  4.  
  5. function prntScrn()
  6.   term.clear()
  7.   term.setCursorPos(1,1)
  8.   print("enter turtle coordinate:")
  9.   print("x="..coor[1])
  10.   term.setCursorPos(10,2)
  11.   print("y="..coor[2])
  12.   term.setCursorPos(20,2)
  13.   print("z="..coor[3])
  14. end
  15.  
  16. function coorSet()
  17.   prntScrn()
  18.   for a=1,3 do
  19.     local entry
  20.     while true do
  21.       if a==1 then term.setCursorPos(3,2)
  22.       elseif a==2 then term.setCursorPos(12,2)
  23.       elseif a==3 then term.setCursorPos(22,2)
  24.       end
  25.       entry=tonumber(read())
  26.       if entry then
  27.         break
  28.       end
  29.       prntScrn()    
  30.     end
  31.     coor[a] = entry
  32.     prntScrn()
  33.   end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement