First of all, when I tried to run it myself, I got an error. But the thing is, not the error you have described. The error was: 25: `<eof>` expected. (It actually gave me this error a few times on different lines.
So, I fixed it:
Spoiler
--If you want this to start at every boot of a computer run the following line of code in the startup
-- shell.run("RFID","door")
--The door stays open as long as you stay in the area of the reader
-- !!! Make sure there is no creeper behind you !!!
-- Set up your own door system
admin = "1"
limit = "11"
--Make sure the following sides are equal to your build
--(Don´t change)
tArgs = {...}
lastTimer = {}
-- Check the arguments given
if #tArgs &lt; 1 then
print("Usage:")
print("RFID write")
print("RFID door")
print("RFID installer")
return
end
mode = tArgs[1]
shell.run("clear")
--Installer
if mode == "installer" then
print("What do you want to install")
print("door or writer")
local input = read()
elseif input == "door" then
print("We are going to save your security level to a password now.")
print("note must be between 0 and 11 and can be a decimal max of 82 Chars")
print("Enter Password now.")
local ps = read()
term.clear()
term.setCursorPos(1,1)
print("What side do you want your Reader on")
local reader = read()
term.clear()
term.setCursorPos(1,1)
print("Now we are going to decide where you want your redstone")
print("Remember the side your reader is on cant be used")
print("Side A")
local sidea = read()
print("Now Side B This Side is only used by the admin card")
local sideb = read()
term.clear()
term.setCursorPos(1,1)
fs.open("startup", "w")
file.write
file.close()
local target = {} -- this is a table
target.ps = ps
target.reader = reader
target.sidea = sidea
target.sideb = sideb
local output = textutils.serialize(target) -- Now we turn table into string
-- now table is saved
local handle = assert(fs.open("vars", "w"), "Couldn't save vars") -- this will give you an error if something's gone wrong
handle.write(output) -- this is where the magic happens, we're storing the entire "target" table
handle.close()
os.reboot()
elseif input == "writer" then
print("What side is you RFID writer on")
local rw = read()
fs.open("writerside", "w")
file.write(rw)
file.close()
fs.open("startup", "w")
file.write("shell.run("RFID, "writer")")
file.close()
os.reboot()
elseif mode == "write" then
h = fs.open("writerside", "r")
local wriside = h.readALL()
h.close()
writer = peripheral.wrap(wriside)
print("What do you the security level on card to be?")
local doorPass = read()
term.clear()
term.setCursorPos(1,1)
print("What do you want the label to be?")
loacal cardLabel = read()
term.clear()
term.setCursorPos(1,1)
print("Enter writing mode")
print("Insert card in the writer")
while not writer.isPresent() do --Waits until a card is in the writer
sleep(0)
end
if writer.encode(doorPass, cardLabel) then --Start write to card
print("Start writing Pass to card")
else --Error handling
if writer.isCoded() then
print("Card is already coded\nInsert a blank card")
elseif #cardLabel &gt; 20 then
print("Card Label is too long max. 20 char")
elseif #doorPass &gt; 82 then
print("Data is too long max. 82 char")
else
print("Leave the card in the writer")
end
return
end
os.pullEvent("rfid_written") --Wait until the card is written
print("RFID card is coded")
print("Take the card out of the writer")
while writer.isCoded() do --Ends the program when the card is taken out of the writer
sleep(0)
end
shell.run("clear")
elseif mode == "door" then
local handle = assert(fs.open("vars", "r"), "Couldn't load vars") -- this file is opened in read mode
local variables = handle.readAll() -- input is now the serialized table
handle.close()
local destination = textutils.unserialize(variables) -- this will decode our table
reader = peripheral.wrap(target.reader)
print("Door Contol is running")
while true do
reader.scan() --Creats an "rfid_detected" when a card is in range
event, p1 = os.pullEvent()
if event == "rfid_detected" then
if (p1 == admin) then
rs.setOutput(target.sidea, true)
rs.setOutput(target.sideb, true)
lastTimer = os.startTimer(1)
elseif (p1 &gt;= target.ps) and not (p1 &gt; limit) then
rs.setOutput(target.sidea, true)
lastTimer = os.startTimer(1)
end
elseif event == "timer" and lastTimer == p1 then
rs.setOutput(target.sidea, false)
rs.setOutput(target.sideb, false)
end
end
end
So lets learn how an if statement is contructed:
if <condition> then
-- Do stuff
elseif <another condition> then
-- Do other stuff
else
-- Do other stuff
end
The else, and the elseif or optional, BUT you must it do it this way if you use them.
So, now to the actual error: 54: `=` expected
Lets go to line 51 - 53 in the code I posted:
fs.open("startup", "w")
file.write
file.close()
Now you do not have anything at the file.write, so lua starts to think its a variable. Which we dont want to do. If you are writing anything to it do it like this:
local file = fs.open("startup","w")
file.write("This is what gets written to the file")
file.close()
After that fix, I got another error: 74:`)` expected
Lets go to line 74:
file.write("shell.run("RFID, "writer")")
I see what you want to do here, you have two different ways of doing this:
file.write("shell.run('RFID, writer')")
file.write("shell.run(\"RFID, writer\")")
Another error: 90: `=` expected
Lets go to line 90:
loacal cardLabel = read()
That is just a typo:
local cardLabel = read()
And we are done! I normally dont ask this, but please hit that green arrow to the right, I have put some time in this :P/>/&gt;
The typing was the worst thing….
Oh, and the code:
Spoiler
--If you want this to start at every boot of a computer run the following line of code in the startup
-- shell.run("RFID","door")
--The door stays open as long as you stay in the area of the reader
-- !!! Make sure there is no creeper behind you !!!
-- Set up your own door system
admin = "1"
limit = "11"
--Make sure the following sides are equal to your build
--(Don´t change)
tArgs = {...}
lastTimer = {}
-- Check the arguments given
if #tArgs &lt; 1 then
print("Usage:")
print("RFID write")
print("RFID door")
print("RFID installer")
return
end
mode = tArgs[1]
shell.run("clear")
--Installer
if mode == "installer" then
print("What do you want to install")
print("door or writer")
local input = read()
elseif input == "door" then
print("We are going to save your security level to a password now.")
print("note must be between 0 and 11 and can be a decimal max of 82 Chars")
print("Enter Password now.")
local ps = read()
term.clear()
term.setCursorPos(1,1)
print("What side do you want your Reader on")
local reader = read()
term.clear()
term.setCursorPos(1,1)
print("Now we are going to decide where you want your redstone")
print("Remember the side your reader is on cant be used")
print("Side A")
local sidea = read()
print("Now Side B This Side is only used by the admin card")
local sideb = read()
term.clear()
term.setCursorPos(1,1)
fs.open("startup", "w")
file.write("")
file.close()
local target = {} -- this is a table
target.ps = ps
target.reader = reader
target.sidea = sidea
target.sideb = sideb
local output = textutils.serialize(target) -- Now we turn table into string
-- now table is saved
local handle = assert(fs.open("vars", "w"), "Couldn't save vars") -- this will give you an error if something's gone wrong
handle.write(output) -- this is where the magic happens, we're storing the entire "target" table
handle.close()
os.reboot()
elseif input == "writer" then
print("What side is you RFID writer on")
local rw = read()
fs.open("writerside", "w")
file.write(rw)
file.close()
fs.open("startup", "w")
file.write("shell.run(\"RFID, writer\")")
file.close()
os.reboot()
elseif mode == "write" then
h = fs.open("writerside", "r")
local wriside = h.readALL()
h.close()
writer = peripheral.wrap(wriside)
print("What do you the security level on card to be?")
local doorPass = read()
term.clear()
term.setCursorPos(1,1)
print("What do you want the label to be?")
local cardLabel = read()
term.clear()
term.setCursorPos(1,1)
print("Enter writing mode")
print("Insert card in the writer")
while not writer.isPresent() do --Waits until a card is in the writer
sleep(0)
end
if writer.encode(doorPass, cardLabel) then --Start write to card
print("Start writing Pass to card")
else --Error handling
if writer.isCoded() then
print("Card is already coded\nInsert a blank card")
elseif #cardLabel &gt; 20 then
print("Card Label is too long max. 20 char")
elseif #doorPass &gt; 82 then
print("Data is too long max. 82 char")
else
print("Leave the card in the writer")
end
return
end
os.pullEvent("rfid_written") --Wait until the card is written
print("RFID card is coded")
print("Take the card out of the writer")
while writer.isCoded() do --Ends the program when the card is taken out of the writer
sleep(0)
end
shell.run("clear")
elseif mode == "door" then
local handle = assert(fs.open("vars", "r"), "Couldn't load vars") -- this file is opened in read mode
local variables = handle.readAll() -- input is now the serialized table
handle.close()
local destination = textutils.unserialize(variables) -- this will decode our table
reader = peripheral.wrap(target.reader)
print("Door Contol is running")
while true do
reader.scan() --Creats an "rfid_detected" when a card is in range
event, p1 = os.pullEvent()
if event == "rfid_detected" then
if (p1 == admin) then
rs.setOutput(target.sidea, true)
rs.setOutput(target.sideb, true)
lastTimer = os.startTimer(1)
elseif (p1 &gt;= target.ps) and not (p1 &gt; limit) then
rs.setOutput(target.sidea, true)
lastTimer = os.startTimer(1)
end
elseif event == "timer" and lastTimer == p1 then
rs.setOutput(target.sidea, false)
rs.setOutput(target.sideb, false)
end
end
end