Sign in to follow this  
iPSY

ComputerCraft Lock Door

Recommended Posts

Hi ! So i've just made a simple piston secret door design and place a computer has the opening mechanism, for some reason, it keeps giving me "bios:337: [srting "startup"]:11: syntax error.

I've checked line 11 and found nothing wrong in it. Can you guys help me out, maybe im missing something.

Also, wen it did work the first time, it gave me an Error in line 5 saying couldn't reach nil or something like that.

correctpass = "PortalRoom123"

while true do

term.clear()

term.setCursorPos(1,1)

write("Welcome ! Please, enter Password Now: ")

pass = read("*")

if pass == correctpass then

write("Access Granted !")

redstone.setOutput("back",true)

sleep(10)

redstone.setOutput("back",false)

else

write("Access Denied !")

sleep(2)

end

end

Share this post


Link to post
Share on other sites

that actually is useless, just hold ctrl + T, then you can stop the loop. type lua, then use redstone.setOutput("back",true), the door will be opened. lol

Share this post


Link to post
Share on other sites

Im using this in my lan world with my cousin, and he doesn't understand computercraft, so ya, no problem in that.

If i do want to stop the loop, I just need to type this os.pullEvent = os.pullEventRaw at the start of the program, I did my research.

Share this post


Link to post
Share on other sites

that actually is useless, just hold ctrl + T, then you can stop the loop. type lua, then use redstone.setOutput("back",true), the door will be opened. lol

That's why you can put this at the top of the code:

os.pullEvent = os.pullEventRaw

That will only make you able to reboot or restart the computer. Also, I always make a maintenance password in my door locks. If I input it, the loop stops and the PC starts normally, for when I want to edit the password or something.

But people can still open your door with a lever or redstone torch. So what you then do is place the door in such a way that when the door is "closed" according to the game, it's actually open. Then make the computer constantly emit a redstone signal so the door closes, and when you input the password, have the redstone signal temporarily turn off, instead of on.

Im using this in my lan world with my cousin, and he doesn't understand computercraft, so ya, no problem in that.

If i do want to stop the loop, I just need to type this os.pullEvent = os.pullEventRaw at the start of the program, I did my research.

That actually does something completely different, as mentioned earlier in this post. If you want to stop the loop, you'll have to actually assign a variable. Such as "loop = true". Example:

loop = true

 

while loop == true do

input = read()

if input == "password" then

loop = false

else

print("incorrect")

end

end

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this