Posted 20 May 2012 - 04:43 AM
Hi,
i'm not good at programming (i sucked at java in school :P/>/>) but thought why not make a little program with this mod to controll my IC² CASUC.
So far i have:
It starts, goes to running the run() function and giving me the output of the ui() function on the ingame screen.
But as i type 1 and press enter i get:
Strange thing is, that the function this line is in, getstates(), should have been used by now, and doesn't give an error there.
after typing 1 and pressing enter it shouldn't even use that function.
I really don't know why i get that error :D/>/>
Every help is appreciated!
i'm not good at programming (i sucked at java in school :P/>/>) but thought why not make a little program with this mod to controll my IC² CASUC.
So far i have:
ronoff=0
sucstatus=0
rstatus=0
storef1=0
storef2=0
storef3=0
storef4=0
euflow=0
temp=0
function ron()
ison=colors.test(redstone.getBundledInput("back"), 64)
return ison
end
function euon()
eu=colors.test(redstone.getBundledInput("back"), 4)
return eu
end
function getstates()
if ronoff==0 and ron()==false then
rstatus=0
elseif ronoff==0 and ron()==true then
rstatus=1
else
rstatus=2
end
if eu()==true then
euflow=1
else
euflow=0
end
end
function drawdisp()
term.clear()
term.setCursorPos(11,1)
print("Welcome to reactor controll!")
term.setCursorPos(11,2)
print("Available actions:")
term.setCursorPos(13,3)
if rstatus==0 or rstatus==1 then
print("1 - Start reactor")
else
print("1 - Shut down reactor")
end
term.setCursorPos(13,4)
print("2 - Shut down system NYI")
end
function start()
rs.setBundledOutput("back",2)
sleep(3)
rs.setBundledOutput("back",3)
ronoff=1
end
function stop()
rs.setBundledOutput("back",2)
sleep(2)
rs.setBundledOutput("back",0)
ronoff=0
end
function ui()
getstates()
drawdisp()
print(""..euflow)
term.setCursorPos(11,6)
write("Enter choice: ")
end
function run()
ui()
x=io.read()
if x==1 and ronoff==0 then
start()
elseif x==1 and ronoff==1 then
stop()
end
run()
end
run()
It starts, goes to running the run() function and giving me the output of the ui() function on the ingame screen.
But as i type 1 and press enter i get:
startup:23: attempt to call boolean
line 23 is:
if ronoff==0 and ron()==false then
Strange thing is, that the function this line is in, getstates(), should have been used by now, and doesn't give an error there.
after typing 1 and pressing enter it shouldn't even use that function.
I really don't know why i get that error :D/>/>
Every help is appreciated!