This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
anonymous2983742's profile picture

[OpenPeripheral] ME Interface Extract

Started by anonymous2983742, 13 March 2014 - 04:52 PM
anonymous2983742 #1
Posted 13 March 2014 - 05:52 PM
Hello everyone,
I want to extract an item from a ME Interface, but not using the Export Config. I have looked up the ME Interface Functions (http://pastebin.com/D1WtHk40), and i want to know if the function extractItem(stack,direction) the right thing is, and how to give it a correct stack (arg 1). So I have tried that one in lua and it tells me that i'm giving it the wrong data representing stack.

Thanks for any help :)/>
CometWolf #2
Posted 13 March 2014 - 08:17 PM
The stack has to be a table with some item related keyes, they escape me at the moment, but i belive it's something like

stack = {
  id = itemID,
  qty = amountYouWant,
}
Use the included openP program docs, found in the openP folder on your cc computer to find out more.
Edited on 13 March 2014 - 07:18 PM
theoriginalbit #3
Posted 13 March 2014 - 11:38 PM
Yeah CometWolf you're correct.

bare minimum

local itemStack = {
  id = 3;
  qty = 64;
}

if you're pulling an item that has a damage/meta value

local itemStack = {
  id = 3;
  dmg = 2;
  qty = 64;
}
anonymous2983742 #4
Posted 14 March 2014 - 05:15 PM
Thanks! That was exactly what I was looking for :)/> Thanks.
Damaged #5
Posted 01 April 2014 - 02:11 PM
Yeah CometWolf you're correct. bare minimum
 local itemStack = { id = 3; qty = 64; } 
if you're pulling an item that has a damage/meta value
 local itemStack = { id = 3; dmg = 2; qty = 64; } 

How exactly would I put in a meta requirement that is a sub-array. For example I want to grab stacks of drones (id 13340) where the beeData.isAnalyzed == false.

I have tried a few ways and none of them seem to work…


local itemStack = {
   id = 13340;
   qty = 64;
   beeData.isAnalyzed = false;
}

And


local itemStack = {
   id = 13340;
   qty = 64;
   beeData = {
	  isAnalyzed = false;
   };
}

Don't seem to work.
CometWolf #6
Posted 01 April 2014 - 04:07 PM
Lol yeah meta ids don't work that way. I don't have any experience with bees, but try mousing over them and looking at the id. If they're not different, the computer can't tell them apart either. The meta id is the numbers after the ":"
Edited on 01 April 2014 - 02:07 PM
Damaged #7
Posted 01 April 2014 - 11:35 PM
Sadly they are all the same ID and all have no damage value. Only the beeData seems to be different between them.

Hrmm, this is going to complicate things for my 'automatic bee analysing' computer.

Two examples (JSON formatted data) of different bees…


{
"beeInfo": {
  "canSpawn": false,
  "displayName": "Refined",
  "generation": -1,
  "hasEffect": true,
  "health": 45,
  "ident": "extrabees.species.fuel",
  "isAlive": true,
  "isAnalyzed": false,
  "isIrregularMating": false,
  "isNatural": true,
  "isSecret": true,
  "maxHealth": 45,
  "type": "bee"
},
"dmg": 0,
"ench": [],
"id": 13340,
"maxSize": 64,
"name": "Refinedbees.drone.adj.add bees.drone",
"qty": 3,
"rawName": "item.beedronege"
},

Is an unanalysed bee.


{
"beeInfo": {
  "active": {
   "caveDwelling": true,
   "effect": "None",
   "fertility": 3,
   "flowerProvider": "Flowers",
   "flowering": 5,
   "humidityTolerance": "None",
   "lifespan": 10,
   "nocturnal": false,
   "species": "Esoteric",
   "speed": 0.3,
   "temperatureTolerance": "None",
   "territory": [9,
   6,
   9],
   "tolerantFlyer": false
  },
  "canSpawn": false,
  "displayName": "Esoteric",
  "generation": -1,
  "hasEffect": false,
  "health": 10,
  "ident": "magicbees.speciesEsoteric",
  "inactive": {
   "caveDwelling": true,
   "effect": "None",
   "fertility": 3,
   "flowerProvider": "Flowers",
   "flowering": 5,
   "humidityTolerance": "None",
   "lifespan": 10,
   "nocturnal": false,
   "species": "Esoteric",
   "speed": 1.2,
   "temperatureTolerance": "None",
   "territory": [9,
   6,
   9],
   "tolerantFlyer": false
  },
  "isAlive": true,
  "isAnalyzed": true,
  "isIrregularMating": false,
  "isNatural": true,
  "isSecret": true,
  "maxHealth": 10,
  "type": "bee"
},
"dmg": 0,
"ench": [],
"id": 13340,
"maxSize": 64,
"name": "Esotericbees.drone.adj.add bees.drone",
"qty": 1,
"rawName": "item.beedronege"
}

Is a fully analysed bee.

Apart from the beeData, I can't see any way to differentiate the two based on an itemStack.
theoriginalbit #8
Posted 02 April 2014 - 01:15 AM
As CometWolf said, unless the damage value (metadata) changes when they're analysed or not, the computer won't be able to tell the difference.
Damaged #9
Posted 02 April 2014 - 05:21 AM
Heh, I guess pull all the bees of one species out, toss back the ones that have been scanned already, then scan what is left. Shame though, would be a very nice feature if I could just loop through grabbing exactly what I need.

Btw, I posted in here since this post already talked about such, my issue is dealt with for now. Thank you.