Jump to content




Power Monitor Program. works with any mods power storage

utility lua computer

19 replies to this topic

#1 0_mr_redstone_0

  • Members
  • 4 posts

Posted 25 June 2014 - 12:55 AM

Power Monitor Program
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

CHANGELOG:
March 21, 2017 - Fixed mekanism compatibility. added positive/negative change in stored energy. Modified how the currently stored energy is displayed
(may look into Zetta Industries mod compatibility)



I made a small computer program for advanced computers that tells you your power levels for energy cells(TE3), mfe,mfsu,batbox(ic2), enderIO capacitor banks and mekanism energy cubes.

-note: currently only works with single EnderIO capacitors . doesnt work with the EnderIO multiblock

Posted Image

the program could work with any block that stores energy

To use the code just type: pastebin get 9b6m3ym1 install.lua in the terminal. note: must be advanced computer and advanced monitors!

then just run install.lua in the console. the installer will run and download the program for you

[Lua] Power Monitor Installer V:30 - Pastebin.com

[Lua] Power Monitor setup V:30 - Pastebin.com (note: you dont need to pastebin get this one. it is done automatically with the installation program)

[Lua] Power Monitor Program V:30 - Pastebin.com (note: you dont need to pastebin get this one. it is done automatically with the installation program)


Pictures Of Terminal
Spoiler

this is a basic setup.
Spoiler
Here is the Code (for those to lazy to click the pastebin link
Spoiler

More Info

using side name such as "top" and "back" in the name input doesn't currently works perfectly. DO NOT USE THE QUOTES!

All peripherals should automatically connect, because of this make sure to only have one of each peripheral connected to the same network, otherwise the program will use the first one it finds and skip the rest.

Feel free to ask questions of needed. or just leave any suggestions for the code. :)/>

EDIT: Fixed Images
EDIT 2: Added more documentation
EDIT 13: applied major update
EDIT 15: Added full color support
EDIT 17: Updated spoiler with new code, fixed some documentation

Edited by 0_mr_redstone_0, 21 March 2017 - 08:10 PM.


#2 nickname912

  • Members
  • 13 posts

Posted 13 July 2014 - 09:51 AM

Nice program. I have for a long time want a program like yours.




#3 Sir_Mr_Bman

  • Members
  • 62 posts

Posted 13 July 2014 - 10:58 AM

I like it!

It's a small amount of code to get a simple job done.

IT's not too flexible, but it works for what it is supposed to work for.

// offtopic: what texture pack is that

#4 0_mr_redstone_0

  • Members
  • 4 posts

Posted 06 August 2014 - 12:59 AM

Texture pack is Soartex Fanver w/ all mod textures available

any recommendations for added flexibility? besides different screen sizes(been looking into it)
possibly customizable colors? would put that config into an option advanced setup

#5 MinecraftM0b

  • Members
  • 5 posts

Posted 17 August 2014 - 08:59 AM

I have an idea. I wrote for MobGui (little shell of mine) a program called Energy. I basicly read all peripherals of thy mfsu and put enegry amount on the terminal glasses from open peripherals. I made it so you can save an alias for a storage device.
Heres the program : https://ccmob.net/packages/energy.msx

Btw, i made a little gui api. Maybe it can help by way of creating simple and shorter code.

PS: MobGui is found here if you are interested : https://ccmob.net/

#6 xLife

  • Members
  • 7 posts
  • LocationGermany

Posted 09 May 2015 - 10:34 PM

Looks neat!

Just wanted to tell you, that you can clear an complete line with mon.clearLine() (It clears the line the Cursor is on). If you want to make the complete screen white just use:
mon.setBackgroundColor(colors.white)
mon.clear()
Clearing a line or the whole monitor is the same as overwriting it with blank spaces. That means the background will also change to the current background color.

And for your Loading Bar Code I would suggest an for-loop (http://lua.lickert.n...p/index_en.html):
 for i = 8, 9 do --# For each loop it counts 1 up until it hits nine and then breaks. For the first run i = 8, for the second run i = 9
   mon.setCursorPos(2,i)
   mon.setBackgroundColour(colors.gray)
   mon.write(string.rep(" ",34))
   mon.setCursorPos(2,i)
   mon.setBackgroundColour(colors.lime)
   mon.write(string.rep(" ",bar))
end 

I would also suggest using the sleep-funtion in your infinite loop, to reduce lag:
 while true do
   --#Code and stuff
   sleep(1) --#Will pause the program for 1 second
end 

I hope that i helped you a little bit.

Edited by xLife, 09 May 2015 - 10:37 PM.


#7 stene.m

  • Members
  • 8 posts

Posted 10 May 2015 - 09:15 PM

Hi

Know this is an old thread, but hope someone can help...

when I run the code I get up

"power: 53: attempt to index? (a nill value)"

Any idea how I can fix it

Edited by stene.m, 10 May 2015 - 09:19 PM.


#8 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 10 May 2015 - 09:19 PM

View Poststene.m, on 10 May 2015 - 09:15 PM, said:

Hi

Know this is an old thread, but hope someone can help...

when I run the code I get up

"power: 53: attempt two index? (a nill value)"

Any idea how I can fix it

you in putted the name of the monitor incorrectly

#9 stene.m

  • Members
  • 8 posts

Posted 10 May 2015 - 09:30 PM

Hi

Thanks :)/> the fixation that part, when I finally found out what the name of the monitor was ...

But ... now I get
"power: 88: attempt to index? (a nill value)"

And yes, i have, (in my case a BatBox), on top of the computer as the code says
maxE = cube.getMaxEnergyStored("top")

Edited by stene.m, 10 May 2015 - 09:32 PM.


#10 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 10 May 2015 - 09:33 PM

View Poststene.m, on 10 May 2015 - 09:30 PM, said:

Hi

Thanks :)/> the fixation that part, when I finally found out what the name of the monitor was ...

But ... now I get
"power: 88: attempt to index? (a nill value)"

And yes, i have, (in my case a BatBox), on top of the computer as the code says
maxE = cube.getMaxEnergyStored("top")

same issue again, this time with the energy storage device

Edited by Lupus590, 10 May 2015 - 09:40 PM.


#11 stene.m

  • Members
  • 8 posts

Posted 10 May 2015 - 09:42 PM

Hi

I guessed it was the same mistake, but I wrote BatBox since that's what I use .... see photos ...
it's another name I should use or...



Posted Image

Posted Image

#12 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 10 May 2015 - 09:59 PM

View Poststene.m, on 10 May 2015 - 09:42 PM, said:

Hi

I guessed it was the same mistake, but I wrote BatBox since that's what I use .... see photos ...
it's another name I should use or...

-screen shots snip-


the name like thing is for wired connections only, in your case, the "name" should be "top" without " "

To the OP, this is something you may want to clarify in documentation or something

#13 stene.m

  • Members
  • 8 posts

Posted 10 May 2015 - 10:09 PM

Hmmmm

Tried to use "top" (without " ") but got this error message:
 power:88: attempt to call nil 

Just thought I'd mention it ... not the same error message as before ;-)
Posted Image

#14 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 10 May 2015 - 10:24 PM

View Poststene.m, on 10 May 2015 - 10:09 PM, said:

Hmmmm

Tried to use "top" (without " ") but got this error message:
 power:88: attempt to call nil 

Just thought I'd mention it ... not the same error message as before ;-)

-I was a screen shot, then I got snipped-


this script may not be compatible with IC2 batboxes, the OP screen shot is some other energy storing thing
just re read the OP, must be open peripherals or somewhere in the setup you need to tell it the storage device

if you don't have open peripherals, then install that and try again, otherwise find another script/edit this one

Edited by Lupus590, 10 May 2015 - 10:26 PM.


#15 stene.m

  • Members
  • 8 posts

Posted 10 May 2015 - 10:48 PM

As far as I can see the code "out of the box" and if u use the proper "top", "back", "left", "right" as name,
works only with Thermal Expansion ... because I tried with a Leadstone Energy Cell (TE) and then it worked just fine....

Edited by stene.m, 10 May 2015 - 10:48 PM.


#16 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 10 May 2015 - 10:50 PM

View Poststene.m, on 10 May 2015 - 10:48 PM, said:

As far as I can see the code "out of the box" and if u use the proper "top", "back", "left", "right" as name,
works only with Thermal Expansion ... because I tried with a Leadstone Energy Cell (TE) and then it worked just fine....

The OP may not have tested their program against IC2 energy storage.

#17 hyper1on

  • New Members
  • 1 posts

Posted 04 July 2015 - 03:36 AM

This looks like a great program, but I cannot get it to function. I get this error:
Posted Image

The line of code it is referencing is :
percent = math.floor((rawPer*100)+0.5)

I have the computer sittin on top of an EnderIO capacitor bank (Two capacitors).

Is this an outdated command?
Computercraft 1.73
openperipheral 1.7.10-AIO-4

Thanks for any suggestions =)

edit: I removed one of the enderio capacitors, so it is a single capacitor only and I get the same error.

Edited by hyper1on, 04 July 2015 - 03:15 PM.


#18 Vxnom

  • New Members
  • 1 posts

Posted 29 October 2016 - 04:29 AM

I know this post is from almost two years ago, but I would like to request for someone to help me.
I'm attempting to make a power monitor for a mod called Zetta Industries only problem I'm having is, your program is not compatible.
I like the interface you've created here, I would just like to have compatibility for Zetta's batteries.
They are multiblocks, and have a computer access port just like Big Reactors.

Thanks

//Vxnom

#19 MarcosGrod

  • New Members
  • 1 posts

Posted 28 January 2017 - 01:53 PM

"program.lua:216: attempt to call nil"

How can i fix this?

#20 0_mr_redstone_0

  • Members
  • 4 posts

Posted 17 February 2017 - 05:19 PM

View PostMarcosGrod, on 28 January 2017 - 01:53 PM, said:

"program.lua:216: attempt to call nil"

How can i fix this?


what version of mekanism are you using?

this program was written with 1.7.10 mods in use


mekanism may have changed the way computer craft calls its current energy stored

I'll see what I can do to push a fix


if you want to do it yourself. you can find out what function is used to get the current energy stored in a mekanism cube




View PostVxnom, on 29 October 2016 - 04:29 AM, said:

I know this post is from almost two years ago, but I would like to request for someone to help me.
I'm attempting to make a power monitor for a mod called Zetta Industries only problem I'm having is, your program is not compatible.
I like the interface you've created here, I would just like to have compatibility for Zetta's batteries.
They are multiblocks, and have a computer access port just like Big Reactors.

Thanks

//Vxnom

read through the code. on my pastebin it is labeled as power monitor program v:20
you can find the function that detects which mods battery you are using
add in the correct functions for detecting Zetta industries

if you don't know how to do this,
I'm gonna parse through my code and see if I can fix a couple things this weekend (Feb 18th, 2017)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users