4 posts
Posted 30 January 2013 - 04:49 PM
Title: ccSensors and EU storage
I've just recently started working with computercraft and I'm starting to get the hang of Lua coding I think. There's one piece of information I can't find anywhere. Most of the info I've found on ccSensors involving EU storage devices like the MFSU are either about getting a reading from the machine, which I've done, or displaying information on a monitor, which I don't need. I've looked at example codes for displaying specific info to a monitor but it's hard to pick out the command or syntax format that I need.
Ok, so what I'm trying to do is, I just want to know how to store my MFSU's EU level in a variable to use in a very simple code to turn off and on a power-sucking machine automatically. Getting the EU into the code is the one step I'm missing, and can't seem to find any info on how to grab it for my code.
2088 posts
Location
South Africa
Posted 30 January 2013 - 11:29 PM
7508 posts
Location
Australia
Posted 30 January 2013 - 11:33 PM
And in addition to what remiX said, take a look at the code examples from that link. mainly the first one, yes it deals with displaying the power levels on a screen, BUT you must know the power levels before displaying them… if you need any further assistance after reading that tutorial, just ask.
4 posts
Posted 31 January 2013 - 09:53 AM
Thanks guys for replying. I did search extensively on this forum and google, but I never came across that post. I don't really know how to search effectively either way. Ok, so there's some key info in that post that I needed, namely that I had to use sensors.blah instead of ccSensors.blah. So now I'm on the right track, and not getting error messages with every command. Using the codes provided to get the names of Targets, probes, isn't working. Maybe I'm not using them right. The command that I've arrived at as the one I think I need after reading the post and digging around a little more is
sensors.getReadingAsDict(side, sensor, target, probe)
Side and sensor are easy enough, being the side the Sensor Controller is on, (in my case, "right"), and sensor being the name of the sensor, (I've named it "EUSensor"). I just couldn't get any useful info with lua script. Right-clicking the sensor itself, I'm guessing "EUStorage" is the name of the probe I need but I'm not sure, and I'm completely lost on what target is. Right clicking on the sensor again and selecting the EUStorage thing gives me 3 targets, but the names are long and run off the screen.
So that's where I am at the moment. Am I going in the right direction or am I just not getting it at all?
Edit: Oh, and if it helps, I didn't mention this before. I believe I'm using version 1.4 of computercraft with the Technic pack recommended build.
4 posts
Posted 02 February 2013 - 02:38 PM
bump. (is 48 hours long enough for a bump?)
2088 posts
Location
South Africa
Posted 03 February 2013 - 12:23 AM
The code provided in the tutorial was made and tested in Tekkit 1.2.5. I believe you're using Tekkit Lite? I'm not sure if it makes any difference, though… Could you show me the code you're using?
4 posts
Posted 03 February 2013 - 06:26 AM
I've been trying this code and variations of it in the lua prompt. Haven't actually started writing a code yet, just want to know if I'm on the right track. Also, I'm not using a Tekkit build, I'm using Technic recommended. Tekkit is for multiplayer, right? Multiplayer would be nice, but with this ISP holding a bit of a monopoly in my area, I can ONLY play single-player due to excessive throttling. Also, I just learned that I can place a lever on my MFSU and it will fill up and then only use surplus power, which may explain why there isn't much info about this, otherwise I would think a simple power-management program would be in high demand.