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

DefragAE - Use Logistics pipes to clear up types in your system!

Started by moomoomoo3O9, 17 January 2015 - 04:00 PM
moomoomoo3O9 #1
Posted 17 January 2015 - 05:00 PM
I had the idea for a long time to clean up my AE system of all of the items that had less than a stack of items of that type, because AE's storage cells are designed for bulk. I expanded upon this concept, and allowed for stack size, itemID, mod name, unlocalized name, and metadata to be filtered.

What this program does is use an attached request pipe to request all item types with the specifications you provide. What you do with them from there is up to you. (Put them in an LP system with chests, throw them in a trash can, feed it to a hungry node, the possibilities are limitless!)

To use it, simply connect a Provider Logistics pipe to an ME Interface, and a Request Logistics Pipe to the Provider, and put your computer adjacent to it or connect it via network cables. (Note: Depending on the pack you're using, you may need a Logistics Power Junction and some power as well!)

This program will search your entire AE system once every 60 seconds by default at 10 items per tick. It can write to any and all attached monitors and to the console of the computer itself with a countdown of when the next search is and how many items it pulled out last search.

I also wrote an extra program which writes to a file the unlocalized names, IDs, mod names, and metadata of each item in your LP system.

Download or Pastebin ID: 3yXj834B

Old versions:
1.2 - http://pastebin.com/HzM8ugpG
1.1 - I didn't save the DL, just use 1.2 or 1.0 :P/>
1.0 - http://pastebin.com/6uD25aLB

If you have any questions on how the LP Integration with computercraft works, feel free to PM me, as it's a bit cryptic.

Screenshot (It's not visually appealing, I know, and before anyone asks, my Resource Pack is a custom flavor of Dokucraft, which I could send if asked via PM)


Changelog:
1.3: Added wildcard support to some functions inside program, made the countdown and search functions run in parallel.
1.2: Added ID:Meta support on the ID Filter, added wildcard support for the findPeripheral() function, updated getInfo() to automatically find a logistics pipe.
1.1: Added support to filter based on ID, name, mod name, and meta.
1.0: Initial release, available in old versions, simplest, cleanest version without extra filtering features.
Edited on 27 January 2015 - 01:21 AM
Geforce Fan #2
Posted 17 January 2015 - 07:09 PM
why not 1k?
AE is meant to be your only storage system
Edited on 17 January 2015 - 06:10 PM
moomoomoo3O9 #3
Posted 17 January 2015 - 08:27 PM
why not 1k?
AE is meant to be your only storage system
Yeah, it shouldn't be hardcoded to be 64. I just changed that.

An example of how I would use this is using provider pipes from logistics pipes or using storage busses from AE and putting the items in a chest which can hold many types of items, but not in as large of quantities.
Geforce Fan #4
Posted 18 January 2015 - 03:36 AM
why not 1k storage cells is what I'm saying
they're cheap and still have 63 types, perfect for >65
TrovadorUrbano #5
Posted 23 January 2015 - 10:05 PM
Noob question, are you on MC 1.6.4?
moomoomoo3O9 #6
Posted 25 January 2015 - 03:53 AM
Noob question, are you on MC 1.6.4?
No, I was on 1.7.10 when I wrote this. Does it not work in 1.6.4? I can load up TPPI and see if I can get it working if it isn't.

Also, the logistics pipes setup for getting items from AE has not changed from AE1 to AE2, the integration is the same. The only thing that might have changed is the method to get the item count of something using LP's CC integration.


It worked fine in TPPI :)/>
Edited on 25 January 2015 - 03:09 AM
moomoomoo3O9 #7
Posted 26 January 2015 - 02:34 AM
Update - It now supports black/whitelists for Item ID, unlocalized names, mod names, and metadata.
The variables currently look as follows:
sleepTime=60 --In seconds. Default is 60.
itemsPerTick=10 --How many items it should search per tick. Default is 10.
checkCount=true --Should it check the amount of items?
itemThreshold=64 --The max amount of items it can have and still be requested. Default is 64.
writeToConsole=true --Should it write to the computer itself?
writeToMonitor=true --Should it write to connected monitors?
nameWhitelist=false --Should it filter based on a whitelist or a blacklist?
nameList={} --Unlocalized name(s) of filtered items.
idWhitelist=false --Should it filter based on a whitelist or a blacklist?
idList={}
modWhitelist=false --Should it filter based on a whitelist or a blacklist?
modList={}
checkMeta=false --Should it look at metadata?
metaPercentThreshold=50 --Items below this percentage will be pulled out if checkMeta is true.
I also wrote an extra program to get all of this information and write it to a file like so:
ID: 542
Unlocalized Name: Copper Ore
Mod Name: IC2
Meta: 0/0
Count: 50251
Edited on 26 January 2015 - 01:34 AM
moomoomoo3O9 #8
Posted 26 January 2015 - 11:15 PM
Updated to 1.2. From the changelog: Added ID:Meta support on the ID Filter, added wildcard support for the findPeripheral() function, updated getInfo() to automatically find a logistics pipe.

Edit: Updated 1.3. From the changelog: Added wildcard support to some functions inside program, made the countdown and search functions run in parallel.
Edited on 27 January 2015 - 01:18 AM
jaspercayne #9
Posted 23 May 2015 - 04:17 PM
I hate to be that guy, but I really cannot seem to get this running. If I just pastebin and run I get a nil error at line 25, if I make some edits to the variables, I still get the same. Any chance of a little more instruction on the actual usage of this amazing looking program?
moomoomoo3O9 #10
Posted 24 May 2015 - 06:37 PM
I hate to be that guy, but I really cannot seem to get this running. If I just pastebin and run I get a nil error at line 25, if I make some edits to the variables, I still get the same. Any chance of a little more instruction on the actual usage of this amazing looking program?
Sure. (jeez, I have not touched this code in a long time…)
I just updated the program because I had a few scope errors in there that caused the bug you ran into. (and a couple after that…)
This video should explain how to use the program. My apologies for the excessive jump cutting, I ramble on too much.