View difference between Paste ID: q5T5vgWc and KqGYdQrU
SHOW: | | - or go back to the newest paste.
1
m = peripheral.wrap("top")
2
--data = m.getAllStacks()
3
--for i,j in pairs(data) do
4
--   for a,b in pairs(j) do
5
--      print(a)
6
--      print(b)
7
--   end
8
--   print(i..j["name"])
9
--end
10
11
function emptyPlayer()
12
   a=1
13
   for i = 1,9 do
14
      m.pushItemIntoSlot("east", i, 64,a)
15
      a=a+1
16
   end
17
   for i = 37, 40 do
18
      m.pushItemIntoSlot("east", i, 64,a)
19
      a=a+1
20
   end
21
end
22
23
function fillPlayer()
24
   a=1
25
   for i = 1,9 do
26
      m.pullItemIntoSlot("east", a, 64, i)
27
      a=a+1
28
   end
29
   for i = 37,40 do
30
      m.pullItemIntoSlot("east", a, 64, i)
31
      a=a+1
32
   end
33
end
34
35
while true do
36
event = os.pullEvent()
37
print(event)
38
if event == "player_on" then
39
if m.getStackInSlot(1) then
40
   emptyPlayer()
41
   print("empty")
42
else
43
   fillPlayer()
44
   print("full")
45
end
46
end
47
end