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

| Door lock / KeyCard System Assistance Needed

Started by MelethrilHD, 25 July 2014 - 01:39 PM
MelethrilHD #1
Posted 25 July 2014 - 03:39 PM
Okay - So the story is, that I put the door lock program on a Floppy Disk labelled "Shop Entrance Card" as a startup program on that Floppy Disk. But, I wish to be able to make it so that when the Computer is accessed without the FloppyDisk in the Disk Drive, that it'll be inaccessible with a print message saying stuff like "Please enter the floppy disk labelled Shop Entrance Key" and then when put into the disk drive, it'll boot up the startup from the disk drive and allow the user to continue. I'm quite new to ComputerCraft, or well - I haven't done it in so long that I decided to try a door lock system in a different way and remember it all off the top of my head as I'm not one to remember code easily. The problem is not with the code, the problem is to how to do what I stated.

For anyone who really wishes to see my password lock code on said Floppy Disk, I can provide it if it does help.
Thanks a lot CC Community!
- MelethrilHD
Lyqyd #2
Posted 25 July 2014 - 04:05 PM
You'd want to have the computer's startup be something like:


os.pullEvent = os.pullEventRaw
print("Please insert floppy disk and reboot")
sleep(3)
os.shutdown()

Of course, this can be bypassed by any floppy disk with a startup file, not just your specific program.
MelethrilHD #3
Posted 25 July 2014 - 06:25 PM
Yeah. I understand that, which is why I'm leaving it like that to see how far people are willing to go for a shop with reduced prices + higher sell prices. I love a little bit of the whole finding out that someone has used another startup disk then telling them off about it :P/>
Thank's Lyq, didn't think it'd be THAT simple providing that there were other pullEvents revolving around the disk.