17 posts
Posted 15 December 2012 - 07:19 PM
This is the error message im getting:
> startup
bios:206: [string "startup"]:16: '<name>'
expected
Heres the code
os.pullEvent = os.pullEventRaw
local side="Back"
local password = "Password123"
local opentime = 3
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Correct")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Incorrect Password")
sleep(5)
os.reboot()
end
1619 posts
Posted 15 December 2012 - 07:23 PM
Lua is case-sensitive. Use "back", instead of " Back"
On a side note, when calling functions, remember he format is one.twoThreeFour().
Watch your shift button :P/>/>
17 posts
Posted 15 December 2012 - 07:35 PM
This is the error message im getting:
> startup
bios:206: [string "startup"]:16: '<name>'
expected
Heres the code
os.pullEvent = os.pullEventRaw
local side="Back"
local password = "Password123"
local opentime = 3
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Correct")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Incorrect Password")
sleep(5)
os.reboot()
end
is now this
os.pullEvent = os.pullEventRaw
local side="back"
local password = "Password123"
local opentime = 3
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Correct")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Incorrect Password")
sleep(5)
os.reboot()
end
and i am still getting that error message
8543 posts
Posted 15 December 2012 - 08:05 PM
Moved to Ask a Pro.
767 posts
Posted 15 December 2012 - 08:24 PM
I cant post any code, before i 've tested your code. So ASAP i will test, and post a full code for you..
or if yo dont want to make the whole program yourself, look into "programs" section
:D/>
7508 posts
Location
Australia
Posted 15 December 2012 - 08:27 PM
This is the error message im getting:
> startup
bios:206: [string "startup"]:16: '<name>'
expected
Heres the code
os.pullEvent = os.pullEventRaw
local side="Back"
local password = "Password123"
local opentime = 3
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Correct")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Incorrect Password")
sleep(5)
os.reboot()
end
is now this
os.pullEvent = os.pullEventRaw
local side="back"
local password = "Password123"
local opentime = 3
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Correct")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Incorrect Password")
sleep(5)
os.reboot()
end
and i am still getting that error message
maybe try redstone.setOutput instead of rs.setOutput
shouldnt be an issue. but give it a try.
767 posts
Posted 15 December 2012 - 09:59 PM
Well.. when i test it with CCEMU everything works fine… my code is:
Spoiler
local oldDog = os.pullEvent
os.pullEvent = os.pullEventRaw
local side = "back"
local password = "Password123"
local opentime = 3
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Correct")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Incorrect Password")
sleep(5)
os.reboot()
end
os.pullEvent = oldDog
7508 posts
Location
Australia
Posted 15 December 2012 - 10:01 PM
Well.. when i test it with CCEMU everything works fine… my code is:
Spoiler
local oldDog = os.pullEvent
os.pullEvent = os.pullEventRaw
local side = "back"
local password = "Password123"
local opentime = 3
term.clear()
term.setCursorPos(1,1)
write("Password:")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Correct")
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Incorrect Password")
sleep(5)
os.reboot()
end
os.pullEvent = oldDog
yeh nothing looks wrong there.
767 posts
Posted 15 December 2012 - 10:06 PM
and it cant cause a wrong version, because all CC versions had theese function/apis…. :D/>
but if it still does not work, then reinstall CC :D/> that could be the problem.. but i dont think it is.
17 posts
Posted 16 December 2012 - 02:23 AM
with your code i get this error now
> startup
bios:206: [string "startup"]:17: '<name>'
expected
767 posts
Posted 16 December 2012 - 02:39 AM
are you sure, your Computercraft is installed correct? because i do not find any errors, testing it…
and, did you edit your BIOS file?
i know, i should not do this, but:
you can test my AdvLock… there are NOT any errors, when i test it.. so if it still causes errors, during my AdvLock, then your Computercraft must be configured wrong…
2088 posts
Location
South Africa
Posted 16 December 2012 - 04:12 AM
with your code i get this error now
> startup
bios:206: [string "startup"]:17: '<name>'
expected
So you get this error from copying straight from what he has? You didn't change a thing?
34 posts
Posted 16 December 2012 - 04:14 AM
os.pullEvent = os.pullEventRaw
pass = "open"
print ("Enter password to open door.")
input = read("*")
if input == pass then
shell.run("clear")
print ("Access Granted")
redstone.setOutput("left", true)
sleep(3)
os.reboot()
else
print ("Incorrect password!")
sleep(1)
shell.run("clear")
shell.run("open")
end
1619 posts
Posted 16 December 2012 - 04:28 AM
You haven't overwritten any variables, right? That's the only thing I can think of that could be wrong. Break the computer and place it again.
17 posts
Posted 16 December 2012 - 06:05 PM
ok got it to work but it didnt open the door, if the redstone is at the back of the door should (side,true) (side,false) be (back,true) (back,false)?
7508 posts
Location
Australia
Posted 16 December 2012 - 06:16 PM
yes the side parameter should be a string that is either "left" "right" "front" "back" "top" "bottom"
17 posts
Posted 17 December 2012 - 03:45 AM
so does the local side apply to the location of the redstone to the computer or the door
7508 posts
Location
Australia
Posted 17 December 2012 - 04:08 AM
oh sorry I forgot you had a variable called side, i thought u had just got that off the API page. in that case the string stored in the side variable will apply, as long as its lowercase and one of the ones stated before.
18 posts
Posted 17 December 2012 - 04:46 AM
Isnt the problem here:
local side="Back"
Doesnt it need to be wrote like this:
local side = "back"
17 posts
Posted 17 December 2012 - 05:23 AM
but
does the local side apply to the location of the redstone to the computer or the door
eg
redstone is behind the computer but not the door, also if you want to come and code it for me im more then happy to give you the server details