• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# startup

a guest Feb 21st, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. function moveTo(x,y)
2. --X CNT/ItemNumber--
3. print("Our X Is: "..x)
4. if x > 6 and x <= 12 then y = 1 x = x -6
5. elseif x > 12 and x <= 18 then y = 2 x = x -12
6. elseif x > 18 and x <= 24 then y = 3 x = x -18
7. elseif x > 24 and x <= 30 then y = 4 x = x -24
8. elseif x > 30 and x <= 36 then y = 5 x = x -30
9. elseif x == 36 then print("Out Of Space.")
10.
11. else y = 0
12.
13. end
14. for i=1,y do
15. turtle.up()
16. end
17. for i=1,x do
18. turtle.back()
19.
20. end
21. turtle.turnLeft()
22. turtle.drop()
23. print(x.." "..y)
24. return
25. end
26. -----------------------
27. function returnHome()
28. turtle.select(1)
29. turtle.turnRight()
30. for i=1,8 do
31. turtle.forward()
32. end
33. for i=1,13 do
34. turtle.down()
35. end
36. end
37. ---------------------
38.
39. --returnHome()
40. if turtle.suckDown() == false and turtle.getItemCount() == 0 then
41. print("Empty.")
42. return
43. end
44. -----------
45. if turtle.getItemCount() == 0 then
46. turtle.select(1)
47. turtle.suckDown()
48. name = turtle.getItemDetail()["name"]
49. meta = turtle.getItemDetail()["damage"]
50. item = name..meta
51. else
52. turtle.select(1)
53. name = turtle.getItemDetail()["name"]
54. meta = turtle.getItemDetail()["damage"]
55. item = name..meta
56.
57. end
58.
59. local cnt = 0
60.
61.
62. if fs.exists("items") then
63. term.setTextColor(colors.orange)print("Checking System...")
64. local file = fs.open("items","r")
65. local contet = {}
66. for line in file.readLine do
67. cnt = cnt +1
68. if line:find(item) then
69. term.setTextColor(colors.red) print("Item Here. Line: "..cnt) cntt = cnt
70. itemHere = "1"
71. end
72. end
73. file.close()
74. end
75.
76. if itemHere == "1" then
77. term.setTextColor(colors.blue) print("Routing To Storage")
78. term.setTextColor(colors.yellow) print(cntt)
79. moveTo(cntt,0)
80. returnHome()
81. os.reboot()
82.
83. --elseif cnt > 36 then print("No Space.")
84.
85. else
86. term.setTextColor(colors.green)
87. print("Item Not Here! Logging it!")
88. local file = fs.open("items","a")
89. file.writeLine(item)
90. file.close()
91. os.reboot()
92.
93.
94. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top