Posted 22 April 2014 - 02:36 AM
Hey guys,
today i wrote a script for controling the a reactor build with big reactors mod.
The reactor can be wraped as peripheral.
So i wrote a script for keepig it at a difined temperature.
But after 6 cycles in the loop it fails an gives the error "unabled to create new native thread".
Would be great if someone knows already a simple bugfix or so…
I know this version is outdated, but FTB modpacks aren't updated that fast.
I appended the script under this post, found no way to attach it as file, sorry.
NG from Germany
Dr. Console
today i wrote a script for controling the a reactor build with big reactors mod.
The reactor can be wraped as peripheral.
So i wrote a script for keepig it at a difined temperature.
But after 6 cycles in the loop it fails an gives the error "unabled to create new native thread".
Would be great if someone knows already a simple bugfix or so…
I know this version is outdated, but FTB modpacks aren't updated that fast.
I appended the script under this post, found no way to attach it as file, sorry.
NG from Germany
Dr. Console
local reac
local fheat
local hheat
local nrOfRods
local active = false
local emergency = false
local timeover = true
local depthOfRods
local timer
local event
local ID
reac = peripheral.wrap("back")
nrOfRods = reac.getNumberOfControlRods()
controlRods(100)
function controlRods(amount)
local i = 0
if not emergency then
begin
for i=0, nrOfRods do
reac.setControlRodLevel(i,amount)
end
end
function setActive(val)
if (reac.getActive() ~= val) and (emergency == false) then
reac.setActive(val)
return reac.getActive()
end
function emergencyAutomatic()
if (fheat > 2200) then
begin
print("Emergency shutdown! Fuel heat over 2200°C")
controlRods(100)
emergency = true
end
if (emergency == true) and (fheat == 0) then
begin
emergency = false
end
end
function heatControl()
if timeover then
begin
if (fheat<=1000) and (hheat<1500) then
begin
controlRods((depthOfRods – 5))
print("Info: Decreasing depth of rods by 5%")
timer = os.startTimer(10)
end
if (fheat<2000) and (fheat>1000) and (hheat<1500) then
begin
controlRods((depthOfRods – 1))
print("Info: Decreasing depth of rods by 1%")
timer = os.startTimer(5)
end
if (fheat>2050) or (hheat>1600) then
begin
controlRods((depthOfRods + 10))
timer = os.startTimer(5)
print("WARNING: Fuel heat over 2050°C or casing heat over 1600°C , Encreasing depth of rods by 10%")
end
timeover = false
end
end
function timerFinished()
if (ID == timer) then
timeover = true
end
end
function main()
fheat = reac.getFuelTemperature()
hheat = reac.getCasingTemperature()
depthOfRods = reac.getControlRodLevel(1)
active = rs.getInput("right")
emergencyAutomatic()
setActive(active)
heatControl()
end
function timerEvent()
event,ID = os.pullEvent("timer")
end
while true do
local func = parallel.waitForAny(main, timerEvent)
if (func == 2) then
begin
timerFinished()
end
end