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

MFSU Monitor

Started by distantcam, 29 November 2013 - 09:25 AM
distantcam #1
Posted 29 November 2013 - 10:25 AM
MFSU Monitor

MFSU Monitor is a simple program to display the current energy level of an MFSU attached to a computer. Pastebin Tr8rWtUV

pastebin get Tr8rWtUV mfsumon

Screenshot
[attachment=1408:2013-12-11_20.59.37.png]

Setup
Simply connect an MFSU to a computer using cables, and then connect a monitor. MFSU Monitor will automatically detect the connections for you.

MFSU Monitor requires OpenPeripherals and of course IndustrialCraft.
Edited on 11 December 2013 - 06:52 AM
Cozzimoto #2
Posted 29 November 2013 - 03:23 PM
suggestion: since this program requires OpenPeripheral to run you might go a step ahead and make a HUD display with some terminal glasses, maybe make an easy way to monitor several at the same time
distantcam #3
Posted 29 November 2013 - 07:37 PM
That wasn't what I needed it for. I just wanted a simple display over the MFSU connected to my transporter to see if it has any juice in it. I tend to hide my MFSU behind walls so it's difficult to click on.
GetParanoid #4
Posted 09 December 2013 - 07:26 PM
All I'm getting is "Cannont find MSFU attacted to this computer"
distantcam #5
Posted 09 December 2013 - 11:05 PM
All I'm getting is "Cannont find MSFU attacted to this computer"
Make sure the MSFU is attached to the computer with cables, and that the attachment is connected (right click the attachment point to turn it red).
GetParanoid #6
Posted 10 December 2013 - 03:50 PM
Yeah, it's all hooked up and attached right. Still isn't working
distantcam #7
Posted 10 December 2013 - 05:55 PM
Could you please run the following code on the computer you're having trouble with, and post the result here.

for _,name in pairs(peripheral.getNames()) do
  print(name.." "..peripheral.getType(name))
end
GetParanoid #8
Posted 10 December 2013 - 06:27 PM
Upon running this code I got


top ic2_blockcable
back monitor
right modem
batbox_2 batbox
distantcam #9
Posted 10 December 2013 - 09:44 PM
Is the MFSU connected to the top of the computer? It should be connected using ComputerCraft peripheral cables, not IndustrialCraft power cables.

Could you include a screenshot of your setup too please?
Edited on 10 December 2013 - 08:45 PM
GetParanoid #10
Posted 11 December 2013 - 12:39 AM
The MFSU is connected to the right of the computer with network cable
Here's the picture of my setup(It's kinda messy, but it's the top computer.):

Edited on 10 December 2013 - 11:40 PM
Landstryder #11
Posted 11 December 2013 - 03:17 AM
what versions of MC,CC and OP are you using? cuz it looks like maybe your computer is seeing the MFSU as a batbox……
GetParanoid #12
Posted 11 December 2013 - 03:22 AM
what versions of MC,CC and OP are you using? cuz it looks like maybe your computer is seeing the MFSU as a batbox……

No idea. I'm playing FTB Unleashed v1.1.3

And that's exactly what it is doing. It registers it was a batbox instead of a MFSU
oeed #13
Posted 11 December 2013 - 05:14 AM
I love the display you've made. It's small, simple and elegant. Kudos.

I haven't got IC2 installed so can't really test it, but does it increase the text scale as for bigger screens?
distantcam #14
Posted 11 December 2013 - 07:16 AM
@GetParanoid I've fixed it to now work with the various versions of things (IC2, OpenPeripherals) from FTB Unleashed. Redownload it and try again please.

@oeed Thanks for the kudos! No it doesn't increase the text scale automatically. I might build that in, but I'm not sure if it's needed.
Letherin #15
Posted 22 December 2013 - 06:59 PM
I'm just getting…
powermon:33: attempt to call nil

I have a modem connected to the batbox just fine, I can LUA wrap it.
distantcam #16
Posted 22 December 2013 - 08:23 PM
@Letherin what version of computercraft, openperipherals, and industrialcraft are you using?
theoriginalbit #17
Posted 22 December 2013 - 09:08 PM
what version of […] openperipherals
you should make it compatible with all versions, it's not difficult.
Edited on 22 December 2013 - 08:08 PM
distantcam #18
Posted 22 December 2013 - 09:13 PM
It's a little difficult if the API keeps changing. :P/>

But I do understand what you mean and will make the change.
theoriginalbit #19
Posted 22 December 2013 - 09:31 PM
It's a little difficult if the API keeps changing. :P/>
it has changed once, and in an effort to make it easier to understand what the methods do
distantcam #20
Posted 23 December 2013 - 01:04 AM
Well then that's odd because I've covered the old API case, and the current API case, so there must be a 3rd situation which means the API has changed at least twice.

That includes string type that an MFSU returns, and the method name. :/
Alice #21
Posted 23 December 2013 - 01:07 AM
This seems like a cool program; I might try this out soon :D/>
theoriginalbit #22
Posted 23 December 2013 - 01:23 AM
Well then that's odd because I've covered the old API case, and the current API case, so there must be a 3rd situation which means the API has changed at least twice.
uhhh, no you haven't.
Letherin #23
Posted 23 December 2013 - 02:30 AM
Something weird going on, I am on an FTB server (direwolf20 - 1.0.7) for 1.6.4 - latest version which came out last week - I'd imagine it's not using a version of OpenP that's too cutting edge given the 1.6.4 nature of it though.

I also tried my own program (first one, given) Monitor here:
http://www.computerc...my-way-through/

This is giving me the same issue.
Edited on 23 December 2013 - 01:31 AM
distantcam #24
Posted 23 December 2013 - 02:50 AM
Well then that's odd because I've covered the old API case, and the current API case, so there must be a 3rd situation which means the API has changed at least twice.
uhhh, no you haven't.

Let's see.

OpenPeripherals 0.2.1 preview 8 (the current one)
- peripheral.getType(side) == "mfsu"
- methods are 'getEUCapacity' and 'getEUStored'

OpenPeripherals 0.1.9 (the one in FTB unleashed)
- peripheral.getType(side) == "batbox"
- methods are 'getCapacity' and getStored'

So what did I miss?

Edit: Based on Letherin's comments on the other thread there's another configuration.

OpenPeripherals ?.?.?
- peripheral.getType(side) == "batbox"
- methods are 'getEUCapacity' and 'getEUStored'

That looks like at least 2 changes to me.
Edited on 23 December 2013 - 02:00 AM
theoriginalbit #25
Posted 23 December 2013 - 07:08 AM
OpenPeripherals 0.2.1 preview 8 (the current one)
- peripheral.getType(side) == "mfsu"
- methods are 'getEUCapacity' and 'getEUStored'

OpenPeripherals 0.1.9 (the one in FTB unleashed)
- peripheral.getType(side) == "batbox"
- methods are 'getCapacity' and getStored'

So what did I miss?

Edit: Based on Letherin's comments on the other thread there's another configuration.

OpenPeripherals ?.?.?
- peripheral.getType(side) == "batbox"
- methods are 'getEUCapacity' and 'getEUStored'

That looks like at least 2 changes to me.
You do realise that IC2 has both a batbox AND mfsu's, meaning there are cases where your code will crap out and fail hard, for example wrapping an mfsu in the new OpenPeripheral and attempting to call the old function. Also going by your logic there's 4 configurations, batbox/mfsu in new openp and batbox/mfsu with old openp, but what you're failing to realise is that those groupings the methods are the same.

Something better: http://pastebin.com/e4UunD5K
Edited on 23 December 2013 - 06:21 AM
distantcam #26
Posted 23 December 2013 - 07:32 AM
Nope, I didn't fail to realise that, that was exactly what I knew I had to do. I assume when you mean the API changed only once you're referring to the method names, but I would also consider the block type changing from batbox to MFSU part of the API too.
theoriginalbit #27
Posted 23 December 2013 - 07:41 AM
Nope, I didn't fail to realise that, that was exactly what I knew I had to do. I assume when you mean the API changed only once you're referring to the method names, but I would also consider the block type changing from batbox to MFSU part of the API too.
Method names is all we changed, anything else that changes is not us. also there is still batbot and mfsu in the old ones, just not in Unleashed, unleashed broke something with IC2 iirc.
Edited on 23 December 2013 - 06:41 AM
Letherin #28
Posted 23 December 2013 - 05:02 PM
I didn't actually get this to work, however I am trying to use some of the code in my own program - I'm using that findperipheral function in my own program successfully. However, I use more than 1 batbox.

Can the function be called by a for loop on an array of all the bat boxes on the network ? I notice your program only seems to recognise one power storage device also. So the reason I ask here is that anyone using your program might also benefit from it.

Could you give an example ?

The LUA.org site was somewhat confusing for me, some of the terminology being different to what I'm used to when explaining programming concepts (of any kind).
Edited on 23 December 2013 - 06:11 PM