Posted 23 November 2012 - 05:46 AM
i made a program to open and close a vault door and i get a " bios:338: [string "startup"]:25: '=' expected ". the code
os.pullEvent = os.pullEventRaw
local side = "left" -- Change left to whatever side your door / redstone is on, E.G: left, right, front, back, bottom, top. Be sure to leave the "s around it, though
local password = "owncod1811" -- Change bacon to what you want your password to be. Be sure to leave the "s around it though
local exitk = 14
local close = false
local opentime = 4 -- Change 5 to how long (in seconds) you want the redstone current to be on. Don't put "s around it though
while true do
term.clear() -- Clears the screen
term.setCursorPos(1,1) -- Fixes the cursor position
write("Password: ") -- Prints 'Password: ' to the screen
local input = read("=") -- Makes the variable 'input' have the contents of what the user types in the "=" part censors out the password
if input == password then -- Checks if the user inputted the correct password
term.clear() -- Already explained up top
term.setCursorPos(1,1)
print("Password correct!") -- Prints Password correct! to the screen
rs.setOutput(side,true) -- Output a redstone current to the side you specified
print("press BACKSPACE to close!")
while close == false do
local p1 = os.pullEvent("key")
if p1 == exitk then
rs.setOutput(side,false) -- Stop outputting a redstone current
close = true
reboot
else then
end
end
elseif input == "debugultrasecurity" then -- checks if the user inputted the code to debug the program
break -- breaks the program
else -- Checks if the user didn't input the correct password
print("Password incorrect!") -- Prints 'Password incorrect!' to the screen
sleep(2) -- Waits 2 seconds
end
end
sry for all the comments ;)/>/>