10 posts
Posted 06 January 2015 - 12:24 AM
Hello!
i'm trying to use direwolf20 reactor control program.
[Lua] reactor - Pastebin.com(Dire's button api for making the program work.
http://pastebin.com/wuUbEdgY )
But i'm in tekkit 1.6.4 v1.2.9f and i have to use energycells for energy storage.
As i readed here energycells use the same call .getEnergyStored and .getMacEnergyStored for getting the stored energy ammount.
But i tried simply changing the peripheral name but it didn't work.
Can someone help me to get this working?
Thanks in advance. :)/>
here's the function that checks the stored ammount of energy:
function checkEn()
local tempEnergy = 0
energyStored = p.getEnergyStored()
energyMax = p.getMaxEnergyStored()
energyStoredPercent = math.floor((energyStored/energyMax)*100)
RFProduction = r.getEnergyProducedLastTick()
fuelUse = r.getFuelConsumedLastTick()
fuelUse = math.floor(fuelUse*100)
fuelUse = fuelUse/100
coreTemp = r.getFuelTemperature()
reactorOnline = r.getActive()
tempEnergy = p.getEnergyStored()
sleep(0.1)
energy = (p.getEnergyStored()-tempEnergy)/2
end
209 posts
Location
Denmark
Posted 06 January 2015 - 05:43 AM
what kind of error are you getting when running the program?
1080 posts
Location
In the Matrix
Posted 07 January 2015 - 09:01 PM
Use this to find what methods can be used with the energy cells.
--#For cells connected to the computer
for a,v in pairs(rs.getSides()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
--#For cells connected by modem
local modem = "modemside" --Change to side of modem
for a,v in pairs(modem.getNamesRemote()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
Edited on 07 January 2015 - 08:01 PM
92 posts
Posted 08 January 2015 - 12:24 AM
I'm currently watching a stream with Fireball1725 and Direwolf20, direwolf has said that his code is buggy.
I presume he will make a better release later.
so, just hold on.
He also said that he releases each version of his code under a different pastebin URL.
10 posts
Posted 08 January 2015 - 03:51 PM
Ok thanks guys
Use this to find what methods can be used with the energy cells.
--#For cells connected to the computer
for a,v in pairs(rs.getSides()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
--#For cells connected by modem
local modem = "modemside" --Change to side of modem
for a,v in pairs(modem.getNamesRemote()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
also the first code doesn't print anything it just closes
1080 posts
Location
In the Matrix
Posted 08 January 2015 - 08:39 PM
Ok thanks guys
Use this to find what methods can be used with the energy cells.
--#For cells connected to the computer
for a,v in pairs(rs.getSides()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
--#For cells connected by modem
local modem = "modemside" --Change to side of modem
for a,v in pairs(modem.getNamesRemote()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
also the first code doesn't print anything it just closes
Did you not read the comment? If the energy cell is not connected to the side of the computer, it's not going to do anything, for the second one, what did it print out?
7083 posts
Location
Tasmania (AU)
Posted 08 January 2015 - 10:28 PM
Use this to find what methods can be used with the energy cells.
Psst, why not use
peripheral.getNames(), and have the code throw an error if it fails to find the desired peripheral?
It wouldn't surprise me if the block can't even be used as a peripheral in that mod cocktail. Dunno.
10 posts
Posted 09 January 2015 - 06:44 PM
Ok thanks guys
Use this to find what methods can be used with the energy cells.
--#For cells connected to the computer
for a,v in pairs(rs.getSides()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
--#For cells connected by modem
local modem = "modemside" --Change to side of modem
for a,v in pairs(modem.getNamesRemote()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
also the first code doesn't print anything it just closes
Did you not read the comment? If the energy cell is not connected to the side of the computer, it's not going to do anything, for the second one, what did it print out?
output of the program modem : test:2 attempt to call nil (yes i changed the side to "up")
so i suppose that this version of thermal doesn't
1080 posts
Location
In the Matrix
Posted 09 January 2015 - 07:39 PM
–snip–
output of the program modem : test:2 attempt to call nil (yes i changed the side to "up")
so i suppose that this version of thermal doesn't
That's an error with my code, let me actually find the part instead of trying to remember.
EDIT: DERP forgot to actually wrap the damn thing, use this code:
local modemside = "modemside" --Change to side of modem
local modem = peripheral.wrap(modemside)
for a,v in pairs(modem.getNamesRemote()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
Edited on 09 January 2015 - 06:41 PM
8543 posts
Posted 09 January 2015 - 07:59 PM
Well, "up" isn't a valid side, but "top" is.
10 posts
Posted 09 January 2015 - 10:29 PM
–snip–
output of the program modem : test:2 attempt to call nil (yes i changed the side to "up")
so i suppose that this version of thermal doesn't
That's an error with my code, let me actually find the part instead of trying to remember.
EDIT: DERP forgot to actually wrap the damn thing, use this code:
local modemside = "modemside" --Change to side of modem
local modem = peripheral.wrap(modemside)
for a,v in pairs(modem.getNamesRemote()) do
if peripheral.isPresent(v) and peripheral.getType(v) == "cofhenergycell" then
print(textutils.tabulate(peripheral.getMethods(v)))
end
end
Well, "up" isn't a valid side, but "top" is.
ok so fixed the side using top and i changed the peripheal variable with cofh_thermalexpansion_energycell (i don't know if changing this did help)
and i figured out that the energycell uses the same method as the capacitor does
but now it prompt a new error : reactor :145 Parameter slot is missing.
Edited on 09 January 2015 - 09:53 PM
1080 posts
Location
In the Matrix
Posted 10 January 2015 - 12:19 AM
From what i can see, you're calling p.getEnergyStored and i'm not sure if it needs a parameter.
Change line 145 and 146 from this:
energyStored = p.getEnergyStored()
energyMax = p.getMaxEnergyStored()
to this:
energyStored = p.getEnergyStored("unknown")
energyMax = p.getMaxEnergyStored("unknown")
10 posts
Posted 12 January 2015 - 02:13 PM
OK it worked thanks ! :)/> OK so i made this fix you can check it out here:
function checkEn()
local tempEnergy = 0
energyStored = p.getEnergyStored("unknown")
energyMax = p.getMaxEnergyStored("unknown")
energyStoredPercent = math.floor((energyStored/energyMax)*100)
RFProduction = r.getEnergyProducedLastTick()
fuelUse = r.getFuelConsumedLastTick()
fuelUse = math.floor(fuelUse*100)
fuelUse = fuelUse/100
coreTemp = r.getFuelTemperature()
reactorOnline = r.getActive()
tempEnergy = p.getEnergyStored("unknown")
sleep(0.1)
energy = (p.getEnergyStored("unknown")-tempEnergy)/2
end
For applying this fix simply change the original check en function to make ut look like i posted above:
And again thanks for helping me :)/>