Posted 13 November 2014 - 11:08 AM
hello again.. im getting a error i have never encoutered before..
window:248: bad argument: double expected, got nil
the code im using is this
window:248: bad argument: double expected, got nil
the code im using is this
Spoiler
local rea = peripheral.wrap("left")
local mon = peripheral.wrap("top")
local rod = 0
local function rod()
while true do
term.clear()
term.write("power control")
term.setCursorPos(1,2)
term.write("skal staven op eller ned")
term.setCursorPos(1.3)
term.write("1: op")
term.setCursorPos(1.4)
term.write("2: ned")
term.setCursorPos(1.5)
term.write(" Valg: ")
local opned = read()
if opned == 1 then
term.clear()
term.setCursorPos(1,1)
term.write("hvor meget skal den op")
term.setCursorPos(1,2)
term.write("Valg :")
local hvormegetop = read()
rea.setAllControlRodLevels(rod + hvormegetop)
elseif opned == 2 then
term.clear()
term.setCursorPos(1,1)
term.write("hvor meget skal den ned")
term.setCursorPos(1,2)
term.write("Valg :")
local hvormegetned = read()
rea.setAllControlRodLevels(rod - hvormegetned)
end
end
end
local function monitor()
mon.clear()
while true do
local fueltemp = rea.getFuelTemperature()
local casetemp = rea.getCasingTemperature()
local fuelam = math.floor(rea.getFuelAmount / 1000)
local energy = rea.getEnergyStored()
local prt = math.floor(rea.getEnergyProducedLastTick / 1000 )
local rodlevel = rea.getControlRodLevel()
mon.setCursorPos(1.2)
mon.write("Fuel Temp: "..fueltemp)
mon.setCursorPos(1,3)
mon.write(" Casing Temp: "..casetemp)
mon.setCursorPos(1,4)
mon.write("Fuel Amount: "..fuelam)
mon.setCursorPos(1.5)
mon.write("energy level: "..energy)
mon.setCursorPos(1,6)
mon.write("Energy Production: "..prt)
mon.setCursorPos(1,7)
mon.write("Control rod: "..rodlevel)
if rea.getActive() == true then
mon.setCursorPos(1,1)
mon.clearLine()
mon.write("Reactor Status: ON")
elseif rea.getActive() == false then
mon.setCursorPos(1,1)
mon.clearLine()
mon.write("Reactor Status: OFF")
end
end
end
while true do
parallel.waitForAny(rod,monitor)
end