Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- dbcol = colors.black
- dtcol = colors.white
- function mbut(cx,cy,text,bcol,tcol)
- if bcol == nil then
- bcol = dbcol
- end
- if tcol == nil then
- tcol = dtcol
- end
- mon.setCursorPos(cx,cy)
- mon.setBackgroundColor(bcol)
- mon.setTextColor(tcol)
- mon.write(text)
- mon.setBackgroundColor(dbcol)
- mon.setTextColor(dtcol)
- end
- while true do
- machines = peripheral.getNames()
- apis = {}
- mon = {}
- apichest = {}
- chest = {}
- chestAPI = ""
- apichestAPI = ""
- gx = 0
- gy = 0
- for v, k in pairs(machines) do
- if string.find(k,"apiar") ~= nil then
- table.insert(apis,k)
- elseif string.find(k, "monitor") ~= nil then
- mon = peripheral.wrap(k)
- gx,gy = mon.getSize()
- mon.setTextScale(0.5)
- elseif string.find(k, "binniecore") ~= nil then
- apichest = peripheral.wrap(k)
- apichestAPI = k
- elseif string.find(k, "ironchest") ~= nil then
- chest = peripheral.wrap(k)
- chestAPI = k
- end
- end
- if mon == nil then
- error("No Monitor is attached")
- end
- if chest == nil then
- error("No Ironchest (Copper,Iron,Silver,Diamond) is attached")
- end
- if apichest == nil then
- error("No Binniechest is attached")
- end
- if apis == nil then
- error("No Apiarys are attached")
- end
- shell.run("clear")
- dbcol = colors.black
- dtcol = colors.white
- function mbut(cx,cy,text,bcol,tcol)
- if bcol == nil then
- bcol = dbcol
- end
- if tcol == nil then
- tcol = dtcol
- end
- mon.setCursorPos(cx,cy)
- mon.setBackgroundColor(bcol)
- mon.setTextColor(tcol)
- mon.write(text)
- mon.setBackgroundColor(dbcol)
- mon.setTextColor(dtcol)
- end
- while true do
- machines = peripheral.getNames()
- apis = {}
- mon = {}
- apichest = {}
- chest = {}
- chestAPI = ""
- apichestAPI = ""
- gx = 0
- gy = 0
- for v, k in pairs(machines) do
- if string.find(k,"apiar") ~= nil then
- table.insert(apis,k)
- elseif string.find(k, "monitor") ~= nil then
- mon = peripheral.wrap(k)
- gx,gy = mon.getSize()
- mon.setTextScale(0.5)
- elseif string.find(k, "binniecore") ~= nil then
- apichest = peripheral.wrap(k)
- apichestAPI = k
- elseif string.find(k, "ironchest") ~= nil then
- chest = peripheral.wrap(k)
- chestAPI = k
- end
- end
- if mon == nil then
- error("No Monitor is attached")
- end
- if chest == nil then
- error("No Ironchest (Copper,Iron,Silver,Gold,Diamond) is attached ")
- end
- if apichest == nil then
- error("No Binniechest (Copper,Iron,Silver,Gold,Diamond) is attached ")
- end
- if apis == nil then
- error("No Apiarys are attached ")
- end
- x = 2
- y = 2
- mbut(x,y,"Machines:")
- for value, machine in pairs(apis) do
- api = peripheral.wrap(machine)
- api_list = api.list()
- queen = api.getItemMeta(1)
- drone = api.getItemMeta(2)
- slots = {}
- slots[3] = api.getItemMeta(3)
- slots[4] = api.getItemMeta(4)
- slots[5] = api.getItemMeta(5)
- slots[6] = api.getItemMeta(6)
- slots[7] = api.getItemMeta(7)
- slots[8] = api.getItemMeta(8)
- slots[9] = api.getItemMeta(9)
- if queen == nil then
- queen = {}
- queen["displayName"] = "None"
- queen["count"] = 0
- end
- if drone == nil then
- drone = {}
- drone["displayName"] = "None"
- drone["count"] = 0
- end
- y = y + 2
- mbut(2,y," ")
- mbut(2,y,machine)
- y = y + 1
- mbut(2,y," ")
- mbut(2,y,"1: " .. queen.displayName)
- mbut(32,y,"2: " .. drone.displayName)
- for slotID = 3,9,1 do
- mod = slotID % 2
- if mod == 1 then
- x = 2
- y = y + 1
- else
- x = 32
- end
- slots[slotID] = api.getItemMeta(slotID)
- if slots[slotID] == nil then
- slots[slotID] = {}
- slots[slotID]["displayName"] = "None"
- slots[slotID]["count"] = 0
- end
- print(slots[slotID].displayName)
- if string.find(slots[slotID].displayName,"Princess") ~= nil then
- if queen.displayName == "None" then
- api.pullItems("self",slotID,1,1)
- end
- end
- if string.find(slots[slotID].displayName,"Drone") ~= nil then
- if drone.displayName == "None" then
- api.pullItems("self",slotID,1,2)
- else
- for id = 1, 400,1 do
- if apichest.getItemMeta(id) == nil then
- api.pushItems(apichestAPI,slotID,slots[slotID].count,id)
- break
- end
- end
- end
- end
- if string.find(slots[slotID].displayName,"Comb") ~= nil or string.find(slots[slotID].displayName,"Pollen") ~= nil then
- chestlist = chest.list()
- for id,value in pairs(chestlist) do
- if chest.getItemMeta(id).displayName == slots[slotID].displayName then
- api.pushItems(chestAPI,slotID,slots[slotID].count,id)
- break
- elseif chest.getItemMeta(id) == nil then
- api.pushItems(chestAPI,slotID,slots[slotID].count,id)
- break
- end
- end
- end
- mbut(x,y," ")
- mbut(x,y,slotID .. ": " .. slots[slotID].displayName)
- mbut(2,gy," ")
- mbut(2,gy,"Machine: " .. machine .. " Slot: " .. slotID)
- end
- y = y + 1
- sleep(0.5)
- end
- mbut(2,gy," ")
- mbut(gx/2-4,gy,"DONE")
- sleep(0.5)
- end
- x = 2
- y = 2
- mbut(x,y,"Machines:")
- for value, machine in pairs(apis) do
- api = peripheral.wrap(machine)
- api_list = api.list()
- queen = api.getItemMeta(1)
- drone = api.getItemMeta(2)
- slots = {}
- slots[3] = api.getItemMeta(3)
- slots[4] = api.getItemMeta(4)
- slots[5] = api.getItemMeta(5)
- slots[6] = api.getItemMeta(6)
- slots[7] = api.getItemMeta(7)
- slots[8] = api.getItemMeta(8)
- slots[9] = api.getItemMeta(9)
- if queen == nil then
- queen = {}
- queen["displayName"] = "None"
- queen["count"] = 0
- end
- if drone == nil then
- drone = {}
- drone["displayName"] = "None"
- drone["count"] = 0
- end
- y = y + 2
- mbut(2,y," ")
- mbut(2,y,machine)
- y = y + 1
- mbut(2,y," ")
- mbut(2,y,"1: " .. queen.displayName)
- mbut(32,y,"2: " .. drone.displayName)
- for slotID = 3,9,1 do
- mod = slotID % 2
- if mod == 1 then
- x = 2
- y = y + 1
- else
- x = 32
- end
- slots[slotID] = api.getItemMeta(slotID)
- if slots[slotID] == nil then
- slots[slotID] = {}
- slots[slotID]["displayName"] = "None"
- slots[slotID]["count"] = 0
- end
- print(slots[slotID].displayName)
- if string.find(slots[slotID].displayName,"Princess") ~= nil then
- if queen.displayName == "None" then
- api.pullItems("self",slotID,1,1)
- end
- end
- if string.find(slots[slotID].displayName,"Drone") ~= nil then
- if drone.displayName == "None" then
- api.pullItems("self",slotID,1,2)
- else
- for id = 1, 400,1 do
- if apichest.getItemMeta(id) == nil then
- api.pushItems(apichestAPI,slotID,slots[slotID].count,id)
- break
- end
- end
- end
- end
- if string.find(slots[slotID].displayName,"Comb") ~= nil or string.find(slots[slotID].displayName,"Pollen") ~= nil then
- chestlist = chest.list()
- for id,value in pairs(chestlist) do
- if chest.getItemMeta(id).displayName == slots[slotID].displayName then
- api.pushItems(chestAPI,slotID,slots[slotID].count,id)
- break
- elseif chest.getItemMeta(id) == nil then
- api.pushItems(chestAPI,slotID,slots[slotID].count,id)
- break
- end
- end
- end
- mbut(x,y," ")
- mbut(x,y,slotID .. ": " .. slots[slotID].displayName)
- mbut(2,gy," ")
- mbut(2,gy,"Machine: " .. machine .. " Slot: " .. slotID)
- end
- y = y + 1
- sleep(0.5)
- end
- mbut(2,gy," ")
- mbut(gx/2-4,gy,"DONE")
- sleep(0.5)
- end
Add Comment
Please, Sign In to add comment