This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
sflynn's profile picture

Computercraft reactor status screen

Started by sflynn, 03 April 2014 - 05:52 PM
sflynn #1
Posted 03 April 2014 - 07:52 PM
Hey, everyone I just need some help with my reactor status programs always crashing. Insted of loops which I can never get working I am restarting the program with shell.run("reactor"). Every 4 minutes or so I get a syntex error 204 and need to restart the program. Heres the code. Any help even by adding loops or anything wold be great. Thanks. PS Sorry that I cant but the code in the spoiler boxes cant figure out how.


local mon = peripheral.wrap("back") -- Monitor at back
local input = redstone.getInput("front") --Redstone input is at front
mon.clear()
mon.setTextScale(2)
mon.setCursorPos(1,1)
mon.write("reactor 2")

mon.setCursorPos(1,2)
mon.setTextScale(3)
if input == true then
  sleep(0)
  mon.setTextColor(colors.red)
  mon.write("REACTOR MELTDOWN")
  sleep(2)
  shell.run("reactor")
elseif input == false then
  sleep(0)
  mon.setTextColor(colors.green)
  mon.write("REACTOR NOMIAL")
  sleep(2)
  shell.run("reactor")
end
Edited by
Cranium #2
Posted 03 April 2014 - 10:14 PM
Make sure you're adding code in
 BBCode tags.
I went ahead and edited for you.
Edited on 03 April 2014 - 08:15 PM
Bomb Bloke #3
Posted 03 April 2014 - 10:34 PM
Every 4 minutes or so I get a syntex error 204 and need to restart the program.

And the full error is….?

There aren't any apparent problems with this code, but you're not displaying the "reactor" script you're calling here. I assume that script calls this one, which would indeed cause problems - if scripts call each other in a loop, then neither ends, and Lua will eventually crash out with a stack overflow due to all the script instances in memory.
sflynn #4
Posted 04 April 2014 - 12:15 AM
Every 4 minutes or so I get a syntex error 204 and need to restart the program.

And the full error is….?

There aren't any apparent problems with this code, but you're not displaying the "reactor" script you're calling here. I assume that script calls this one, which would indeed cause problems - if scripts call each other in a loop, then neither ends, and Lua will eventually crash out with a stack overflow due to all the script instances in memory.
That is the full Error code just the number 204 and somtimes 204204 and the script reactor is what your looking at it just repeats the program over and over so that it will self-update.
Edited on 03 April 2014 - 10:16 PM
sjkeegs #5
Posted 04 April 2014 - 12:40 AM
Put a loop in your program and start it once.


while true do
  if input == true then
	mon.setTextColor(colors.red)
	mon.write("REACTOR MELTDOWN")
  else
	mon.setTextColor(colors.green)
	mon.write("REACTOR NOMIAL")
  end
  sleep(2)
end
Edited on 03 April 2014 - 10:41 PM