Advertisement
visiongaming43

Untitled

May 22nd, 2022
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. require("TurtleLib/generalLibrary")
  2.  
  3. ERROR_MSG = "YOU INPUTTED AN INVALID RESPONSE! PLEASE TRY AGAIN!"
  4. WRONG_TYPE = ERROR_MSG .. " EXPECTED TYPE WAS "
  5. ANNOYING_MSG = "PROPER STARTING POSITION\n- TURTLE MUST BE AT A CORNER OF THE FARM AND ONE BLOCK BEHIND\n- TURTLE MUST BE ABOVE A CHEST\n- TURTLE MUST BE FACING TOWARDS FARM\n\n* * * *\n* * * *\n* * * *\nx\n\nPlease Press Enter To Continue...\n"
  6. SUCCESS_MSG = "YOU HAVE SUCCESSFULLY SET UP YOUR FARMING SETTINGS!"
  7.  
  8. function promptNumber(userText)
  9. io.write(userText)
  10. local number = tonumber(io.read())
  11. while (number <= 0) do
  12. io.write(userText)
  13. number = tonumber(io.read())
  14. end
  15. return number
  16. end
  17.  
  18. function promptOrientation(userText)
  19. io.write(userText)
  20. local orientation = io.read()
  21. while (orientation ~= "LEFT" and orientation ~= "RIGHT") do
  22. io.write(userText)
  23. orientation = io.read()
  24. end
  25. return orientation
  26. end
  27.  
  28. -- Fetching GPS Coordinates
  29. printColor(colors.yellow, ANNOYING_MSG)
  30. local _ = io.read()
  31. local x, y, z = getCoordinates()
  32.  
  33. -- Fetching Manual Values For Farm
  34. local length = promptNumber("Length: ")
  35. local width = promptNumber("Width: ")
  36. local orientation = promptOrientation("Direction [LEFT] OR [RIGHT]: ")
  37. local direction = getDirection()
  38.  
  39. -- Creating Info Array
  40. local info = { x, y, z, length, width, orientation, direction }
  41.  
  42. -- Creating file stats (x, y, z, length, width, direction)
  43. local settings = fs.open("Settings", "w")
  44. for key, line in ipairs(info) do
  45. settings.writeLine(info[key])
  46. end
  47. printColor(colors.green, SUCCESS_MSG)
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement