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

bios:337: [string "startup"]:54: '<eof> ' expected

Started by tipton775, 24 December 2013 - 10:35 AM
tipton775 #1
Posted 24 December 2013 - 11:35 AM
My code:

if fs.exists("log") then
space = (fs.getSize("log"))
logtime = (os.time())
correctpassword = "codered"
pin = "0759"
local input = read("*")
write("What is the current situation? ")
if input == (correctpassword) then
print("Comfirming Password")
sleep(1.5)
print("Granted, Security Level 1.0")
term.clear()
redstone.setOutput("right", true)
sleep(0.5)
write("Loading")
sleep(0.3)
write("|")
sleep(0.3)
write("|")
sleep(0.3)
write("|")
sleep(0.3)
write("|")
sleep(0.3)
write("|")
print(" ")
end
term.clear()
print("Opening Security Door")
print("Access Denied")
print("Needed Security Level 2.0")
write("Enter pin: ")
input = read("#")
  term.clear()
  if input == (pin) then
  print("Loading")
  sleep(0.2)
  write(".")
  sleep(0.2)
  write(".")
  sleep(0.2)
  write(".")
  sleep("1")
  term.clear()
  print("Access granted. Security Level 2.0")
  print("Security Door opening.")
  redstone.setOutput("bottom", true)
  sleep(5)
  redstone.setOutput("bottom", false)
  sleep(60)
  os.shutdown()
end
  else
  write("Access Denied. Your attempt is beening logged...")
  local file = fs.open("log", "a")
  file.write("Attempt at:"..logtime)
  file.close()
  print("Attempt Logged.")
  print("Log file space:"..space)
  sleep(5)
  os.shutdown()
end
elseif input == "editit" then
write("Launching editing mode...")
print(" ")
end

And/ or http://pastebin.com/NCpCJrQm

I am getting the error "bios:337: [string "startup"]:54: '<eof> ' " But i can't seem to find out the reason why? I don't know why it's happening either.
Edited on 24 December 2013 - 11:49 AM
Lyqyd #2
Posted 24 December 2013 - 12:27 PM
It's if/else/end, not if/end/else/end
tipton775 #3
Posted 24 December 2013 - 12:36 PM
It's if/else/end, not if/end/else/end

Could you edit the script with annotations so i have an idea on what you are talking about, thanks.
awsmazinggenius #4
Posted 24 December 2013 - 01:08 PM
Umm, have you read the "Read This Post Before Asking Questions?" sticky, in this section? Will edit post with fixed program, but seriously. Within the past week or so, I have seen a serious increase in questions that could be answered with that one sticky post. And would you like to consider indenting your code in the future? Things get messy, fast.

[namedspoiler="EDIT: Fixed Code]
[code]
if fs.exists("log") then
space = (fs.getSize("log"))
logtime = (os.time())
correctpassword = "codered"
pin = "0759"
local input = read("*")
write("What is the current situation? ")
if input == (correctpassword) then
print("Comfirming Password")
sleep(1.5)
print("Granted, Security Level 1.0")
term.clear()
redstone.setOutput("right", true)
sleep(0.5)
write("Loading")
sleep(0.3)
write("|") –# There is textutils.slowPrint(), you know.
sleep(0.3)
write("|")
sleep(0.3)
write("|")
sleep(0.3)
write("|")
sleep(0.3)
write("|")
print(" ")
end
term.clear()
print("Opening Security Door")
print("Access Denied")
print("Needed Security Level 2.0")
write("Enter pin: ")
input = read("#")
term.clear()
if input == (pin) then
print("Loading")
sleep(0.2)
write(".") –# Again, textutils.slowPrint()
sleep(0.2)
write(".")
sleep(0.2)
write(".")
sleep("1")
term.clear()
print("Access granted. Security Level 2.0")
print("Security Door opening.")
redstone.setOutput("bottom", true)
sleep(5)
redstone.setOutput("bottom", false)
sleep(60)
os.shutdown()
else
write("Access Denied. Your attempt is beening logged…")
local file = fs.open("log", "a")
file.write("Attempt at:"..logtime)
file.close()
print("Attempt Logged.")
print("Log file space:"..space)
sleep(5)
os.shutdown()
end
elseif input == "editit" then
write("Launching editing mode…")
print(" ")
end

By the way, all I did was fixed your else statement and indented. You may have other errors; I did not run this code.
Edited on 24 December 2013 - 12:15 PM