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

Program Debug [Error] [Lua]

Started by sithlordtom2, 15 June 2012 - 02:31 AM
sithlordtom2 #1
Posted 15 June 2012 - 04:31 AM
I am running a program, but when it runs, it gives the error:
bios:206: [string "Vault"]:44: '=' expected
But, at that line, it is the end of the program, which the code is:

local password = 6/14/2012
local username = keoir
local shutdown = shutdown
local reset = reset
local on = on
local reboot = reboot
write = "Username:"
local input = read("*")
if input == ("username") then
else
write = "Username not found"
sleep(2)
os.reboot()
end
write = "Password:"
local input = read("*")
if input == ("password") then
print = "Welcome!"
sleep(2)
print = "The system is currently:"
rs.testBundledInput(bottom, colors.orange)
print = "Please input what you would like to do:"
local input = read()
if input == ("shutdown") then
rs.setBundledOutput(bottom, colors.orange)
sleep(2)
print = "Shutdown!"
elseif input == ("reset") then
rs.setBundledOutput(bottom, colors.white)
sleep(2)
rs.setBundledOutput(bottom, colors.white)
sleep(2)
print = "Reset!"
elseif input == ("on") then
rs.setBundledOuput(bottom, colors.orange)
sleep(2)
print = "Turned on!"
elseif input == ("reboot") then
os.reboot()
else
print = "Wrong!"
sleep(2)
os.reboot
--end

Any help would be nice.
BigSHinyToys #2
Posted 15 June 2012 - 08:49 AM
I have made a lot of corrections look through your code and mine take note of the differences. especial how i use strings and how print() and write() are used correctly.
Spoiler

local password = "6/14/2012"
local username = "keoir"
write ("Username: ")
local input = read("*")
if input == username then
else
    write ("Username not found")
    sleep(2)
    os.reboot()
end
write ("Password: ")
local input = read("*")
if input == password then
    print ("Welcome!")
    sleep(2)
    print ("The system is currently: ")
    rs.testBundledInput("bottom", colors.orange)
    print ("Please input what you would like to do:")
    local input = read()
    if input == "shutdown" then
	    rs.setBundledOutput("bottom", colors.orange)
	    sleep(2)
	    print ("Shutdown!")
    elseif input == "reset" then
	    rs.setBundledOutput("bottom", colors.white)
	    sleep(2)
	    rs.setBundledOutput("bottom", colors.white)
	    sleep(2)
	    print ("Reset!")
    elseif input == "on" then
	    rs.setBundledOuput("bottom", colors.orange)
	    sleep(2)
	    print ("Turned on!")
    elseif input == "reboot" then
	    os.reboot()
    else
	    print ("Wrong!")
	    sleep(2)
	    os.reboot()
    end
end