Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args ={...}
- local i;
- local f;
- local turns;
- local pulser_set={}
- --local dirs = { ["front"]=2,["top"]=3,["bottom"]=1}
- local suckfunc={["bottom"]=turtle.suckDown,["front"]=turtle.suck,["top"]=turtle.suckUp}
- local dropfunc={["bottom"]=turtle.dropDown,["front"]=turtle.drop,["top"]=turtle.dropUp}
- local aliases={["top"]="top",
- ["bottom"]="bottom",
- ["front"]="front",
- ["up"]="top",
- ["down"]="bottom",
- ["forward"]="front",
- ["t"]="top",
- ["b"]="bottom",
- ["f"]="front",
- ["u"]="top",
- ["d"]="bottom"
- }
- if #args<2 or #args >3 then
- if not fs.exists("hoppersetting") then print("startup <take from> <put in> [delay]");error(); end
- f=fs.open("hoppersetting","r")
- pulser_set= textutils.unserialize(f.readAll())
- f.close()
- else
- pulser_set[1]=#args
- for i=1, pulser_set[1] do
- pulser_set[i+1] = args[i]
- if i<3 then
- pulser_set[i+1]=aliases[args[i]]
- if suckfunc[pulser_set[i+1]]== nil then
- print(args[i].." is not yet supported")
- error()
- end
- end
- end
- end
- f=fs.open("hoppersetting","w")
- f.write(textutils.serialize(pulser_set))
- f.close()
- local delay=1
- if pulser_set[4]~=nil then
- delay=tonumber(pulser_set[4])
- if delay==nil then
- print("bad delay");error()
- end
- end
- local sf=suckfunc[pulser_set[2]]
- local df=dropfunc[pulser_set[3]]
- while true do
- if turtle.getItemCount(1)==0 then
- sf()
- end
- df()
- sleep(delay)
- end
Advertisement
Add Comment
Please, Sign In to add comment