while true do -- start infinite loop
shell.run("clear")
print (" Panic Room Door control 0.2v")
print (" ----------------------------")
print (" [1] Open Door ")
print (" [2] Close Door ")
print (" [3] Exit ")
print (" [4] Shutdown Computer ")
input = read.io()
yes = "1"
no = "2"
yo = "3"
la = "4"
if input == yes then
redstone.setOutput ("back", false)
redstone.setOutput ("down", false)
shell.run("startup") break -- break loop before continuing
end
if input == no then redstone.setOutput ("back", true)
redstone.setOutput ("down", true)
shell.run("startup")
break -- break the loop before proceeding
end
if input == yo then sleep(0) -- to avoid an error
if input == la then sleep(1)
os.shutdown()
end
end -- end the loop
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Piston Door Help!
Started by Asaous, 28 July 2014 - 09:31 PMPosted 28 July 2014 - 11:31 PM
Hi so I was writing a bit of code to allow a piston door to be opened and closed from the pc but I keep getting an error and wondered if somebody could help me find the error in the code
Edited by
Posted 29 July 2014 - 12:33 AM
io.read() not read.io(), though you could just use read() instead of io.read()
Edited on 28 July 2014 - 10:34 PM
Posted 29 July 2014 - 12:48 AM
thank you
It says there is an error on line 31 where an = is expected but I can't seem to see where there would be one
It says there is an error on line 31 where an = is expected but I can't seem to see where there would be one
Posted 29 July 2014 - 12:58 AM
Umm, unless that code is out of date, there is only 27 lines.
Posted 29 July 2014 - 01:02 AM
Alright. I would help, but this is a wall of text, and its tough to tell what line is what. Format it, and I'll check it.
Posted 29 July 2014 - 01:11 AM
Heres a formatted (and hopefully working, I only ran through it in my head) version of your code. People will be more willing to help if you use pastebin or hastebin, or if you're going to post it directly, USE CODE TAGS!! Read the forum rules for AaP. It clearly states to use your [code*] and [/code*] tags without the stars.
http://pastebin.com/6KmP1uV3
http://pastebin.com/6KmP1uV3
Edited on 28 July 2014 - 11:11 PM
Posted 29 July 2014 - 01:18 AM
I am now recieving an error on line 32 where it expects an = sign
Posted 29 July 2014 - 01:19 AM
there is no line 32 in the code I provided or in the code you provided us
What is the code for line 32 in your code. just that line
Feel free to join the irc at esper.net in #computercraft and Talk to me about it
What is the code for line 32 in your code. just that line
Feel free to join the irc at esper.net in #computercraft and Talk to me about it
Edited on 28 July 2014 - 11:31 PM
Posted 29 July 2014 - 01:34 AM
'=' expected
When the interpreter throws this error, it means that it was expecting you to reassign a variable to a new value. Check the line number of the error and the line above it, and look for function calls that are missing their parentheses. Be sure to carefully read the code to ensure that you aren't misspelling keywords (like elesif instead of elseif).
When the interpreter throws this error, it means that it was expecting you to reassign a variable to a new value. Check the line number of the error and the line above it, and look for function calls that are missing their parentheses. Be sure to carefully read the code to ensure that you aren't misspelling keywords (like elesif instead of elseif).
Posted 29 July 2014 - 01:38 AM
the line above it is
os.shutdown but there seems to be no errors
Edited on 28 July 2014 - 11:38 PM
Posted 29 July 2014 - 01:39 AM
Can you message me on the IRC so i can understand what you mean
Posted 29 July 2014 - 01:46 AM
pm'ing you now
Posted 29 July 2014 - 01:51 AM
If you carefully read through that paragraph about the error, you would have realized that you forgot the parentheses:
os.shutdown()
Posted 29 July 2014 - 02:06 AM
… I didn't see that?If you carefully read through that paragraph about the error, you would have realized that you forgot the parentheses:os.shutdown()
Posted 29 July 2014 - 03:42 AM
I was referring to Asaous' post.
Posted 29 July 2014 - 03:12 PM
That was just in his post. It was in the code I put though