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

Lua Error

Started by Magiczipper, 07 July 2012 - 02:25 AM
Magiczipper #1
Posted 07 July 2012 - 04:25 AM
I've tried pretty much everything I can think of and have gone over the code multiple times. If anyone can help me out that would be fantastic. I'm getting a bios:206: [string "control"]:2: '=' expected error.


term.clear()
term.setCursorPos (1,1)
local [1] = "OpenReactorRoom"
local [2] = "ReactorCooling"
local [3] = "ReactorState"
local [4] = "Exit"
print("Reactor Control System v1.2")
sleep(2)
print("Enter "[1]" To access the reactor room.")
print("Enter "[2]" to turn on reactor cooling system.")
print("Enter "[3]" to turn reactor state On/off")
write("Control Function? : ")
local input = read()
if input == [1] then
		term.clear()
		term.setCursorPos (1,1)
		print("Opening the reactor room...")
		c = colors.combine( c, colors.orange )
  rs.setBundledOutput("bottom", c )
		sleep(1)
		term.clear()
		term.setCursorPos (1,1)
		print("To close door Enter "Close"")
		write("Control Function? : ")

		local secondinput = read()

		if secondinput == C then
	term.clear()
	term.setCursorPos (1,1)
	print("Closing reactor door...")
	sleep(1)
	c = colors.subtract( c, colors.orange )
	rs.setBundledOutput("bottom", c )
	shell.run("Control")
		else
	term.clear()
	term.setCursorPos (1,1)
	print("Command incorrect, shutting down.")
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("up",false)
	rs.setOutput("down",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep(2)
	os.reboot()
		end	  
elseif input == [2] then
		term.clear()
		term.setCursorPos (1,1)
		print ("Reactor Cooling System Actived")
		c = colors.combine( c, colors.white )
  rs.setBundledOutput("bottom", c )
		sleep (1)
		term.clear()
  term.setCursorPos (1,1)
  print ("To turn off Cooling System Enter "Off"")
  write (" Control Function? : ")

		local secondinput = read()

		if secondinput == O then
	term.clear()
	term.setCursorPos (1,1)
	print ("Cooling System Shutting Down")
	sleep (2)
	c = colors.subtract( c, colors.white )
	rs.setBundledOutput("bottom", c )
	sleep (2)
		  shell.run("Control")
  end
elseif input == [3] then
		term.clear()
		term.setCursorPos (1,1)
		print ("Reactors Coming Online")
		c = colors.combine( c, colors.white, colors.magenta )
  rs.setBundledOutput("bottom", c )
		sleep (1)
		term.clear()
		term.setCursorPos (1,1)
		print ("To turn Reactors Off Enter "Off"")
		write ("Control Function? : ")

		local thirdinput = read()

		if thirdinput == O
	term.clear()
	term.setCursorPos (1,1)
	print ("Reactors Shutting Down. Standby.")
	c = colors.subtract( c, colors.white, colors.magenta )
	rs.BundledOutput("bottom", c )  
	sleep(2)
	shell.run("Control")
		else
	term.clear()
	term.setCursorPos (1,1)
	print("Command incorrect, shutting down.")
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("up",false)
	rs.setOutput("down",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep (2)
	os.reboot()
		end
else
  term.clear()
  term.setCursorPos (1,1)
  print("Command incorrect, shutting down.")
  rs.setOutput("right",false)
  rs.setOutput("left",false)
  rs.setOutput("up",false)
  rs.setOutput("down",false)
  rs.setOutput("back",false)
  rs.setOutput("bottom",false)
  sleep (2)
  os.reboot()
end
archit #2
Posted 07 July 2012 - 04:54 AM
term.setCursorPos (1,1)

should be


term.setCursorPos(1,1)


Don't be adding spaces on function calls and their variables :P/>/>

I would also suggest taking away the spaces for your table arrays
Magiczipper #3
Posted 07 July 2012 - 08:38 AM
Fixed, but still getting the same problem
Kolpa #4
Posted 07 July 2012 - 09:30 AM
Please use some kind of proper format next time for code this long its realy a pain trying to read it like this tried my best to fix it :P/>/> :

term.clear()
term.setCursorPos (1,1)
local [1] = "OpenReactorRoom"
local [2] = "ReactorCooling"
local [3] = "ReactorState"
local [4] = "Exit"
print("Reactor Control System v1.2")
sleep(2)
print("Enter "[1]" To access the reactor room.")
print("Enter "[2]" to turn on reactor cooling system.")
print("Enter "[3]" to turn reactor state On/off")
write("Control Function? : ")
local input = read()

if input == [1] then
	term.clear()
	term.setCursorPos (1,1)
	print("Opening the reactor room...")
	c = colors.combine( c, colors.orange )
	rs.setBundledOutput("bottom", c )
	sleep(1)
	term.clear()
	term.setCursorPos (1,1)
	print("To close door Enter "Close"")
	write("Control Function? : ")
	local secondinput = read()

	if secondinput == C then
		term.clear()
		term.setCursorPos (1,1)
		print("Closing reactor door...")
		sleep(1)
		c = colors.subtract( c, colors.orange )
		rs.setBundledOutput("bottom", c )
		shell.run("Control")
	else
		term.clear()
		term.setCursorPos (1,1)
		print("Command incorrect, shutting down.")
		rs.setOutput("right",false)
		rs.setOutput("left",false)
		rs.setOutput("up",false)
		rs.setOutput("down",false)
		rs.setOutput("back",false)
		rs.setOutput("bottom",false)
		sleep(2)
		os.reboot()
	end
  
elseif input == [2] then
	term.clear()
	term.setCursorPos (1,1)
	print ("Reactor Cooling System Actived")
	c = colors.combine( c, colors.white )
	rs.setBundledOutput("bottom", c )
	sleep (1)
	term.clear()
	term.setCursorPos (1,1)
	print ("To turn off Cooling System Enter "Off"")
	write (" Control Function? : ")
	local secondinput = read()
  
	if secondinput == O then
		term.clear()
		term.setCursorPos (1,1)
		print ("Cooling System Shutting Down")
		sleep (2)
		c = colors.subtract( c, colors.white )
		rs.setBundledOutput("bottom", c )
		sleep (2)
		shell.run("Control")
	end

elseif input == [3] then
	term.clear()
	term.setCursorPos (1,1)
	print ("Reactors Coming Online")
	c = colors.combine( c, colors.white, colors.magenta )
	rs.setBundledOutput("bottom", c )
	sleep (1)
	term.clear()
	term.setCursorPos (1,1)
	print ("To turn Reactors Off Enter "Off"")
	write ("Control Function? : ")
	local thirdinput = read()

	if thirdinput == O
		term.clear()
		term.setCursorPos (1,1)
		print ("Reactors Shutting Down. Standby.")
		c = colors.subtract( c, colors.white, colors.magenta )
		rs.BundledOutput("bottom", c )
		sleep(2)
		shell.run("Control")
	else
		term.clear()
		term.setCursorPos (1,1)
		print("Command incorrect, shutting down.")
		rs.setOutput("right",false)
		rs.setOutput("left",false)
		rs.setOutput("up",false)
		rs.setOutput("down",false)
		rs.setOutput("back",false)
		rs.setOutput("bottom",false)
		sleep (2)
		os.reboot()
	end
  
else
	term.clear()
	term.setCursorPos (1,1)
	print("Command incorrect, shutting down.")
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("up",false)
	rs.setOutput("down",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep (2)
	os.reboot()
end
Lyqyd #5
Posted 07 July 2012 - 06:49 PM
Fixed, but still getting the same problem

You did change that on every line, right? It looks like every instance of term.setCursorPos() has a space between the name and the opening parenthesis.
maxymunte #6
Posted 17 July 2012 - 09:29 PM
Fixed, but still getting the same problem

You did change that on every line, right? It looks like every instance of term.setCursorPos() has a space between the name and the opening parenthesis.



i need help i have same script i did what you said no space between setcursorpos and the ()
but i get this error
bios:206: [string "reactor"]:3: '<name>' expected
maxymunte #7
Posted 17 July 2012 - 09:32 PM
i now have this


term.clear()
term.setCursorPos(1,1)
local [1] = "OpenReactorRoom"
local [2] = "ReactorCooling"
local [3] = "ReactorState"
local [4] = "Exit"
print("Reactor Control System v1.2")
sleep(2)
print("Enter "[1]" To access the reactor room.")
print("Enter "[2]" to turn on reactor cooling system.")
print("Enter "[3]" to turn reactor state On/off")
write("Control Function? : ")
local input = read()

if input == [1] then
	    term.clear()
	    term.setCursorPos(1,1)
	    print("Opening the reactor room...")
	    c = colors.combine( c, colors.orange )
	    rs.setBundledOutput("bottom", c )
	    sleep(1)
	    term.clear()
	    term.setCursorPos(1,1)
	    print("To close door Enter "Close"")
	    write("Control Function? : ")
	    local secondinput = read()

	    if secondinput == C then
			    term.clear()
			    term.setCursorPos(1,1)
			    print("Closing reactor door...")
			    sleep(1)
			    c = colors.subtract( c, colors.orange )
			    rs.setBundledOutput("bottom", c )
			    shell.run("Control")
	    else
			    term.clear()
			    term.setCursorPos(1,1)
			    print("Command incorrect, shutting down.")
			    rs.setOutput("right",false)
			    rs.setOutput("left",false)
			    rs.setOutput("up",false)
			    rs.setOutput("down",false)
			    rs.setOutput("back",false)
			    rs.setOutput("bottom",false)
			    sleep(2)
			    os.reboot()
	    end
  
elseif input == [2] then
	    term.clear()
	    term.setCursorPos(1,1)
	    print ("Reactor Cooling System Actived")
	    c = colors.combine( c, colors.white )
	    rs.setBundledOutput("bottom", c )
	    sleep (1)
	    term.clear()
	    term.setCursorPos(1,1)
	    print ("To turn off Cooling System Enter "Off"")
	    write (" Control Function? : ")
	    local secondinput = read()
  
	    if secondinput == O then
			    term.clear()
			    term.setCursorPos(1,1)
			    print ("Cooling System Shutting Down")
			    sleep (2)
			    c = colors.subtract( c, colors.white )
			    rs.setBundledOutput("bottom", c )
			    sleep (2)
			    shell.run("Control")
	    end

elseif input == [3] then
	    term.clear()
	    term.setCursorPos(1,1)
	    print ("Reactors Coming Online")
	    c = colors.combine( c, colors.white, colors.magenta )
	    rs.setBundledOutput("bottom", c )
	    sleep (1)
	    term.clear()
	    term.setCursorPos(1,1)
	    print ("To turn Reactors Off Enter "Off"")
	    write ("Control Function? : ")
	    local thirdinput = read()

	    if thirdinput == O
			    term.clear()
			    term.setCursorPos (1,1)
			    print ("Reactors Shutting Down. Standby.")
			    c = colors.subtract( c, colors.white, colors.magenta )
			    rs.BundledOutput("bottom", c )
			    sleep(2)
			    shell.run("Control")
	    else
			    term.clear()
			    term.setCursorPos(1,1)
			    print("Command incorrect, shutting down.")
			    rs.setOutput("right",false)
			    rs.setOutput("left",false)
			    rs.setOutput("up",false)
			    rs.setOutput("down",false)
			    rs.setOutput("back",false)
			    rs.setOutput("bottom",false)
			    sleep (2)
			    os.reboot()
	    end
  
else
	    term.clear()
	    term.setCursorPos(1,1)
	    print("Command incorrect, shutting down.")
	    rs.setOutput("right",false)
	    rs.setOutput("left",false)
	    rs.setOutput("up",false)
	    rs.setOutput("down",false)
	    rs.setOutput("back",false)
	    rs.setOutput("bottom",false)
	    sleep (2)
	    os.reboot()
end
MysticT #8
Posted 17 July 2012 - 09:42 PM
It has nothing to do with the function calls, you can have spaces between the function name and the parenthesis.
The problem is that you can't name the variables like [1], [2], etc. That's for indexing a table.
So, you can change them for some name, or put them in a table and then index that table.
maxymunte #9
Posted 18 July 2012 - 10:08 AM
It has nothing to do with the function calls, you can have spaces between the function name and the parenthesis.
The problem is that you can't name the variables like [1], [2], etc. That's for indexing a table.
So, you can change them for some name, or put them in a table and then index that table.

i still dont get it to work now im getting an other error could you please fix this script for me im bad at this

i managed to fix it myself but now im getting reactor:9: atempt to call string what does that mean?
lol fixed that to
maxymunte #10
Posted 18 July 2012 - 10:30 AM
every time i enter a function like open its says invailid command shutting down what iis wrong with it now? D:

um i now have this


term.clear()
term.setCursorPos(1,1)
local open = "OpenReactorRoom"
local cooling = "ReactorCooling"
local reactor = "ReactorState"
local exit = "Exit"
print "Reactor Control System v1.2"
sleep(2)
print "Enter open To access the reactor room."
print "Enter cooling to turn on reactor cooling system."
print "Enter reactor to turn reactor state On/off"
write("Control Function? : ")
local input = read()

if input == open then
	    term.clear()
	    term.setCursorPos(1,1)
	    print("Opening the reactor room...")
	    c = colors.combine( c, colors.orange )
	    rs.setBundledOutput("bottom", c )
	    sleep(1)
	    term.clear()
	    term.setCursorPos(1,1)
	    print "To close door Enter "Close""
	    write("Control Function? : ")
	    local secondinput = read()

	    if secondinput == C then
			    term.clear()
			    term.setCursorPos(1,1)
			    print "Closing reactor door..."
			    sleep(1)
			    c = colors.subtract( c, colors.orange )
			    rs.setBundledOutput("bottom", c )
			    shell.run("Control")
	    else
			    term.clear()
			    term.setCursorPos(1,1)
			    print("Command incorrect, shutting down.")
			    rs.setOutput("right",false)
			    rs.setOutput("left",false)
			    rs.setOutput("top",false)
			    rs.setOutput("back",false)
			    rs.setOutput("bottom",false)
			    sleep(2)
			    os.reboot()
	    end
  
elseif input == cooling then
	    term.clear()
	    term.setCursorPos(1,1)
	    print "Reactor Cooling System Actived"
	    c = colors.combine( c, colors.white )
	    rs.setBundledOutput("bottom", c )
	    sleep (1)
	    term.clear()
	    term.setCursorPos(1,1)
	    print "To turn off Cooling System Enter "Off""
	    write " Control Function? : "
	    local secondinput = read()
  
	    if secondinput == O then
			    term.clear()
			    term.setCursorPos(1,1)
			    print "Cooling System Shutting Down"
			    sleep (2)
			    c = colors.subtract( c, colors.white )
			    rs.setBundledOutput("bottom", c )
			    sleep (2)
			    shell.run("Control")
	    end

elseif input == reactor then
	    term.clear()
	    term.setCursorPos(1,1)
	    print "Reactors Coming Online"
	    c = colors.combine( c, colors.white, colors.magenta )
	    rs.setBundledOutput("bottom", c )
	    sleep (1)
	    term.clear()
	    term.setCursorPos(1,1)
	    print "To turn Reactors Off Enter "Off""
	    write ("Control Function? : ")
	    local thirdinput = read()

	    if thirdinput == O then
			    term.clear()
			    term.setCursorPos (1,1)
			    print "Reactors Shutting Down. Standby."
			    c = colors.subtract( c, colors.white, colors.magenta )
			    rs.BundledOutput("bottom", c )
			    sleep(2)
			    shell.run("Control")
	    else
			    term.clear()
			    term.setCursorPos(1,1)
			    print "Command incorrect, shutting down."
			    rs.setOutput("right",false)
			    rs.setOutput("left",false)
			    rs.setOutput("top",false)
			    rs.setOutput("back",false)
			    rs.setOutput("bottom",false)
			    sleep (2)
			    os.reboot()
	    end
  
else
	    term.clear()
	    term.setCursorPos(1,1)
	    print "Command incorrect, shutting down."
	    rs.setOutput("right",false)
	    rs.setOutput("left",false)
	    rs.setOutput("top",false)
	    rs.setOutput("back",false)
	    rs.setOutput("bottom",false)
	    sleep (2)
	    os.reboot()
end
MysticT #11
Posted 18 July 2012 - 04:36 PM
Did you type "OpenReactorRoom" or just "open"? Cause you'r checking for "OpenReactorRoom".
You should remove the variable definitions, and then add quotes on the if's:

term.clear()
term.setCursorPos(1,1)
print("Reactor Control System v1.2")
sleep(2)
print("Enter open To access the reactor room.")
print("Enter cooling to turn on reactor cooling system.")
print("Enter reactor to turn reactor state On/off")
write("Control Function? : ")
local input = read()
if input == "open" then
  term.clear()
  term.setCursorPos(1,1)
  print("Opening the reactor room...")
  rs.setBundledOutput("bottom", colors.orange)
  sleep(1)
  term.clear()
  term.setCursorPos(1,1)
  print("To close door Enter Close")
  write("Control Function? : ")
  local secondinput = read()
  if secondinput == "Close" then
	term.clear()
	term.setCursorPos(1, 1)
	print("Closing reactor door...")
	sleep(1)
	rs.setBundledOutput("bottom", 0)
	shell.run("Control") -- really bad idea, this will crash the computer after some time. Use a loop instead.
  else
	term.clear()
	term.setCursorPos(1, 1)
	print("Command incorrect, shutting down.")
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("top",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep(2)
	os.reboot()
  end
elseif input == "cooling" then
  term.clear()
  term.setCursorPos(1, 1)
  print("Reactor Cooling System Actived")
  rs.setBundledOutput("bottom", colors.white)
  sleep (1)
  term.clear()
  term.setCursorPos(1,1)
  print("To turn off Cooling System Enter "Off"")
  write(" Control Function? : ")
  local secondinput = read()
  if secondinput == "Off" then
	term.clear()
	term.setCursorPos(1,1)
	print("Cooling System Shutting Down")
	sleep (2)
	rs.setBundledOutput("bottom", 0)
	sleep (2)
	shell.run("Control") -- same as above
  end
elseif input == "reactor" then
  term.clear()
  term.setCursorPos(1,1)
  print("Reactors Coming Online")
  rs.setBundledOutput("bottom", colors.combine(colors.white, colors.magenta))
  sleep (1)
  term.clear()
  term.setCursorPos(1,1)
  print("To turn Reactors Off Enter "Off"")
  write ("Control Function? : ")
  local thirdinput = read()
  if thirdinput == "Off" then
	term.clear()
	term.setCursorPos (1,1)
	print("Reactors Shutting Down. Standby.")
	rs.setBundledOutput("bottom", 0)
	sleep(2)
	shell.run("Control") -- same here
  else
	term.clear()
	term.setCursorPos(1,1)
	print "Command incorrect, shutting down."
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("top",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep (2)
	os.reboot()
  end
else
  term.clear()
  term.setCursorPos(1,1)
  print("Command incorrect, shutting down.")
  rs.setOutput("right",false)
  rs.setOutput("left",false)
  rs.setOutput("top",false)
  rs.setOutput("back",false)
  rs.setOutput("bottom",false)
  sleep (2)
  os.reboot()
end
1lann #12
Posted 18 July 2012 - 04:36 PM
Your forgot to add the quotes" " at the if statements. Ex if read == open should be if read == "open"

Edit: ninja'd by Mystic XD
maxymunte #13
Posted 19 July 2012 - 09:15 AM
Did you type "OpenReactorRoom" or just "open"? Cause you'r checking for "OpenReactorRoom".
You should remove the variable definitions, and then add quotes on the if's:

term.clear()
term.setCursorPos(1,1)
print("Reactor Control System v1.2")
sleep(2)
print("Enter open To access the reactor room.")
print("Enter cooling to turn on reactor cooling system.")
print("Enter reactor to turn reactor state On/off")
write("Control Function? : ")
local input = read()
if input == "open" then
  term.clear()
  term.setCursorPos(1,1)
  print("Opening the reactor room...")
  rs.setBundledOutput("bottom", colors.orange)
  sleep(1)
  term.clear()
  term.setCursorPos(1,1)
  print("To close door Enter Close")
  write("Control Function? : ")
  local secondinput = read()
  if secondinput == "Close" then
	term.clear()
	term.setCursorPos(1, 1)
	print("Closing reactor door...")
	sleep(1)
	rs.setBundledOutput("bottom", 0)
	shell.run("Control") -- really bad idea, this will crash the computer after some time. Use a loop instead.
  else
	term.clear()
	term.setCursorPos(1, 1)
	print("Command incorrect, shutting down.")
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("top",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep(2)
	os.reboot()
  end
elseif input == "cooling" then
  term.clear()
  term.setCursorPos(1, 1)
  print("Reactor Cooling System Actived")
  rs.setBundledOutput("bottom", colors.white)
  sleep (1)
  term.clear()
  term.setCursorPos(1,1)
  print("To turn off Cooling System Enter "Off"")
  write(" Control Function? : ")
  local secondinput = read()
  if secondinput == "Off" then
	term.clear()
	term.setCursorPos(1,1)
	print("Cooling System Shutting Down")
	sleep (2)
	rs.setBundledOutput("bottom", 0)
	sleep (2)
	shell.run("Control") -- same as above
  end
elseif input == "reactor" then
  term.clear()
  term.setCursorPos(1,1)
  print("Reactors Coming Online")
  rs.setBundledOutput("bottom", colors.combine(colors.white, colors.magenta))
  sleep (1)
  term.clear()
  term.setCursorPos(1,1)
  print("To turn Reactors Off Enter "Off"")
  write ("Control Function? : ")
  local thirdinput = read()
  if thirdinput == "Off" then
	term.clear()
	term.setCursorPos (1,1)
	print("Reactors Shutting Down. Standby.")
	rs.setBundledOutput("bottom", 0)
	sleep(2)
	shell.run("Control") -- same here
  else
	term.clear()
	term.setCursorPos(1,1)
	print "Command incorrect, shutting down."
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("top",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep (2)
	os.reboot()
  end
else
  term.clear()
  term.setCursorPos(1,1)
  print("Command incorrect, shutting down.")
  rs.setOutput("right",false)
  rs.setOutput("left",false)
  rs.setOutput("top",false)
  rs.setOutput("back",false)
  rs.setOutput("bottom",false)
  sleep (2)
  os.reboot()
end

um it stil doesnt work and having 4 " of those makes also an error
um could you please fix it instead of telling me what i should do becouse i cant ready any of this lua
maxymunte #14
Posted 19 July 2012 - 01:15 PM
btw when i got this program to start and read open it dind regionize the second input and it doesnt ouput a redstone signal

and i see 2 lines that have a space where i think they are not supose to be
term.setCursorPos(1, 1)
……………………………….&#46;&#46;/


please i just want a working script that makes me able to put a bundled cable at the back side and opens the reactor door stops ice from going in makes me able to turn on and off the reactor and if there is such n option to put a uranium cell int here so if anyone has such a script please give it to me
maxymunte #15
Posted 19 July 2012 - 02:04 PM
nvm i got it to work myself im going to tweak it a bit and then upload it for the others
maxymunte #16
Posted 19 July 2012 - 04:17 PM
Did you type "OpenReactorRoom" or just "open"? Cause you'r checking for "OpenReactorRoom".
You should remove the variable definitions, and then add quotes on the if's:

term.clear()
term.setCursorPos(1,1)
print("Reactor Control System v1.2")
sleep(2)
print("Enter open To access the reactor room.")
print("Enter cooling to turn on reactor cooling system.")
print("Enter reactor to turn reactor state On/off")
write("Control Function? : ")
local input = read()
if input == "open" then
  term.clear()
  term.setCursorPos(1,1)
  print("Opening the reactor room...")
  rs.setBundledOutput("bottom", colors.orange)
  sleep(1)
  term.clear()
  term.setCursorPos(1,1)
  print("To close door Enter Close")
  write("Control Function? : ")
  local secondinput = read()
  if secondinput == "Close" then
	term.clear()
	term.setCursorPos(1, 1)
	print("Closing reactor door...")
	sleep(1)
	rs.setBundledOutput("bottom", 0)
	shell.run("Control") -- really bad idea, this will crash the computer after some time. Use a loop instead.
  else
	term.clear()
	term.setCursorPos(1, 1)
	print("Command incorrect, shutting down.")
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("top",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep(2)
	os.reboot()
  end
elseif input == "cooling" then
  term.clear()
  term.setCursorPos(1, 1)
  print("Reactor Cooling System Actived")
  rs.setBundledOutput("bottom", colors.white)
  sleep (1)
  term.clear()
  term.setCursorPos(1,1)
  print("To turn off Cooling System Enter "Off"")
  write(" Control Function? : ")
  local secondinput = read()
  if secondinput == "Off" then
	term.clear()
	term.setCursorPos(1,1)
	print("Cooling System Shutting Down")
	sleep (2)
	rs.setBundledOutput("bottom", 0)
	sleep (2)
	shell.run("Control") -- same as above
  end
elseif input == "reactor" then
  term.clear()
  term.setCursorPos(1,1)
  print("Reactors Coming Online")
  rs.setBundledOutput("bottom", colors.combine(colors.white, colors.magenta))
  sleep (1)
  term.clear()
  term.setCursorPos(1,1)
  print("To turn Reactors Off Enter "Off"")
  write ("Control Function? : ")
  local thirdinput = read()
  if thirdinput == "Off" then
	term.clear()
	term.setCursorPos (1,1)
	print("Reactors Shutting Down. Standby.")
	rs.setBundledOutput("bottom", 0)
	sleep(2)
	shell.run("Control") -- same here
  else
	term.clear()
	term.setCursorPos(1,1)
	print "Command incorrect, shutting down."
	rs.setOutput("right",false)
	rs.setOutput("left",false)
	rs.setOutput("top",false)
	rs.setOutput("back",false)
	rs.setOutput("bottom",false)
	sleep (2)
	os.reboot()
  end
else
  term.clear()
  term.setCursorPos(1,1)
  print("Command incorrect, shutting down.")
  rs.setOutput("right",false)
  rs.setOutput("left",false)
  rs.setOutput("top",false)
  rs.setOutput("back",false)
  rs.setOutput("bottom",false)
  sleep (2)
  os.reboot()
end

(where is the spoiler button? gets a bit messy in here and i forgot the code)

um i fixed everything i just need 1 more thing if you could do the loop thing for me becouse i dont get it
here is the code thank you verry much for all your help


term.clear()
term.setCursorPos(1,1)
print("---------- Reactor Control System v1.2 ----------")
sleep(2)
print("Enter [open door] To access the reactor room.")
print()
print("Enter [start cooling] to turn on reactor cooling system.")
print()
print("Enter [reactor on] to turn reactor state On/off")
print("-------------------------------------------------")
write("Control Function? : ")
local input = read()
if input == "open door" then
  term.clear()
  term.setCursorPos(1,1)
  print("Opening the reactor room...")
  rs.setBundledOutput("back", colors.orange)
  sleep(1)
  term.clear()
  term.setCursorPos(1,1)
  print("To close door Enter Close")
  write("Control Function? : ")
  local secondinput = read()
  if secondinput == "close" then
	    term.clear()
	    term.setCursorPos(1, 1)
	    print("Closing reactor door...")
	    sleep(1)
	    rs.setBundledOutput("back", 0)
	    shell.run("reactor") -- really bad idea, this will crash the computer after some time. Use a loop instead.
  else
	    term.clear()
	    term.setCursorPos(1, 1)
	    print("Command incorrect, shutting down.")
	    rs.setOutput("right",false)
	    rs.setOutput("left",false)
	    rs.setOutput("top",false)
	    rs.setOutput("back",false)
	    rs.setOutput("bottom",false)
	    sleep(2)
	    os.reboot()
  end
elseif input == "start cooling" then
  term.clear()
  term.setCursorPos(1, 1)
  print("Reactor Cooling System Actived")
  rs.setBundledOutput("back", colors.red)
  sleep (1)
  term.clear()
  term.setCursorPos(1,1)
  print "To turn off Cooling System Enter Off"
  write(" Control Function? : ")
  local secondinput = read()
  if secondinput == "off" then
	    term.clear()
	    term.setCursorPos(1,1)
	    print("Cooling System Shutting Down")
	    sleep (2)
	    rs.setBundledOutput("back", 0)
	    sleep (2)
	    shell.run("reactor") -- same as above
  else
	    term.clear()
	    term.setCursorPos(1, 1)
	    print("Command incorrect, shutting down.")
	    rs.setOutput("right",false)
	    rs.setOutput("left",false)
	    rs.setOutput("top",false)
	    rs.setOutput("back",false)
	    rs.setOutput("bottom",false)
	    sleep(2)
	    os.reboot()
  end
elseif input == "reactor on" then
  term.clear()
  term.setCursorPos(1,1)
  print("Reactors Coming Online")
  rs.setBundledOutput("back", colors.combine(colors.red, colors.blue))
  sleep (1)
  term.clear()
  term.setCursorPos(1,1)
  print "To turn Reactors Off Enter Off"
  write ("Control Function? : ")
  local thirdinput = read()
  if thirdinput == "off" then
	    term.clear()
	    term.setCursorPos (1,1)
	    print("Reactors Shutting Down. Standby.")
	    rs.setBundledOutput("back", 0)
	    sleep(2)
	    shell.run("reactor") -- same here
  else
	    term.clear()
	    term.setCursorPos(1,1)
	    print "Command incorrect, shutting down."
	    rs.setOutput("right",false)
	    rs.setOutput("left",false)
	    rs.setOutput("top",false)
	    rs.setOutput("back",false)
	    rs.setOutput("bottom",false)
	    sleep (2)
	    os.reboot()
  end
else
  term.clear()
  term.setCursorPos(1,1)
  print("Command incorrect, shutting down.")
  rs.setOutput("right",false)
  rs.setOutput("left",false)
  rs.setOutput("top",false)
  rs.setOutput("back",false)
  rs.setOutput("bottom",false)
  sleep (2)
  os.reboot()
end
KingMachine #17
Posted 19 July 2012 - 05:43 PM
if you could do the loop thing for me becouse i dont get it

Loops are a core part of coding. I highly suggest that you learn how to do them yourself. Coding is not about asking others how to do something or to do it for them. People are paid 60,000 USD/year to do that (the coding for someone else that is). Loops are simple. Just work it out on paper or in your head what needs to be done and think about what order you would need to accomplish tiny tasks to complete a larger one. Take your time, be patient. Coding is not about having a product right this second. Coding is about being logical and creative at the same time to get what you want done quickly and efficiently. The coding itself doesn't necessarily need either of those things, though it usually does include the efficiency, but that comes with the patience.
maxymunte #18
Posted 20 July 2012 - 03:58 PM
if you could do the loop thing for me becouse i dont get it

Loops are a core part of coding. I highly suggest that you learn how to do them yourself. Coding is not about asking others how to do something or to do it for them. People are paid 60,000 USD/year to do that (the coding for someone else that is). Loops are simple. Just work it out on paper or in your head what needs to be done and think about what order you would need to accomplish tiny tasks to complete a larger one. Take your time, be patient. Coding is not about having a product right this second. Coding is about being logical and creative at the same time to get what you want done quickly and efficiently. The coding itself doesn't necessarily need either of those things, though it usually does include the efficiency, but that comes with the patience.

um so you mean under the section ask a pro we should not ask a pro and get stuck at somthing we dont get? becouse you probably do not understand the reason of this section second there are kind people that help other people and this is just for fun not sirous bussnius and i dont feel like learning an entire language for 1 script
Lyqyd #19
Posted 20 July 2012 - 06:51 PM
You're a lot more likely to get help if you put in some effort. Sure, you don't need to become a lua expert, but don't just ask us to do stuff for you without even trying first.
maxymunte #20
Posted 21 July 2012 - 02:33 PM
well like i said i dont understand it and i cant get it to work what means i tryed it
and the lua god guy does it probably faster than telling me that i should change it ina loop