76 posts
Location
Death City
Posted 08 September 2012 - 02:43 PM
So I am making a program to record how many times my door has tried to be opened with a wrong password,but I get this error:This is my code:
os.pullEvent = os.pullEventRaw
function PrintDoors()
x = x + 1
print("Failed Opening Attempts:(..x..)")
end
if rs.getInput("bottom") then
PrintDoors()
end
Help?
160 posts
Location
Netherlands
Posted 08 September 2012 - 02:51 PM
It says you are missing 'then' on line 7.
if rs.getInput("bottom")
should be:
if rs.getInput("bottom") then
209 posts
Location
In your fridge.
Posted 08 September 2012 - 02:52 PM
if statements must have a "then" at the end, telling Lua you are done entering parameters. It should be
if rs.getInput("bottom") then
PrintDoors()
end
A simple mistake.
76 posts
Location
Death City
Posted 08 September 2012 - 02:55 PM
It says you are missing 'then' on line 7.
if rs.getInput("bottom")
should be:
if rs.getInput("bottom") then
Thank you that did work,
but now my other code doesn't work:
os.pullEvent = os.pullEventRaw
print("X-Cor:DoorLock")
print("Passcode Required For Entry")
x = io.read()
if x == "xcor" then
print("Passcode Correct!")
redstone.setOutput("left", true)
sleep(2.5)
redstone.setOutput("left", false)
os.reboot()
else
print("Passcode Incorrect!")
redpulse top 1 1
sleep(1)
os.reboot()
end
Here is the error:
Line 13 '=' expected
(It doesnt say this exactly i just broke it down)
and in the redpulse help function it doesnt say that you need ()'s or ""'s
Help Again?
209 posts
Location
In your fridge.
Posted 08 September 2012 - 02:58 PM
It's redpulse("top", 1, 1) you need to add the parenthesis, signalling a function call. I may have gotten the syntax wrong, but you NEED parenthesis.
160 posts
Location
Netherlands
Posted 08 September 2012 - 03:50 PM
redpulse top 1 1
Needs to be
redpulse("top", 1, 1)