If you get any error message ALLWAYS post it. Also, put your code in [
code]Your code here[/
code] tags. Read documentation about functions you use in your code, in this case
os.time(). Indent your code.
Your error message is probably something like this:
<your file name>:11: '=' expectedCode in code tags look like this:
This text is in code tags
You can find documentation about all CC APIs and their functions
here.
A tutorial for indentation can be found in
Read This Post Before Asking Questions topic.
And now your code:
redstone.setOutput("left", true)
correctpassword = "codered"
pin = "0759"
write("What is the current situation? ")
logtime = (os.time) --// os.time is a function so you should call it. Also, you don't have to use parenthesis around os.time
--// Should be
logtime = os.time()
local input = read("*")
if input == (correctpassword) then --// Could be this instead: (But it's your own choice if you want them or not)
if input == correctpassword then
write("Password correct!")
goto --// There is no 'goto' in Lua 5.1
redstone.setOutput("right", true) then --// I don't think that this 'then' should be here
sleep(5)
redstone.setOutput("right", false)
elseif input == "editit" then
write("Launching editing mode...")
write("")
elseif input == (correctpassword) then --// You check if your password was correct above, so this code will never run
write "Are you sure? Enter pin "
if input == (pin) then
write("Access granted.")
redstone.setOutput("bottom", true)
else
write("Incorrect! Your attempt has been logged...")
local file = fs.open("log", "w")
file.write("Last attempt")
file.write(logtime)
end --// I also think that this 'end' shouldn't be here
file.close()
print("Logged.")
sleep(5)
os.shutdown()
end
You're lucky because I'm in a good mood, but next time
Read This Post Before Asking Questions.
Note to Lygyd: Fix BBCode in
this post.
Here is what I see