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

[WARNING: SLOPPY CODE AND GLOBAL VARIABLES] bios:366: [string “startup”]:4: ‘then’ expected where "then" would break the code

Started by pigletx2, 29 March 2014 - 01:13 AM
pigletx2 #1
Posted 29 March 2014 - 02:13 AM
Here is is, pulled from computercraft.

-- The error I am getting is bios:366: [string “startup”]:4: ‘then’ expected, which really makes no sense there to me.
term.clear()
term.setCursorPos(1,1)
if firstpassrun = " "
then
firstpassrun = "y"
end
if
firstpassrun == y
then
term.setBackroundColor(colors.blue)
print("Welcome to PEX password protection.")
print("Please enter a password!")
systpassword1 = " "
systpassword1 = read()
term.clear()
term.setCursorPos(1,1)
term.setBackroundColor(colors.green)
print("Is this your password:")
print(systpassword1)
print("If this is your password, enter y.")
print("If this is not your password, enter anything else.")
local passconfirm = " "
local passconfirm = read()
if
passconfirm == y
then
term.clear()
term.setCursorPos(1,1)
term.setBackroundColor(colors.blue)
print("Now rebooting to set up password protection, please wait...")
firstpassrun = "n"
os.reboot
else
term.clear()
term.setCursorPos(1,1)
term.setBackroundColor(colors.red)
print("Rebooting. Put in the correct password after reboot, please")
os.reboot
end
else
term.clear()
term.setCursorPos(1,1)
term.setBackroundColor(colors.blue)
print("Protected By PEX. Enter the password, please")
local passrelay = " "
if passrelay ~= systpassword1
then
term.clear()
term.setCursorPos(1,1)
term.setBackroundColor(colors.red)
print("WRONG! REBOOTING!")
os.reboot
else
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.cyan)
print("PEXPROTECT-console Version 1")
end
end
Lyqyd #2
Posted 29 March 2014 - 03:35 AM
This error is covered under the Common Errors section of my favorite sticky post. You've got assignment operators in your if statements instead of comparison operators.