Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
meigrafd

AE2: Exporting damaged Items

Question

Hi.

 

Im searching for a methode to export damaged items from an AE2 Network. The Items have different damage values..

 

 

My situation:

 

I have several Nuclear Reactor's which gets controlled by Robots. The Robot's sometimes drops not fully used Uranium Rods back into my AE2 Network to prevent explosion..

Im using a Quantum Network Bridge over 2 dimensions and have no ME_Controller where i want to export the damaged Items, so im using following Setup:

 

- Adapter connected to a Computer.

- ME_Interface placed on Adapter and connected to my AE2 Network.

- right-clicked an Database-Upgrade in my hand and added an already used " IC2:reactorUraniumQuad " item. After that i put the Database into the Adapter.

- ME_ExportBus connected with Adapter and placed a Chest in front of it.

 

Now i have tried the following Code:

 

local component = require('component')
local side = require('sides')
local meExportBus = component.getPrimary('me_exportbus')
local meInterfaceBus = component.getPrimary('me_interface')
local db = component.database

local exportBusSide
for i = 0, 5 do
    if select(2, meExportBus.getConfiguration(i)) ~= "no export bus" then
        exportBusSide = i
        break
    end
end

local entryNum = {}
for i = 1, 81 do
    local item = db.get(i)
    if item then
        entryNum[item.name] = i
    end
end

local itemList = meInterfaceBus.getAvailableItems()
 
for k,v in pairs(itemList) do
    for key,value in pairs(v.fingerprint) do
        if (key == "dmg") and (value >= 10) then
            print("Exporting ".. v.fingerprint.id .." with dmg: "..value)
            meExportBus.setConfiguration(exportBusSide, 1, db.address, entryNum[v.fingerprint.id])
            meExportBus.exportIntoSlot(exportBusSide, 1)
        end
    end
end
 

 

My Problem is now that this doesnt work :( It outputs the print line but it doesnt export any Item

 

What am i doing wrong?

Thanks!

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi there

 

Do the damaged item in the database and the damaged item in the ME Network have the same damage value?

 

Since component.me_exportbus.exportIntoSlot needs an entry from a Database Upgrade, the only solution I see right now is to put every possible damage value in the database, though I'm not sure if you can do that since I don't know IC2 :(

Link to post
Share on other sites
  • 0

Do the damaged item in the database and the damaged item in the ME Network have the same damage value?

No. As i sayd: The Items have different damage values..

 

Since component.me_exportbus.exportIntoSlot needs an entry from a Database Upgrade, the only solution I see right now is to put every possible damage value in the database, though I'm not sure if you can do that since I don't know IC2 :(

Well i can only add max. 81 entries to a Database but i have much more items with different damage values in my ME System (Uranium Rods are stackable but i have ~100 single stacks in the ME Network)

The only idea i had was something with the inventory_controller or geolyzer but i dont know if the ME_Network can get handled like an Inventory? didnt tested that yet..

I need a way to add something to Database without extra peripheral.. something where i can directly access the Database and store/erase entries.... Does anyone know such methode?

Link to post
Share on other sites
  • 0

I've coded a simple methode with ComputerCraft to export all Items with a damage value of >= 6 : http://pastebin.com/NbC59sfW

 

--[[

 For: ComputerCraft

 If the Nuclear Reactor overheats the Robot drops not only depleted Uran Rods into the Trash...
 If your using Applied Energistics (like me) for Supporting the Robot you will have much used Rods after some Days
 which will blow you storages... 
 And here comes this Script in place:
 Extract all used Uran Rods from AE System and split them into a Chest. This Chest can than be linked to another AE or whatever..
 
 Setup:
 - Place an ME_Interface_Block to a Computer.
 - Connect the ME_Interface with your AE Network and to another side of the ME_Interface place a Chest.

--]]


-- Direction from ME_Interface to Chest. Only valid: north, south, west, east, up, down
directionChest = "NORTH"

-- Side of ME_Interface. Only valid sides: left, right, back, front, up, bottom
meInterfaceSide = "back"

-- Export all Items with a minimum or equal damage value of ...
local minDamage = 6

local CheckEvery = 15  -- sec.


--[[ Internal values - DONT change! ]]


local meInterface = peripheral.wrap(meInterfaceSide)

local version = 0.1
local Count = 0

function exportDamagedItems()
    for number,item in pairs(itemList) do
        local ID = item.fingerprint.id
        local DMG = item.fingerprint.dmg
        if (DMG >= minDamage) then
            Count = Count + 1
            meInterface.exportItem(item.fingerprint, directionChest, 1, 0)
            print("("..Count..") Exported "..ID.." with dmg: "..DMG)
        end
    end
end



---[[ Main Program ]]


-- FIXME: only export if enough space in chest is free

while true do
    itemList = meInterface.getAvailableItems()
    exportDamagedItems()
    os.sleep(CheckEvery)
end


--
-- EOF
--

 

But with OpenComputers i still not have a working way :(

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.