Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

skyzo63

Members
  • Content Count

    6
  • Joined

  • Last visited

Reputation Activity

  1. Like
    skyzo63 reacted to Molinko in control door piston   
    The issue is within the checkPassword function definition. Change the '&' symbol to the 'and' keyword. This should resolve the current error.
  2. Upvote
    skyzo63 reacted to SpaceBeeGaming in control door piston   
    This should do what you want. I didn't test it so it may not work. Just reply with the error message if it doesn't work.
    local component = require("component") local r = component.redstone local term = require("term") local text = require("text") ---- config section local password = { pw_open = "openMe", pw_close = "closeMe" } local side = 5 --side of the door ----- local open = false local input_password local function checkPassword(i_password) if (i_password == password.pw_open & open == false) then return true elseif (i_password == password.pw_close & open == true) then return true else return false end end term.clear() while true do print("Please enter the password:") input_password = text.trim(term.read({pwchar = "*"}) or "") if (checkPassword(input_password)) then if (open == true) then -- Close the door if open. print("Closing the door.") r.setOutput(side, 15) else -- Open the door if closed. print("Opening the door.") r.setOutput(side, 0) end else print("Password was wrong, try again") end end
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.