Posted 02 February 2014 - 08:41 AM
Hi there.
I was asked for help with how to extract items by name from an AE network, using OpenPeripherals.
There is already the extractItem method for AE, but this uses the ID…
so as an answer - and to explain the theory fully to myself - i wrote this utility program
http://pastebin.com/bZCCz6ww
assuming you pastebin get it to extractItems then the usage is
extractItems Name [Qty] [Fuzzy]
… where the name is the name of the item, qty is an optional quantity, and fuzzy is true/false dependent on whether you wish for something like "Stone" to match just stone, or also match other Stone named things.
e.g.
extractItems Stone
will extract 1 stone into the turtle
and
extractItems Wool 2 true
will extract 2 of each colour of wool.
installation:
pastebin get bZCCz6ww extractItems
setup - change the two lines in the setup section
local AESide = "left"
local turtleDirection = "south"
to reflect the side the AE Controller/Terminal is to the turtle, and the direction the turtle is to the AE Controller/Terminal
don't know if it's any use to anyone else, but there you go :)/>
i haven't done much debugging at all as I just knocked it up to try out the theory, so any injury or death from using this utility is entirely at your own risk… but probably unlikely.
P.S. this is the first piece of code i've ever released, like ever, outside of work, and the first piece of code i've ever released in my 6 months of coding in lua/CC, so feel free to comment as to its layout and format and any noob lua errors i've made…
I was asked for help with how to extract items by name from an AE network, using OpenPeripherals.
There is already the extractItem method for AE, but this uses the ID…
so as an answer - and to explain the theory fully to myself - i wrote this utility program
http://pastebin.com/bZCCz6ww
assuming you pastebin get it to extractItems then the usage is
extractItems Name [Qty] [Fuzzy]
… where the name is the name of the item, qty is an optional quantity, and fuzzy is true/false dependent on whether you wish for something like "Stone" to match just stone, or also match other Stone named things.
e.g.
extractItems Stone
will extract 1 stone into the turtle
and
extractItems Wool 2 true
will extract 2 of each colour of wool.
installation:
pastebin get bZCCz6ww extractItems
setup - change the two lines in the setup section
local AESide = "left"
local turtleDirection = "south"
to reflect the side the AE Controller/Terminal is to the turtle, and the direction the turtle is to the AE Controller/Terminal
don't know if it's any use to anyone else, but there you go :)/>
i haven't done much debugging at all as I just knocked it up to try out the theory, so any injury or death from using this utility is entirely at your own risk… but probably unlikely.
P.S. this is the first piece of code i've ever released, like ever, outside of work, and the first piece of code i've ever released in my 6 months of coding in lua/CC, so feel free to comment as to its layout and format and any noob lua errors i've made…
Edited on 02 February 2014 - 07:47 AM