Posted 19 June 2015 - 09:33 PM
To be quite honest the title says it all (but I know what its like, when people say it); Basically I'm having an issue with a BigReactors 'control' system that I'm doing, each time I open the program I get 'touchpoint:128: attempt to index ? (a nil value)'; I've tried multiple variants to change the text in the 'button' or so its called in the API; I did get it working before, just the way I did wasn't very 'Optimized' in the way of getting the current text.
os.loadAPI("touchpoint")
local t = touchpoint.new("left")
m = peripheral.wrap("monitor_0")
local LastTickEnergyLevel = 0
t:add("Start", function() bFunc0() end, 1, 1, 8, 2, colors.lime, colors.lightGray)
t:add("Stop", function() bFunc1() end, 1, 4, 8, 5, colors.red, colors.lightGray)
t:add("Dump", function() bFunc2() end, 1, 7, 8, 8, colors.lightBlue, colors.lightGray)
t:add("Rods -", function() bFunc3() end, 1, 10, 8, 11, colors.yellow, colors.lightGray)
t:add("Rods +", function() bFunc4() end, 1, 13, 8, 14, colors.orange, colors.lightGray)
t:add("Reboot", function() RebootSys() end, 1, 16, 8, 17, colors.lightBlue, colors.lightGray)
t:add("Reactor Active:", "R_Active", 11, 1, 27, 1, colors.black, colors.black)
t:add("Reactor Energy:", "R_SEnergy", 11, 2, 27, 2, colors.black, colors.black)
t:add("Fuel Temp:", "R_FuelTmp", 11, 3, 22, 3, colors.black, colors.black)
t:add("Case Temp:", "R_CaseTmp", 11, 4, 22, 4, colors.black, colors.black)
t:add("-----------------------------", nil, 11, 5, 41, 5, colors.black, colors.black)
t:add("Radiated Fuel:", "R_FRadiated", 11, 6, 26, 6, colors.black, colors.black)
t:add("Unradiated Fuel:", "R_URadiated", 11, 7, 28, 7, colors.black, colors.black)
t:add("Energy (p/tick):", "R_EnergyTick", 11, 8, 28, 8, colors.black, colors.black)
function RebootSys()
m.clear()
os.reboot()
end
while true do
-- Update variables, and save required information --
local reactor = peripheral.wrap("BigReactors-Reactor_0")
local reactor_active_string = ""
if reactor.getActive() == true then
t:rename("R_Active", "Reactor Active: Yes")
else
t:rename("R_Active", "Reactor Active: No")
end
t:draw()
local event, p1 = t:handleEvents(os.pullEvent())
if event == "button_click" then
if t.buttonList[p1].func ~= nil then
t.buttonList[p1].func()
end
t:flash(p1)
end
end