Posted 21 December 2012 - 04:22 PM
Solved
I'm trying to get some local boolean variables working., but it's giving me an error,
Here's the code:
When I start up the computer (It's a startup program), I get the following:
I'm very new to programming, and through some Google searching I didn't seem to find anything (Maybe I just didn't look hard enough). Adding 'then' to the end of the mentioned line still gives the same error. Trying to use a global variable instead doesn't affect it either. I'm sure it's a very amateur mistake.
I'm trying to get some local boolean variables working., but it's giving me an error,
Here's the code:
term.clear()
term.setCursorPos(1,1)
print("Scanning peripherals...")
if peripheral.isPresent("left") then
if peripheral.getType("left") == "monitor" then
local monitorcheck = true
monitor = peripheral.wrap("left")
elseif peripheral.getType("left") == "modem" then
local modemcheck = true
modem = peripheral.wrap("left")
end
end
if peripheral.isPresent("top") then
if peripheral.getType("top") -- "monitor" then
local monitorcheck = true
monitor = peripheral.wrap("top")
elseif peripheral.getType("top") == "modem" then
local modemcheck = true
modem = peripheral.wrap("top")
end
end
if monitorcheck == true then
print("Attaching monitor...")
sleep(0.4)
end
if modemcheck == true then
print("Attaching modem...")
sleep(0.4)
end
print("Setting up login process...")
sleep(0.4)
term.clear()
term.setCursorPos(1,1)
shell.run("disk/password")
shell.run("disk/login")
When I start up the computer (It's a startup program), I get the following:
CraftOS 1.4
bios:206: [string "startup"]:15: 'then' expected
>
I'm very new to programming, and through some Google searching I didn't seem to find anything (Maybe I just didn't look hard enough). Adding 'then' to the end of the mentioned line still gives the same error. Trying to use a global variable instead doesn't affect it either. I'm sure it's a very amateur mistake.