Jump to content

Recommended Posts

Posted (edited)

Hello guys,

 

I'm working on a small project and I got stuck.. It is about Computercraft. I know this isn't the right place to ask for help. (Hoping that somebody here knows a thing or two about Computercraft & is willing to help out)

Here's what I'm working on and what I'd like to achieve:

 

fVLFv8z.png

 

I got a computer on right side and I'd like to have constant redstone signal on top (for the red lights) -> "no go / closed air lock doors"

And when I right click on it, it asks for the launch permission password, if you enter the correct password it sends a redstone signal on the bottom block for 40 seconds which then lights up the green lights and opens up the air lock frame.

After 40 seconds it reboots/restarts.

 

And this is what I wrote so far, of course it doesn't work, hence why I seek for help :/

("edit startup")

while true do
rs.setOutput("top",true)
print("Enter the launch password: ")
password = read()
if password == "blabla" then
print("Launch sequence has been initiated!")
rs.setOutput("top",false)
rs.setOutput("bottom",true)
sleep(40)
rs.setOutput("bottom",false)
os.shutdown()
end

Any help is appreciated and once again I apologize for posting here.

 

-kind regards-

 

Gomo

 

 

EDIT: Got the problem solved.

 

Here's the code for those who want something similar.

rs.setOutput("top",true)
rs.setOutput("bottom",false)

while true do
        print("Enter the launch password: ")
        password = read("*")
        
        if password == "blabla" then
                print("nLaunch sequence has been initiated!")
                rs.setOutput("top",false)
                rs.setOutput("bottom",true)
                sleep(40)
                rs.setOutput("bottom",false)
                rs.setOutput("top",true)
                print("Launch sequence complete.")
        else
                print("nInvalid password.")
        end
        
        sleep(3)
        term.clear()
        term.setCursorPos(1,1)
end

 

Edited by Gomo

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.

×
×
  • Create New...