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

Script?

Started by uberlux, 05 April 2014 - 02:46 AM
uberlux #1
Posted 05 April 2014 - 04:46 AM
Playing tekkit and getting into the whole computer craft side.
I made a script essentially word-to-word with this tutorial:
https://www.youtube.com/watch?v=PK2YfTM9RY4

did all instructions etc, but my script: for a password door,
Does not start it will say:

bios:206 [string "startup"]:18: '=' expected

So heres the script:
  • term.clear()
  • term.setCursorPose(1,1)
  • os.pullEvent = os.pullEventRaw
  • password = "238"
  • masterpassword = "password238"
  • print("Message1")
  • write "Please Enter Password: "
  • local input = read("*")
  • if input == (password) then
  • print("Password Accepted")
  • redstone.setoutput("Right", true)
  • sleep(5)
  • os.shutdown()
  • elseif input == (masterpassword) then
  • print("Welcome User")
  • sleep(2)
  • print("Terminal Unlcoked, Admin Access Enabled")
  • else
  • print("Password Incorrect - Rebooting")
  • sleep(3)
  • os.shutdown()
  • end
johnneijzen #2
Posted 05 April 2014 - 09:15 AM
Can post full code in pastebin so can i see bit better because i cant see line 18 that was to with =. but i found out that term.setCursorPose is worng it is term.setCursorPos and
redstone.setoutput must be redstone.setOutput because computercraft api is case sensitive


P.S

This sould work

local password = 238
local masterpassword = password238
local userpassword = *

term.clear(()
term.setCursorPos(1,1)
os.pullEvent = os.pullEventRaw
print("Please Enter Password")
input = read("*")
userpassword = input
if userpassword == password then
  print("Password Accepted")
  redstone.setOutput("right", true)
  sleep(5)
  os.shutdown()
elseif input == masterpassword then
  print("Welcome User")
  sleep(2)
  print("Terminal Unlcoked, Admin Access Enabled")
else
  print("Password Incorrect - Rebooting")
  sleep(3)
  os.shutdown()
end
Edited on 05 April 2014 - 05:44 PM
Bomb Bloke #3
Posted 05 April 2014 - 09:18 AM
Can't see anything in there that would trigger that error, making me wonder if this is an exact copy of the script you're running. You're not accidentally saving it to a different file, are you?

"term.setCursorPose" should be "term.setCursorPos".
RoD #4
Posted 05 April 2014 - 02:15 PM
and btw you dont need
if userpass == (pass)
you can get rid ot the curly brackets.