Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require("TurtleLib/generalLibrary")
- ERROR_MSG = "YOU INPUTTED AN INVALID RESPONSE! PLEASE TRY AGAIN!"
- WRONG_TYPE = ERROR_MSG .. " EXPECTED TYPE WAS "
- 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"
- SUCCESS_MSG = "YOU HAVE SUCCESSFULLY SET UP YOUR FARMING SETTINGS!"
- function promptNumber(userText)
- io.write(userText)
- local number = tonumber(io.read())
- while (number <= 0) do
- io.write(userText)
- number = tonumber(io.read())
- end
- return number
- end
- function promptOrientation(userText)
- io.write(userText)
- local orientation = io.read()
- while (orientation ~= "LEFT" and orientation ~= "RIGHT") do
- io.write(userText)
- orientation = io.read()
- end
- return orientation
- end
- -- Fetching GPS Coordinates
- printColor(colors.yellow, ANNOYING_MSG)
- local _ = io.read()
- local x, y, z = getCoordinates()
- -- Fetching Manual Values For Farm
- local length = promptNumber("Length: ")
- local width = promptNumber("Width: ")
- local orientation = promptOrientation("Direction [LEFT] OR [RIGHT]: ")
- local direction = getDirection()
- -- Creating Info Array
- local info = { x, y, z, length, width, orientation, direction }
- -- Creating file stats (x, y, z, length, width, direction)
- local settings = fs.open("Settings", "w")
- for key, line in ipairs(info) do
- settings.writeLine(info[key])
- end
- printColor(colors.green, SUCCESS_MSG)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement