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

[v3.1.0] Computed Magic (TT[kami] support now! Support for higher OpenPeripheral version!)

Started by GamerNebulae, 24 May 2014 - 01:26 PM
GamerNebulae #1
Posted 24 May 2014 - 03:26 PM
Ever wanted to do infusion magic from Thaumcraft 4 and don't always want to refill your jars afterwards? Why not automate it and let CC do it for you?! This program automatically refills your jars after you're done and it's intended to be used with mana beans. Also, it's recommended to use a buffer (like a Chest) so the computer can request all the mana beans it needs to refill all the jars.

How to setup:
Step 1) Place a computer and type the following snippet into the computer:

pastebin get 0biGRPNS <program title>

Step 2) Hook up the following peripherals to a Modem or through a Peripheral Proxy and connect them with Networking cable. Be sure to activate the modems:
- Request Pipe (Both Mk1 and Mk2 are working!);
- Chest (Support for BetterStorage, ThaumCraft and Iron Chests);
- Jars (Can be any given number! You don't need all the 51 different jars.);
- Computer.
Picture: http://imgur.com/M2ciOYi

Step 3) Run the program and change the sleep in the while-loop according to your setup.

If you have problems with the program, I integrated a sort of debug mode, type this in your computer:

<program title> troubleshoot

Picture of the ideal setup for feeding mana beans to the alchemical furnace: http://imgur.com/OzICftE
Get the code here: http://pastebin.com/0biGRPNS

Dependencies:
- OpenPeripherals (tested in v0.13).
- LogisticsPipes (tested in v0.7.4 dev 125).

Suggestions:

Upcoming:
Support for monitors with my new API!

Graphical update for Computers (Added to upcoming list on June 6th, 2014)!

TT[kami] support (Added to upcoming list on June 6th, 2014)!
Done on June 10th, 2014

Changelog:
v1.1 (26th May 2014)
- Removed a bug with the computer not being able to fully fill a jar;
- Removed a useless table;
- Made the computer check if the Alchemical Furnace is empty. No buffer needed anymore!
v2.0 (27th May 2014)
- Changed the way mana beans are requested;
- Complete revision of the code.
v2.1.1 (10th June 2014)
- Improved structure of the code;
- Made a beginning with integration for my API.
v2.1.2 (10th June 2014)
- Added support for higher OpenPeripherals version (Massive thanks to FlagHacker for helping!!!).
v2.1.3 (12th June 2014)
- Unified the code I made with Flaghacker.
v2.1.4 (16th June 2014)
- Fixed a small bug.
v3.0.0 (21st June 2014) Codename: Ocelot
- Fixed a huge issue with previous code where it would just keep requesting beans over and over;
- Compacted code by approximately 70 lines;
- Only 2 tables are needed to store all the variables;
- Split the old functions into much smaller, easier to work with, functions.
v3.1.0 (22nd June 2014) Codename: Ocelot
- Unified version again (Forgot to add that in the v3.0.0, derp.)

Bugs:
- Empty jars in this version of OpenPeripherals cannot be read.
- Cannot request items in Openperipherals v0.3.3

Any bugs or suggestions? Please leave a message.
Edited on 22 June 2014 - 02:08 PM
flaghacker #2
Posted 25 May 2014 - 07:46 AM
How do you detect when the golem is done transporting the aspects?
GamerNebulae #3
Posted 25 May 2014 - 10:17 AM
How do you detect when the golem is done transporting the aspects?

I think you mean: "How do you detect if the alembics are empty?" Well, that's one flaw of this program, I don't think you can read information out of the Alembics and that's why you need the buffer. The computer can request all the mana beans, dump them in the chest and don't worry about them.
flaghacker #4
Posted 25 May 2014 - 12:13 PM
How do you detect when the golem is done transporting the aspects?

I think you mean: "How do you detect if the alembics are empty?" Well, that's one flaw of this program, I don't think you can read information out of the Alembics and that's why you need the buffer. The computer can request all the mana beans, dump them in the chest and don't worry about them.

I mean both. What if your golem gets stuck with his derpy pathfinding? What if the alembic isn't done cooking everything after 60 seconds?

The computer will keep requesting more mana beans, until the buffer it's full…

I'll test it this evening, to check if 60 seconds is enough.
Edited on 25 May 2014 - 10:15 AM
GamerNebulae #5
Posted 25 May 2014 - 12:26 PM
How do you detect when the golem is done transporting the aspects?

I think you mean: "How do you detect if the alembics are empty?" Well, that's one flaw of this program, I don't think you can read information out of the Alembics and that's why you need the buffer. The computer can request all the mana beans, dump them in the chest and don't worry about them.

I mean both. What if your golem gets stuck with his derpy pathfinding? What if the alembic isn't done cooking everything after 60 seconds?

The computer will keep requesting more mana beans, until the buffer it's full…

I'll test it this evening, to check if 60 seconds is enough.

That is actually a really good suggestion / thinking on your end… Maybe I'll implement something to check if he's refilling that specific aspect. Bad thinking on my end…
Edited on 25 May 2014 - 03:40 PM
flaghacker #6
Posted 25 May 2014 - 05:05 PM
Maybe you could wait until the request you ordered is competed before doing anything else? And then you would need a security timer, in case the user starts using aspects during a request.

Or you could go with the scanner from openperipherals, to check if the golem is done. Not sure how easy that is thought…
GamerNebulae #7
Posted 25 May 2014 - 05:26 PM
Maybe you could wait until the request you ordered is competed before doing anything else? And then you would need a security timer, in case the user starts using aspects during a request.

Or you could go with the scanner from openperipherals, to check if the golem is done. Not sure how easy that is thought…

I found a solution. You need to hook up the Alchemical Furnace through a Peripheral Proxy to the wired network (or directly put a computer next to it) and then the computer can read information in the Alchemical Furnace and thus you can measure if there are mana beans or if there is fuel in the furnace.

EDIT: Bad idea, didn't work as smooth as I expected

EDIT on the EDIT: I finally have it working, there was a stupid bug in my previous code where I didn't expect myself to have more mana beans then the system would request…
Edited on 25 May 2014 - 04:40 PM
flaghacker #8
Posted 26 May 2014 - 05:45 PM
Maybe you could wait until the request you ordered is competed before doing anything else? And then you would need a security timer, in case the user starts using aspects during a request.

Or you could go with the scanner from openperipherals, to check if the golem is done. Not sure how easy that is thought…

I found a solution. You need to hook up the Alchemical Furnace through a Peripheral Proxy to the wired network (or directly put a computer next to it) and then the computer can read information in the Alchemical Furnace and thus you can measure if there are mana beans or if there is fuel in the furnace.

EDIT: Bad idea, didn't work as smooth as I expected

EDIT on the EDIT: I finally have it working, there was a stupid bug in my previous code where I didn't expect myself to have more mana beans then the system would request…

Very nice… I suppose the golem is still handled with a sleep()? Anyways, very nice script!

EDIT:
Image link broken.
Edited on 26 May 2014 - 03:47 PM
GamerNebulae #9
Posted 26 May 2014 - 06:27 PM
Very nice… I suppose the golem is still handled with a sleep()? Anyways, very nice script!

EDIT:
Image link broken.

Image link isn't broken, for some reason it doesn't copy paste very well, but the image is on imgur.
flaghacker #10
Posted 26 May 2014 - 07:31 PM
Very nice… I suppose the golem is still handled with a sleep()? Anyways, very nice script!

EDIT:
Image link broken.

Image link isn't broken, for some reason it doesn't copy paste very well, but the image is on imgur.

Ah k, when I ctrl+c, ctrl+v it in my browser it works. Clicking on it doesn't works…
Steps to reproduce:

Click on the link
GamerNebulae #11
Posted 27 May 2014 - 09:50 PM
Ah k, when I ctrl+c, ctrl+v it in my browser it works. Clicking on it doesn't works…
Steps to reproduce:

Click on the link

Think I fixed that now and I gave the code a revamp, works different now, so check that out.
flaghacker #12
Posted 28 May 2014 - 06:11 AM
Very nice program, I'll
be using it once I get my mana bean farm running.
Edited on 28 May 2014 - 04:11 AM
MrEmielH #13
Posted 29 May 2014 - 11:06 AM
Very nice indeed :)/>
GamerNebulae #14
Posted 29 May 2014 - 11:39 AM
Very nice indeed :)/>

Thank you, my good chap! :D/>
flaghacker #15
Posted 30 May 2014 - 10:00 PM
Lol, now I think about about it, direwolf20 should be using this instead of his own.
GamerNebulae #16
Posted 30 May 2014 - 11:26 PM
Lol, now I think about about it, direwolf20 should be using this instead of his own.

why? XD

EDIT: Dire is not the best coder in the world. He said that himself. He makes cool stuff, but sometimes it is really user unfriendly.
Edited on 01 June 2014 - 08:02 AM
flaghacker #17
Posted 01 June 2014 - 07:09 PM
Lol, now I think about about it, direwolf20 should be using this instead of his own.

why? XD

EDIT: Dire is not the best coder in the world. He said that himself. He makes cool stuff, but sometimes it is really user unfriendly.

And his one is also NOT automated, you just have to click on the aspect you want and manually select how much of it you want. That's not really useful…
flaghacker #18
Posted 02 June 2014 - 11:18 AM
I have a suggestion. Could you make it so when it detects an empty jar, it automatticly fils it with one of the aspects it doesn't has yet? You would have to make a hardcoded list of aspects in your program… Would be neat if it would be added.

Is this program actually compatible with multiple jars with the same aspect? I'm going to test it tonight. I need it for some of the infusions that require more then 64 of an aspect.
Edited on 02 June 2014 - 09:19 AM
GamerNebulae #19
Posted 02 June 2014 - 02:38 PM
I have a suggestion. Could you make it so when it detects an empty jar, it automatticly fils it with one of the aspects it doesn't has yet? You would have to make a hardcoded list of aspects in your program… Would be neat if it would be added.

Is this program actually compatible with multiple jars with the same aspect? I'm going to test it tonight. I need it for some of the infusions that require more then 64 of an aspect.

I suppose you mean the TTKami stuff. Problem with that is though that I can't be sure what other people's setup is. That was the whole point of this program to make it modular. Are you using a modpack? If you want to chat via Skype, this is my Skype: ivohuntjens
GamerNebulae #20
Posted 12 June 2014 - 10:27 AM
Working on the API right now. It is going to be cool! Here a sneak peek of how it is going to look (this was during the beta testing of my API): http://imgur.com/NnH7Vq9
micmou #21
Posted 13 June 2014 - 07:48 AM
One thing how in your changelog is it July???
GamerNebulae #22
Posted 13 June 2014 - 10:25 AM
-snip-

Derp… I always mess up the months after May.
Naergoth #23
Posted 17 June 2014 - 07:40 PM
when trying to run this script i am getting a error that says refill:71: attempt to index ? (a nil value)
i have the beans stored in JABBA barrels with a AE system hooked to them with the request pipe hooked to Provider pipe which is hooked to a ME Interface.
I am even getting the error when i use refill troubleshoot.
Edited on 18 June 2014 - 01:55 AM
flaghacker #24
Posted 19 June 2014 - 06:22 PM
when trying to run this script i am getting a error that says refill:71: attempt to index ? (a nil value)
i have the beans stored in JABBA barrels with a AE system hooked to them with the request pipe hooked to Provider pipe which is hooked to a ME Interface.
I am even getting the error when i use refill troubleshoot.

Try reinstalling. That line can absolutely not be the issue, as that's just a simple "beak".
If it still doesn't work, post your Thaumcraft, Thaumic tinkerer and openperipherals versions.


Sorry, I was looking at the wrong version of the script.

Try running this and then post the logFile on pastebin.
Edited on 19 June 2014 - 05:22 PM
spoonikle #25
Posted 21 June 2014 - 12:37 AM
I noted that this code requires logistic pipes, the mod pack I am using has no logistic pipes, but I am able to maintain a buffer chest filled with 1 stack of each mana bean.

What parts of the code should I comment out to allow it to run regardless of the amount of mana beans requestable?
howdanrocks #26
Posted 21 June 2014 - 04:33 AM
Is there any way to adapt this to work without logistic pipes?
GamerNebulae #27
Posted 21 June 2014 - 11:53 AM
-snip-

-snip-

I do not know if you can get NBT information through normal CC equipment. I know direwolf20 made a contraption a long time ago that does this. This code is depending on Logistics Pipes to read the NBT data to distinguish each type of mana bean. If you want to see a solution for that, I would just google it or see this video by direwolf20 to see his approach.
godomos #28
Posted 29 August 2014 - 09:08 AM
line 20 attempt to index ? (a nil value). what can i do to fix?