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

Numeric PIN Pad

Started by Cranium, 07 December 2012 - 10:00 AM
Cranium #1
Posted 07 December 2012 - 11:00 AM
Just a little fun program, to bolster the forums' endless stock of computer locks. This however, has a twist.
I have created a system for using a PIN pad, to identify the user. The program is configurable for use as OS protection, as well as for use as a door lock.

Configuration is done by editing the first part of the program. By default, it will be used as an OS lock.
The program will immediately ask you to create a 4 digit Personal Identifying Number. The only one you cannot use is '0, 0, 0, 0', as that is the default code.

This is a program for use with mouse control ONLY.
Let me know what you think of the program, as well as suggestions below.

Screenshot:


Download: http://pastebin.com/fF5DnUQj
Edited on 15 December 2012 - 11:44 AM
Kingdaro #2
Posted 07 December 2012 - 11:09 AM
This is really cool, haha.

EDIT: Hope you don't mind, I made an alternate scanning animation: http://pastebin.com/GNZT79Nt

The math took a bit of figuring out :lol:/>
Cranium #3
Posted 08 December 2012 - 09:51 AM
This is really cool, haha.

EDIT: Hope you don't mind, I made an alternate scanning animation: http://pastebin.com/GNZT79Nt

The math took a bit of figuring out :lol:/>
Ooooh, I really like that. It looks really nice.
How would you make that scan vertically?
Kingdaro #4
Posted 08 December 2012 - 10:03 AM
You would probably have to do some backwards logic. Instead of starting at 1 and going to width + height, go the other way around.

for i=width + height, 1, -1 do
Cranium #5
Posted 08 December 2012 - 10:13 AM
Eh, tried it. Just goes right to left. Oh well…
Kingdaro #6
Posted 08 December 2012 - 10:33 AM
Just figured it out. New animation function:

local function scanAnim(color)
	local offsetx, offsety = 24, 5
	local width, height = #scanner[1], #scanner
	
	for i=width + height, 1, -1 do
		for y=i, 1, -1 do
			x = width - (i - y) + 1
			if x >= 1
			and y <= height then
				term.setCursorPos(x + offsetx ,y + offsety)
				term.setBackgroundColor(color)
				term.setTextColor(colors.gray)
				write(scanner[y]:sub(x,x))
			end
		end
		sleep(0.05)
	end
end
Cranium #7
Posted 15 December 2012 - 12:45 PM
Updated OP with screenshot and corrected error with door locks opening too early.
Sammich Lord #8
Posted 15 December 2012 - 01:21 PM
I actually never thought of this style of lock. Pretty cool.
jb567 #9
Posted 23 December 2012 - 05:17 PM
This will be awesome with touch screen monitors :P/>
lieudusty #10
Posted 26 December 2012 - 05:54 PM
This looks awesome!
remiX #11
Posted 27 December 2012 - 04:50 AM
Random but cool :D/>
Togira #12
Posted 29 December 2012 - 09:43 AM
it dont use with advenced monitors. it chose always 3 numbers as one.
sorry for my bad english im german
HotGirlEAN #13
Posted 29 December 2012 - 10:08 AM
This is awesome! Keep up the good work Cranium!
todry #14
Posted 05 January 2013 - 05:27 PM
Can you make one without colour please.
1lann #15
Posted 05 January 2013 - 06:55 PM
Can you make one without colour please.
Wouldn't that be pretty useless since non-color computers don't have touch screens?
Fizzgigg #16
Posted 05 January 2013 - 07:18 PM
That looks epic!
I will be looking at this
Cranium #17
Posted 06 January 2013 - 07:42 AM
Can you make one without colour please.
Why would I make one without color? Like 1Lann said, non color computers can't use this.
todry #18
Posted 13 January 2013 - 05:49 PM
Why would I make one without color? Like 1Lann said, non color computers can't use this.
for people that like you pin pad style but just want a simple door/OS lock.
Cranium #19
Posted 13 January 2013 - 08:07 PM
for people that like you pin pad style but just want a simple door/OS lock.
The problem with that is non advanced computers do not have mouse support. You would only be able to use your keypad. I don't feel like changing the whole program just to cater to them.
theoriginalbit #20
Posted 13 January 2013 - 08:17 PM
for people that like you pin pad style but just want a simple door/OS lock.
The problem with that is non advanced computers do not have mouse support. You would only be able to use your keypad. I don't feel like changing the whole program just to cater to them.
just have an optional runtime arg that runs it in ascii mode… but still only on an advanced computer…

EDIT: Btw I really like this! :D/> Should expand it to use the touchscreen :)/>
Edited on 13 January 2013 - 07:18 PM
Cranium #21
Posted 13 January 2013 - 08:19 PM
just have an optional runtime arg that runs it in ascii mode… but still only on an advanced computer…

EDIT: Btw I really like this! :D/> Should expand it to use the touchscreen :)/>
I just might do that. I have other projects on my head though, so I probably won't get to it for a while.
theoriginalbit #22
Posted 13 January 2013 - 08:20 PM
I just might do that. I have other projects on my head though, so I probably won't get to it for a while.
Fair enough…. I still have heaps of projects in my head too, still typing up the updates on the post of my load bar api…
spyman68 #23
Posted 05 March 2013 - 11:01 AM
Could I use this is the OS I'm making?
Cranium #24
Posted 05 March 2013 - 03:19 PM
I'm gonna start saying no to these types of requests. I don't make these so that people can take credit for them. So no.
BaconHawk101 #25
Posted 06 March 2013 - 01:42 PM
Cool program
gijsvdsande #26
Posted 23 March 2013 - 06:51 AM
may i use is for my os?
Resioku #27
Posted 04 February 2018 - 10:05 AM
So im kind of a rookie to this, where would I put the program to open my gui after unlocking this?
Bomb Bloke #28
Posted 04 February 2018 - 11:48 AM
The PIN script is written to end when you get the right code, so the idea is to make a startup script that first loads the PIN pad, and then loads your OS.

shell.run("pinpad")
shell.run("yourOS")

Or you could just make your OS the startup script, and add a call to the pinpad as the first line within that.