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

CC EU Storage

Started by xTheChosen0ne, 17 June 2015 - 03:44 PM
xTheChosen0ne #1
Posted 17 June 2015 - 05:44 PM
Hey guys, i use TekkitLite. At first, sorry for my bad english, i am german :D/>

I have the following problem: I want to make a program, which allows me to see how much EU is in a MFE actually. I used CCSensors, and tried to make it alone, but i just can't find a method to read the Power Level.

I want, that the MFE stops giving out Energy when it has less then 10000 EU.




Thank you
Greetz
Dustmuz #2
Posted 17 June 2015 - 05:51 PM
im using openperipherals (MC 17.10)

i just wrap my MFE with a modem (thats how i do it)
and then i can do something like this


local MFE = peripheral.wrap(name of MFE)

while true do
  local ener = MFE.getEnergyStored()
  if ener <= 10000 then
   "something"
  else
   "something else"
  end
  sleep(1)
end

xTheChosen0ne #3
Posted 18 June 2015 - 01:08 PM
im using openperipherals (MC 17.10)

i just wrap my MFE with a modem (thats how i do it)
and then i can do something like this


local MFE = peripheral.wrap(name of MFE)

while true do
  local ener = MFE.getEnergyStored()
  if ener <= 10000 then
   "something"
  else
   "something else"
  end
  sleep(1)
end


Thank you. This dont works for me, maybe i misunderstands something. I can't find the variable peripheral.getEnergyStored() in the CCwiki.
Please help.
xTheChosen0ne #4
Posted 18 June 2015 - 02:14 PM
I think i know the problem. "mfe.getEnergyStored()" and "mfe.getEUCapacity" for example, don't works.
It always says "attempt to index ? (a nil value)". I don't know why. And yes, i did "mfe=peripheral.wrap("SIDE")" before.
But i dont know, why it is like that.
Dustmuz #5
Posted 18 June 2015 - 03:13 PM
you need to wrap your peripheral

mfe.getEnergyStored("side") would always return nil.. as "side" isnt where your MFE is..

the program i made was only to show you how to do it..
you would still need to know where your MFE is..
lets make another example..

your computer is right next to the MFE.. (left side of the computer, is where the MFE is)


local MFE = peripheral.wrap("left")

while true do
  local ener = MFE.getEUStored()
  if ener <= 10000 then
   print("less than 10K")
  else
   print("more than 10K")
  end
  sleep(1)
end


this code should work (did for me on my test setup)
xTheChosen0ne #6
Posted 18 June 2015 - 08:01 PM
you need to wrap your peripheral

mfe.getEnergyStored("side") would always return nil.. as "side" isnt where your MFE is..

the program i made was only to show you how to do it..
you would still need to know where your MFE is..
lets make another example..

your computer is right next to the MFE.. (left side of the computer, is where the MFE is)


local MFE = peripheral.wrap("left")

while true do
  local ener = MFE.getEUStored()
  if ener <= 10000 then
   print("less than 10K")
  else
   print("more than 10K")
  end
  sleep(1)
end


this code should work (did for me on my test setup)

Thank you, my problem is solved. The problem is, MFE is no peripheral. I placed a sensor, and it works now.