Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- debug = false
- while true do
- machines = peripheral.getNames()
- slotmin = 2
- slotmax = 50*8
- default = ""
- common = ""
- industrial = ""
- imperial = ""
- emerald = ""
- unsorted= ""
- for v, k in pairs(machines) do
- machine = peripheral.wrap(k)
- if string.find(k,"tile_machine") ~= nil then
- if machine.getItemMeta(1) ~= nil then
- if machine.getItemMeta(1).displayName == "Default" then
- print("Default = " .. k)
- default = machine
- default_api = k
- end
- if machine.getItemMeta(1).displayName == "Common" then
- print("Common = " .. k )
- common = machine
- common_api = k
- end
- if machine.getItemMeta(1).displayName == "Industrial" then
- print("Industrial = " .. k)
- industrial = machine
- industrial_api = k
- end
- if machine.getItemMeta(1).displayName == "Imperial" then
- print("Imperial = " .. k)
- imperial = machine
- imperial_api = k
- end
- if machine.getItemMeta(1).displayName == "Emerald" then
- print("Emerald = " .. k)
- emerald = machine
- emerald_api = k
- end
- if machine.getItemMeta(1).displayName == "Unsorted" then
- print("Unsorted = " .. k)
- unsorted = machine
- unsorted_api = k
- end
- end
- end
- end
- if default ~= "" and common ~= "" and industrial ~= "" and imperial ~= "" and emerald ~= "" and unsorted ~= "" then
- print("All Storages are setup")
- print("Go through the Inventorys:")
- for v, k in pairs(machines) do
- if string.find(k, "tile_machine") ~= nil then
- print("Machine " .. k .. " will be checked")
- machine = peripheral.wrap(k)
- for slot = 1, slotmax,1 do
- if machine.getItemMeta(slot) ~= nil then
- print(k .. " slot " .. slot .. ": " .. machine.getItemMeta(slot).displayName)
- item = machine.getItemMeta(slot)
- if string.find(item.displayName,"Forest") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Meadows") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Rocky") ~= nil then
- if string.find(item.displayName,"Comb") == nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- end
- if string.find(item.displayName,"Common") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Cultivated") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Diligent") ~= nil then
- for sortitem = 2,slotmax,1 do
- if industrial.getItemMeta(sortitem) == nil then
- print("Freeslot in industrial: " .. sortitem)
- machine.pushItems(industrial_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Unweary") ~= nil then
- for sortitem = 2,slotmax,1 do
- if industrial.getItemMeta(sortitem) == nil then
- print("Freeslot in Industrial: " .. sortitem)
- machine.pushItems(industrial_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Noble") ~= nil then
- for sortitem = 2,slotmax,1 do
- if imperial.getItemMeta(sortitem) == nil then
- print("Freeslot in Imperial: " .. sortitem)
- machine.pushItems(imperial_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Imperial") ~= nil then
- for sortitem = 2,slotmax,1 do
- if imperial.getItemMeta(sortitem) == nil then
- print("Freeslot in imperial: " .. sortitem)
- machine.pushItems(imperial_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Majestic") ~= nil then
- for sortitem = 2,slotmax,1 do
- if imperial.getItemMeta(sortitem) == nil then
- print("Freeslot in Imperial: " .. sortitem)
- machine.pushItems(imperial_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Industrious") ~= nil then
- for sortitem = 2,slotmax,1 do
- if industrial.getItemMeta(sortitem) == nil then
- print("Freeslot in Industrial: " .. sortitem)
- machine.pushItems(industrial_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName," Comb") ~= nil then
- for sortitem = 2,slotmax,1 do
- if default.getItemMeta(sortitem) == nil then
- print("Freeslot in default: " .. sortitem)
- machine.pushItems(default_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Pollen") ~= nil then
- for sortitem = 2,slotmax,1 do
- if default.getItemMeta(sortitem) == nil then
- print("Freeslot in default: " .. sortitem)
- machine.pushItems(default_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Royal") ~= nil then
- for sortitem = 2,slotmax,1 do
- if default.getItemMeta(sortitem) == nil then
- print("Freeslot in default: " .. sortitem)
- machine.pushItems(default_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Tolerant") ~= nil then
- for sortitem = 2,slotmax,1 do
- if emerald.getItemMeta(sortitem) == nil then
- print("Freeslot in Emerald: " .. sortitem)
- machine.pushItems(emerald_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Resilent") ~= nil then
- for sortitem = 2,slotmax,1 do
- if emerald.getItemMeta(sortitem) == nil then
- print("Freeslot in Emerald: " .. sortitem)
- machine.pushItems(emerald_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Emerald") ~= nil then
- for sortitem = 2,slotmax,1 do
- if emerald.getItemMeta(sortitem) == nil then
- print("Freeslot in Emerald: " .. sortitem)
- machine.pushItems(emerald_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Lapis") ~= nil then
- for sortitem = 2,slotmax,1 do
- if emerald.getItemMeta(sortitem) == nil then
- print("Freeslot in Emerald: " .. sortitem)
- machine.pushItems(emerald_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Ruby") ~= nil then
- for sortitem = 2,slotmax,1 do
- if emerald.getItemMeta(sortitem) == nil then
- print("Freeslot in Emerald: " .. sortitem)
- machine.pushItems(emerald_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Tolerant") ~= nil then
- for sortitem = 2,slotmax,1 do
- if emerald.getItemMeta(sortitem) == nil then
- print("Freeslot in Emerald: " .. sortitem)
- machine.pushItems(emerald_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Marshy") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Tropical") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Wintry") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Water") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Marbled") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if string.find(item.displayName,"Embittered") ~= nil then
- for sortitem = 2,slotmax,1 do
- if common.getItemMeta(sortitem) == nil then
- print("Freeslot in Common: " .. sortitem)
- machine.pushItems(common_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- if item.displayName ~= nil and item.displayName ~= "Default" and item.displayName ~= "Common" and item.displayName ~= "Industrial" and item.displayName ~= "Imperial" and item.displayName ~= "Emerald" and item.displayName ~= "Unsorted" then
- for sortitem = 2,slotmax,1 do
- if unsorted.getItemMeta(sortitem) == nil then
- print("Freeslot in Unsorted: " .. sortitem)
- machine.pushItems(unsorted_api,slot,item.amount,slotitem)
- break
- end
- end
- end
- else
- if debug then
- print("Nothing in " .. k .. " slot: " .. slot)
- end
- end
- end
- end
- end
- print("Done")
- else
- print("Missing Machines")
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment