Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- craftoption= {"1x1", "2x2", "3x3", "2 vertical", "2 horizontal", "3 horizontal", "3 shapeless"}
- craftoptionslots={ {1}, {1,2,5,6}, {1,2,3,5,6,7,9,10,11}, {1,5}, {1,2}, {1,2,3}, {1,2,3}}
- if (fs.exists("choices") == false) then --Check if this is first time run, no saved choices on file
- while true do --Asks for type of crops
- print("Please pick crafting pattern:")
- for i=1, #craftoption do
- print(i..". "..craftoption[i])
- end
- local answer = read()
- if tonumber(answer)==nill then
- print("-Wrong answer, input not a number-")
- else
- local answerv = tonumber(string.format("%." .. 0 .. "f", answer))
- if (0 < answerv and answerv <= #craftoption) then
- craftchoice=answerv
- print("Crafting method chosen: "..craftoption[answerv])
- break
- else
- print("-Wrong answer, input does not match range of choices-")
- end
- end
- end
- --Write choices to file
- local file = fs.open("choices","w")
- file.writeLine("craftchoice="..tostring(craftchoice))
- file.close()
- end
- os.loadAPI("choices") -- Reads choices from file
- local craftchoice = choices.craftchoice
- --Empty inventory from items from before restart
- for i=1,16 do
- turtle.select(i)
- turtle.dropDown()
- end
- while true do
- for _,i in pairs(craftoptionslots[craftchoice]) do
- turtle.select(i)
- while not turtle.suckUp(1) do
- sleep(5)
- end
- end
- turtle.select(4)
- turtle.craft()
- if turtle.getItemCount(4)>0 then
- while not turtle.dropDown() do
- sleep(1)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement