Jump to content




Fuzzy AE Turtle extractor [requires OP and AE]

turtle peripheral utility

4 replies to this topic

#1 ingie

  • Members
  • 69 posts
  • LocationMannin

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...

Edited by ingie, 02 February 2014 - 08:47 AM.


#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 February 2014 - 09:27 AM

Looks good for your "first" program :) and of course I say first here jokingly :P

one suggestion I'll make is to do an auto search for the AE network. take a look at a snippet I made a while back — it's fairly similar to the new peripheral.find function found in the prerelease of CC 1.6

#3 ingie

  • Members
  • 69 posts
  • LocationMannin

Posted 02 February 2014 - 09:35 AM

thanks... aye, not my first first, but my first where i thought/was confident enough to think "i may as well release it" :)

indeed, it's something i considered, but since i can't programmatically determine the direction for the AE to extract to [the north,south etc], it seemed extra code for the sake of typing into code you'd need to edit in all situations anyway... my other thought was to make it a parameter, but then things get tricky to interpret too many optionals...

also i was really doing it as an explanation of the AE process more than anything else, so i didn't want to clutter up with too much "cleverness" which was outside that remit

but for my own use, I'll probably add that method as you suggest...

i've not tried any of the betas. i tend to stick to the "already been out there a while" stuff - but i'll look forward to the extra bits...

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 February 2014 - 10:04 AM

fair enough. like I said, it was just a suggestion :) there could be some trickery that you could do with args and loops, but yeah I understand why you did what you did...

#5 ingie

  • Members
  • 69 posts
  • LocationMannin

Posted 02 February 2014 - 10:12 AM

indeed... i wasn't dissing the suggestion at all... just making an excuse ;)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users