oblinger

Where am I

Mar 20th, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. --Where am I?
  2. lnum = 0
  3. x = 100
  4. y = 64
  5. z = 20
  6. look = 0
  7.  
  8.  
  9.  
  10. function getCords()
  11. if peripheral.find("modem") == false then
  12. printError("No modem attatched")
  13. error()
  14. end
  15.  
  16. shell.run("clear")
  17.  
  18. term.write("Current Position is...")
  19. term.write(" "..x.." "..y.." "..z)
  20. print()
  21. end
  22.  
  23. function getLocation()
  24. if fs.exists("locations") == false then
  25. print("No locations file. Would you like to create one? (y/n)")
  26. input = read()
  27. if input == "y" then
  28. locFile = fs.open("locations","w")
  29.  
  30. locFile.write("<Location Format: The Z Cordinate: (Next Line) Name of location> DELETE THIS TEXT")
  31.  
  32. locFile.close()
  33. shell.run("clear")
  34. print("Locations File Created!")
  35. error()
  36. elseif input == "n" then
  37. print("Okay!")
  38. error()
  39. end
  40.  
  41. elseif fs.exists("locations") == true then
  42. location = z
  43. end
  44.  
  45. files = fs.open("locations","r")
  46.  
  47. repeat
  48. line = files.readLine()
  49.  
  50. if line == z then
  51. linenum = linenum + 1
  52. print("You are at "..files.readLine())
  53. else
  54. files.readLine()
  55. end
  56.  
  57. until line == nil
  58.  
  59. print("No location found")
  60. end
  61.  
  62. getCords()
  63. getLocation()
Advertisement
Add Comment
Please, Sign In to add comment