Please put every code in a code block or pastebin( I did that now, click
here ). Also saving the password in plain text is not a good idea. This is not protected against CTRL + T. But now to the code fixing(I intended the code, so it is easier to understand):
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.white)
function welcome()
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.white)
rednet.open(left)
This won't work, the correct way would be
rednet.open("left")
Let's go on.
local i = 3
term.setCursorPos(3,1)
print("Welome, please enter the password")
end
function correct()
term.setCursorPos(5,1)
term.setTextColor(colors.lime)
print("Correct! Opening Door!")
rs.setOutput("back", true)
sleep(2)
rs.setOutput("back", false)
welcome()
end
function incorrect()
term.setCursorPos(5,1)
term.setTextColor(color.red)
Also it is colors.red
print(" Incorrect! Try Again!") then
Edit: WHAT? Why did you put a "then" there?
Just remove that.
local i= i-1
This will also have problems, you defined i LOCAL in welcome(), that means it is only accessible in welcome(), you should put the local i = 3 at the beginning of your code and then use
i = i -1
here, you will also need to remove "local i = 3" from welcome
welcome()
if local i == 0 then
Ok, here you put a local before the i, you only need to use local when you first create the variable,
if i == 0 then
would be correct here
term.setCursorPos(7,1)
term.setTextSize(2)
Textsize only exists for monitors, remove that.
print("YOU HAVE FAILED! YOU WILL NOW DIE!")
rednet.broadcast("die")
os.shutdown() --Just a little notice, this will shutdown the computer before you saw the YOU HAVE FAILED! Message, consider adding a sleep()
end
welcome()
input = read()
if input == "Illuminati" then
correct() else
incorrect()
you are missing an
end
here, you need to add that.
Also around the last bit you might want to add this:
while true do
welcome()
input = read()
if input == "Illuminati" then
correct() else
incorrect()
end
end
I am for several reasons not giving you the whole code fixed, apply what I told you to your code, then it will work.
Edited by Luca_S, 06 February 2016 - 10:24 AM.