Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setAutoFarmInfo(farmInfo)
- local infoFile = fs.open("AutoFarmInfo.txt", "w")
- infoFile.writeLine(farmInfo["width"])
- infoFile.writeLine(farmInfo["length"])
- infoFile.writeLine(farmInfo["x"])
- infoFile.writeLine(farmInfo["y"])
- infoFile.close()
- end
- function getAutoFarmInfo()
- local infoFile = fs.open("AutoFarmInfo.txt", "r")
- infoTable = {}
- infoTable["width"] = tonumber(infoFile.readLine())
- infoTable["length"] = tonumber(infoFile.readLine())
- infoTable["x"] = tonumber(infoFile.readLine())
- infoTable["y"] = tonumber(infoFile.readLine())
- infoFile.close()
- return infoTable
- end
- if not fs.exists("AutoFarmInfo.txt") then
- local farmInfo = {}
- print("AutoFarm Setup")
- io.write("Farm width: ")
- farmInfo["width"] = tonumber(read()) - 1
- io.write("Farm length: ")
- farmInfo["length"] = tonumber(read()) - 1
- farmInfo["x"] = 0
- farmInfo["y"] = 0
- setAutoFarmInfo(farmInfo)
- end
- farmInfo = getAutoFarmInfo()
- for currentY = farmInfo["y"],farmInfo["width"],1 do
- farmInfo["y"] = currentY
- if farmInfo["x"] == farmInfo["length"] then
- forLoopLengthFix = farmInfo["length"]
- forLoopDirection = -1
- else
- forLoopLengthFix = 0
- forLoopDirection = 1
- end
- for currentX = farmInfo["x"],farmInfo["length"]-forLoopLengthFix,forLoopDirection do
- farmInfo["x"] = currentX
- --setAutoFarmInfo(farmInfo)
- print(currentX)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement