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

Nuclear reactor (basic script)

Started by meerlo11, 20 July 2012 - 11:37 AM
meerlo11 #1
Posted 20 July 2012 - 01:37 PM
Hello Scripters!
(sorry for bas spelling)
A friend of me on Tekkit has made an Nuclear reactor
He asked me to make an computer controlled 1.
It doesn't need that much commands.
first only ON and OFF

this is the script I used…
(Im a beginner so thats why it might not work :P/>/> I try to get better!)
—————————————————————

correctpass = On
pass = Off

write("please Input Funtion (On/Off)")

if pass == (correctpass) then
write("reactor Starting...")
redstone.setOutput("Back", true)
else

if pass == (pass)
write("Reactor Shutting off")
redstone.setOutput("Back", false)
else

write("Incorrect comman choose On/Off")
os.shutdown()
end
————————————————————

the error is:

Bios:206: [String "nuclear"]:20: '<eof>' expected

Im on vacation…
now so ill se the reactions within 1/2 weeks!

every 1 thanks!
Lyqyd #2
Posted 20 July 2012 - 06:58 PM
This post should have been placed in the Ask a Pro section.
flaminsnowman99 #3
Posted 20 July 2012 - 08:03 PM
Lyqyd is correct. However you need another "end"
Lyqyd #4
Posted 21 July 2012 - 01:03 AM
Made some corrections. This version will continue running until it is told to exit, and it actually asks for input.


while true do
	--Spelling error.
	write("Please Input Function (On/Off/Exit)")
	--You were not taking any input, so it would have immediately shut the reactor off every time you ran the program.
	local input = tolower(read())
	if input == "on" then
		write("Reactor Starting...")
		--"Back" is not a side; "back" is.
		redstone.setOutput("back", true)
	elseif input == "off" then
		write("Reactor Shutting Off")
		redstone.setOutput("back", false)
	elseif input == "exit" then
		break
	else
		write("Incorrect command. Choose On/Off/Exit.")
	end
end
meerlo11 #5
Posted 01 August 2012 - 08:31 AM
Thx very much!!!
It helped me good!
Next time ill
Place it in the Pro section!