Jump to content




Password door help!



  • You cannot reply to this topic
20 replies to this topic

#1 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 12:23 PM

I'm getting this message when I try to use my code for password locked doors.
bios:206: [ string "lock" :5: ')' expected
Here is the code I am using
print ('PASSWORD REQUIRED')
name = read()
if name == ('Aperture') then
redstone.setOutput ('right', true)
print ('ACCESS GRANTED')
sleep(5)
redstone.setOutput ('right', false)
else
print ('ACCESS DENIED')
end

Please help!
[EDIT: I'm using the tekkit modpack.]

Edited by blueflames7, 29 September 2012 - 12:39 PM.


#2 Doyle3694

  • Members
  • 815 posts

Posted 29 September 2012 - 12:29 PM

redstone.setOutput ('right, false) is wrong.
redstone.setOutput ('right', false) is correct

#3 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 12:32 PM

View PostDoyle3694, on 29 September 2012 - 12:29 PM, said:

redstone.setOutput ('right, false) is wrong.
redstone.setOutput ('right', false) is correct
I'm a complete noob, but I don't see a difference.

Wait, I see it. Thanks!

#4 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 12:35 PM

Now I'm getting a new error :/
bios:206: [string "lock"] :5: unfinished string


#5 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 12:37 PM

Wait, I went backwords. I'll fix it now.

Actually that mistake you said was a typo on the forums, not in the code.

#6 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 12:38 PM

Now I'm back to the original error, any more ideas?

#7 Doyle3694

  • Members
  • 815 posts

Posted 29 September 2012 - 12:53 PM

put your code up to pastebin and I can take a look.

#8 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 12:54 PM

http://pastebin.com/MGKNkJx3

#9 Doyle3694

  • Members
  • 815 posts

Posted 29 September 2012 - 12:54 PM

anotehr bug:
if name == ('Aperture') then WRONG
if name == 'Aperture' then CORRECT

#10 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 12:59 PM

I'm getting the same error........ WHY COMPUTERCRAFT WHY!!!!!!!!
bios:206: [ string "lock" :5: ')' expected


#11 Doyle3694

  • Members
  • 815 posts

Posted 29 September 2012 - 01:05 PM

test this code:
local password = "hellu"

while true do
textutils.slowPrint("Password required to enter")
textutils.slowPrint("Please enter password below")
passwordRead = read("*")
if passwordRead == password then
   textutils.slowPrint("Access Granted")
   redstone.setOutput("right", true)
   sleep(5)
   redstone.setOutput("right", false)
else
   textutils.slowPrint("Access Denied")
end
end


#12 Doyle3694

  • Members
  • 815 posts

Posted 29 September 2012 - 01:07 PM

oh and also
there is spaces between your functions and your parameters. that is messing stuff up.

#13 NIN3

  • New Members
  • 57 posts
  • LocationEverywhere.

Posted 29 September 2012 - 01:08 PM

Well, As far as I know, there can be no space bettween print and the ()
print ('PASSWORD REQUIRED') is wrong
print('PASSWORD REQUIRED') is right

Also, doesnt it have to be "lol" instead of 'lol'?

#14 Doyle3694

  • Members
  • 815 posts

Posted 29 September 2012 - 01:10 PM

'' and "" can be used however you want. but if you try to use like a quote in your print, then you use ''. and if you're trying to type don't in a print then use ""

#15 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 01:39 PM

View PostDoyle3694, on 29 September 2012 - 01:05 PM, said:

test this code:
local password = "hellu"

while true do
textutils.slowPrint("Password required to enter")
textutils.slowPrint("Please enter password below")
passwordRead = read("*")
if passwordRead == password then
   textutils.slowPrint("Access Granted")
   redstone.setOutput("right", true)
   sleep(5)
   redstone.setOutput("right", false)
else
   textutils.slowPrint("Access Denied")
end
end
startup:4: attempt to index ? (a nil value)
Thats the error I get.

View Postblueflames7, on 29 September 2012 - 01:38 PM, said:

View PostDoyle3694, on 29 September 2012 - 01:05 PM, said:

test this code:
local password = "hellu"

while true do
textutils.slowPrint("Password required to enter")
textutils.slowPrint("Please enter password below")
passwordRead = read("*")
if passwordRead == password then
   textutils.slowPrint("Access Granted")
   redstone.setOutput("right", true)
   sleep(5)
   redstone.setOutput("right", false)
else
   textutils.slowPrint("Access Denied")
end
end
startup:4: attempt to index ? (a nil value)
Thats the error I get.
All I changed was the local password to Aperture.

#16 Doyle3694

  • Members
  • 815 posts

Posted 29 September 2012 - 02:01 PM

test changing all textutils.slowPrint's to print. Don't know if textutils work in 1.33

local password = "hellu"

while true do
print("Password required to enter")
print("Please enter password below")
passwordRead = read("*")
if passwordRead == password then
   print("Access Granted")
   rs.setOutput("right", true)
   sleep(5)
   rs.setOutput("right", false)
else
   print("Access Denied")
end
end


#17 blueflames7

  • New Members
  • 19 posts

Posted 29 September 2012 - 02:10 PM

k

#18 filipkwro

  • Members
  • 21 posts
  • LocationPoland (in Europe)

Posted 29 September 2012 - 02:21 PM

This should work.

local password = "Aperture"

while true do
print("Password required to enter")
print("Please enter password below")
local passwordRead = read("*")
if passwordRead == password then
print("Access Granted")
rs.setOutput("right", true)
sleep(5)
rs.setOutput("right", false)
else
print("Access Denied")
sleep(2)
os.shutdown()
end
end

View PostNIN3, on 29 September 2012 - 01:08 PM, said:

Well, As far as I know, there can be no space bettween print and the ()
There can be a space. One time i did:
print							    ("lol")
and it was no error, it just printed lol.

Anyway, wrong section. The thread should be in "Ask a Pro".

#19 Doyle3694

  • Members
  • 815 posts

Posted 29 September 2012 - 02:54 PM

ehrm.... why os.shutdown in a while true loop? really? that's just unnesssesary.

#20 DSlink2010

  • Members
  • 50 posts

Posted 30 September 2012 - 10:52 PM

View Postfilipkwro, on 29 September 2012 - 02:21 PM, said:

Anyway, wrong section. The thread should be in "Ask a Pro".
Yeah, I just reported it to be moved :)/>





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users