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

Keycard door system?

Started by MysteryManX93, 18 October 2012 - 01:15 AM
MysteryManX93 #1
Posted 18 October 2012 - 03:15 AM
I'm new to CC, and I would like to know if someone could help me make a system where a user pops a floppy disk into a Disk Drive, verify's the disk, and opens a door.

:3
Noodle #2
Posted 18 October 2012 - 03:18 AM
Here
passkey = "PASSWORD"
while true do
  if disk.isPresent("SIDE") then -- Put side to the side the disk drive is on
    h = fs.open("disk/passcode", "r")
    if h.readAll() == passkey then
      print("Accepted")
      -- Insert anything here for the code, rs.setOutput() whatever..
    else
      print("Denied")
      disk.eject("side") -- Replace side with diskdrive side
    end
  end
end
MysteryManX93 #3
Posted 18 October 2012 - 04:11 AM
Here
passkey = "PASSWORD"
while true do
  if disk.isPresent("SIDE") then -- Put side to the side the disk drive is on
	h = fs.open("disk/passcode", "r")
	if h.readAll() == passkey then
	  print("Accepted")
	  -- Insert anything here for the code, rs.setOutput() whatever..
	else
	  print("Denied")
	  disk.eject("side") -- Replace side with diskdrive side
	end
  end
end
Awesome! Do I edit this on the Computer startup, or on the disk?


also, do I have to format how it is you sent me?
Edited on 18 October 2012 - 02:18 AM
ChaddJackson12 #4
Posted 18 October 2012 - 05:16 PM
Lol, I have made one of these… :P/>/> Feel free to check out the code to see how it works if you like. :)/>/> Here is the link to the thread.