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

Sudo42

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by Sudo42

  1. For anyone who is interested, the below code solves the previously unsolved problem. Current versions of OpenComputers add the .store method on ME controllers, allowing the storing of item information in a database for use with the export bus. In-world configuration has an adapter touching an export bus and an ME controller, and has a database upgrade in the adapter.

     

    This code solves the problem of exporting one of each item, which I found of particular interest due to Thaumcraft's fancy new scan-everything-in-a-chest feature...

     

    https://pastebin.com/wQJNJkej

     

    --Required API's
    local component = require "component"
    local serialization = require "serialization"
    local sides = require "sides"
     
    --adapter is connected to an ME controller, and export bus.
    local me = component.me_controller
    --export bus is has a redstone card set so it doesn't auto-export
    local bus = component.me_exportbus
     
    --adapter has an database upgrade
    local db = component.database
     
    --Loop over items in the me network
    for key,item in ipairs(me.getItemsInNetwork()) do
     
      --print out each item for debugging; serializing to see the entire data table
      print(item.name.." :: "..serialization.serialize(me.getItemsInNetwork(item)))
     
      --Use the item as a filter to find an item in the me network, and store its
      --itemstack data into the database
      me.store(item,db.address,1,1)
     
      --configure the export bus to export that item
      bus.setExportConfiguration(sides.left,1,db.address,1)
     
      --trigger an export
      bus.exportIntoSlot(sides.left,1)
     
      --clear out the database entry. Might not be needed...
      db.clear(1)
    end

     

     

    Hopefully this is helpful.

×
×
  • Create New...

Important Information

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