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

Problem With Some Code

Started by Ty Ethan Sayahi, 15 June 2016 - 12:16 AM
Ty Ethan Sayahi #1
Posted 15 June 2016 - 02:16 AM
So I am attempting to use an advanced computer to password lock a door.
I googled how to do it and I found this article " http://computercraft..._Protected_Door "
This is the code I wrote using the article

os.pullEvent = os.pullEventRaw
while true do
term.clear()
term.setCursorPos(1, 1)
print("Please Enter Password:")
input = read("*")
if input == "password" then
  redstone.setOutput("back", true)
  sleep(2)
  redstone.setOutput("back", false)
end
end
My problem with this is when I put it as my startup I get this error on the reboot
" bios:14: [string "startup"]:6: unexpected symbol"
I do not know any lua so I cannot fix this code because I dont know what it is saying…..
If anyone can help that would be great!
Bomb Bloke #2
Posted 15 June 2016 - 02:35 AM
The code you've got here won't produce that error, to my eyes - double check that it matches what you've actually got written in the startup file. The error's telling you that you either didn't complete line five correctly, or you've got a mistake within line six.
apemanzilla #3
Posted 15 June 2016 - 03:42 AM
The code you have here seems to be running properly. Are you sure that's exactly what you have?
Ty Ethan Sayahi #4
Posted 15 June 2016 - 06:11 PM
The code you have here seems to be running properly. Are you sure that's exactly what you have?

Hmm…. I tried typing it 3 times however maybe I was doing something wrong. I will do it again and see if I get the same error.

It turns out that I didn't indent a few lines. Now the code runs just fine. Thanks for your help. Next time I will be sure to properly indent.

I also accidentally did not correctly type a few lines I just noticed.