View difference between Paste ID: xTkZG9vQ and tiwidCYt
SHOW: | | - or go back to the newest paste.
1-
local PORT = 666
1+
local PORT = 666
2-
---===---
2+
---===---
3-
local com = require("component")
3+
local com = require("component")
4-
local modem = com.modem
4+
local modem = com.modem
5-
local craft = com.crafting
5+
local craft = com.crafting
6-
local inv = com.inventory_controller
6+
local inv = com.inventory_controller
7-
local robot = require("robot")
7+
local robot = require("robot")
8-
local event = require("event")
8+
local event = require("event")
9-
local comp = require("computer")
9+
local comp = require("computer")
10-
10+
11-
modem.open(PORT)
11+
modem.open(PORT)
12-
robot.select(8)
12+
robot.select(8)
13-
while true do
13+
while true do
14-
  data={event.pull("modem_message")}
14+
  data={event.pull("modem_message")}
15-
  print(table.unpack(data))
15+
  print(table.unpack(data))
16-
  if data[1] ~= nil then
16+
  if data[1] ~= nil then
17-
    if data[6] == "craft" then
17+
    if data[6] == "craft" then
18-
      print(data[6])
18+
      print(data[6])
19-
      craft.craft()
19+
      craft.craft()
20-
      robot.drop()
20+
      robot.drop()
21-
    elseif data[6] == "clear" then
21+
    elseif data[6] == "clear" then
22-
      for i =1, 9, 1 do
22+
      for i =1, 9, 1 do
23-
        local slot = i + math.floor((i - 1) / 3)
23+
        local slot = i + math.floor((i - 1) / 3)
24-
        robot.select(slot)
24+
        robot.select(slot)
25-
        robot.drop()
25+
        robot.drop()
26-
      end
26+
      end
27-
      robot.select(8)
27+
      robot.select(8)
28-
      robot.drop()
28+
      robot.drop()
29-
    end
29+
    end
30-
  end
30+
  end
31
end