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

AE2 Pure Certus, Quartz, or Fluix Grower

Started by ariqbailey, 23 August 2014 - 10:36 PM
ariqbailey #1
Posted 24 August 2014 - 12:36 AM
This is a simple program I made (it is my first program so I am sorry if it could be done better), and it does exactly what it needs to.

It is a simple program designed to grow Pure Certus Crystals, Pure Nether Quartz Crystals, and Pure Fluix Crystals from AE2 (Applied Energistics 2).

Materials: 1 of any turtle, 1 chest, and a water bucket, also 1 of each type of crystal (the ones stated above).

To set it up all you have to do is put a turtle above a water block, and above the turtle put the output chest:

Spoiler

Of, course, you could always add vibration chambers, but make sure the me cables aren't on the sides of the turtle, because the dropped items seem to derp out if the cables are on the sides.

You can use this setup with vibration chambers:

Spoiler
[/spoiler]

Now, you want to go into the turtle and get this pastebin: qLqff7D4
Or just type in: pastebin get qLqff7D4 certus.

Now you need to open up the turtle, and in the 14th, 15th, and 16th slot you have to put (not in this order necessarily) a piece of Pure Certus Quartz Crystal, a piece of Pure Nether Quartz Crystal, and a Piece of Pure Fluix Crystal.

These serve as what the turtle uses to check if the crystals you are growing are done. Keep in mind if you don't plan on using one of these 3, or don't plan on using 2 of them you don't have to put them in the turtle.

Spoiler
[/spoiler]

Also,
You could make the program run all the time by editing startup and typing:

while true do
shell.run(certus)
end

And that should be about all, so all you have to do now is put the seeds in any other slot inside the turtles inventory, and run certus.

When the seeds are done growing, they will be put in the chest above, would could be any inventory, I suppose.

Thanks for using my program, or even just reading this, it means a lot to me.

-Ari
Edited on 24 August 2014 - 10:47 AM
DolbsB #2
Posted 02 November 2014 - 03:56 PM
Ari,

Thank you for this - saves a ton of time. I'm a total newbie to ComputerCraft but was able to modify the code slightly to add the crafting of Fluix Crystals. I have a ME Interface on the left-side (doesn't seem to interfere yet) and a import bus attached to the chest.



The code modification uses slot 13 for the Fluix Crystal



Of course I've assigned the proper crafting recipes to the ME Interface and tested. The pastebin code is

http://pastebin.com/3RuHuhNk

3RuHuhNk

Last note for those using NEI (who doesn't?). Make sure you TURN OFF magnet mode!
Edited on 05 November 2014 - 12:50 AM
koniv00 #3
Posted 27 November 2014 - 09:57 PM
Hope you dont mind, but i thought i could add to this.

I've taken it one step further, and added an automatic on/off switch for the growth accelerators.

Just add something to the back of the turtle that can relay a redstone signal to a toggle switch
and connect it to said toggle switch. It should automatically turn the accelerators on if there's
work to do.

Hope you like it :)/>

http://pastebin.com/PfTXrnMm
Dog #4
Posted 28 November 2014 - 03:27 AM
I really enjoy when small projects like this become community add-on projects :)/>

I cleaned up the code, fixed an error with the newly added fluix crystal select/compare/drop (it was including slot 13 in select/compare/drop which is the slot for the fluix comparison crystal), and localized the variables.

This also includes koniv00's redstone output.

http://pastebin.com/BsE342Z6
Edited on 28 November 2014 - 02:29 AM
koniv00 #5
Posted 28 November 2014 - 05:36 AM
I cleaned up the code, fixed an error with the newly added fluix crystal select/compare/drop (it was including slot 13 in select/compare/drop which is the slot for the fluix comparison crystal), and localized the variables.

Yeah, realized that later as well, apparently trying to code lua for the first time late at night is a recipe for errors… :P/>/>

There are two other issues with the code as well i haven't been able to get working yet:
  1. the "workToDo" variable will never get set back to false after the first time work has been done.
  2. the CheckWorkStatus needs to be inside the if statement in the main, otherwise it will allways execute it, even when not needed
I am off to work for now, will continue working on this when i get home.
Edited on 28 November 2014 - 05:38 AM
Dog #6
Posted 28 November 2014 - 07:03 AM
I fixed the workToDo issue, significantly reduced the code in the CheckWorkStatus() function, and moved the CheckWorkStatus() call inside the if statement.

http://pastebin.com/BsE342Z6
Edited on 28 November 2014 - 06:09 AM
koniv00 #7
Posted 28 November 2014 - 08:10 AM
Wow, you are much better at this then I am, good Sir! Cant wait to try it when i get home.

I am wondering though, your solution to the problems is basically the same as i was trying, but for
me the turtle somehow stopped cycling through the inventory slots after i made these changes.
The only difference i can see is that i had the extra os.sleep outside the if statement.

If you wouldn't mind, could you elaborate a bit why you put it inside it?
I'm eager to learn and especially understand more about how LUA works.

Thanks.
Dog #8
Posted 28 November 2014 - 04:41 PM
Without seeing your code I couldn't tell you why your attempt didn't work. The reason I put the sleep statement inside the if statement is because the program is either going to do one action or the other (if/else); and it should sleep after either action (but at different intervals). I'd ask you to post your code, but we've kind of hijacked ariqbaily's thread and should probably wait to hear back from ariqbaily as to whether these additions/changes are even desired.
koniv00 #9
Posted 28 November 2014 - 05:24 PM
You are absolutely correct, but the post DolbsB made got me thinking about optimising it even further. I've managed to strip it down to
one turtle and a single ME interface with the final code:

http://imgur.com/QU921cl

PS: This is what i managed to cobble together after i got home from work. Still need to clean it up a bit.
PPS: apparently i'm not just a noob at LUA, but also at embedding images. Will fix it after i figure it out.
Edited on 28 November 2014 - 04:27 PM
Simon_Bitdiddle #10
Posted 18 December 2014 - 08:19 AM
I made few changes to Dog's code, namely using

while turtle.suckDown() do
end

to pull up everything instead of only one type of item.

It's kinda ugly but it works and gets rid of an edge case where the seed gathered by the suckDown isn't complete but the other ones are but are still dangling in the soup.

If there's a less ugly way to do it, I'm more than happy to hear it.

Also, moved the Iteration status output out of the loop so it prints cleaner.
Edited on 18 December 2014 - 07:41 AM
Anora #11
Posted 01 April 2020 - 11:32 PM
this is an old script could use a clean up and update as it has problems in 1.12.2.

having a problem were it will stop processing what it got if one of the crystals is fully grown
Edited on 02 April 2020 - 11:41 PM
Anora #12
Posted 09 April 2020 - 02:27 PM
I figured what needs to be fixed in this script it needs to pick up all crystals underneath, then compare if work still needs to be done drop those that are not completed and put the ones done in chest