Posted 19 January 2016 - 01:46 AM
Piclock
Piclock, (a proof-of-concept picture based lock program), allows someone to click 3 [acronym='passcordLocation']locations[/acronym] on a picture of their choosing. Who ever implicates this has the ability to edit the "loggedIn" function (called when the correct [acronym='passcordLocation']locations[/acronym] are clicked/selected), the "incorrectLogin" function (called when the incorrect [acronym='passcordLocation']locations[/acronym] are clicked/selected), the location both the picture is saved and the correct location (which is hashed using Xtansia's String Utility API), and the program's color scheme.
Using Piclock
Running/Using
Spoiler
Run using this: pastebin run ikhdmyMq (Inside another program: shell.run("pastebin","run","ikhdmyMq") )Downloading: pastebin get ikhdmyMq /Piclock (Inside another program: shell.run("pastebin","get","ikhdmyMq","/Piclock") )
There are some arguments you can use when running Piclock.
Piclock new – Calls createLock(), (see createLock() in function list for more info), which allows you to go through the setup process.
Piclock hash – Both prints and returns the saved
Piclock d – Seems to be broken, however should run any other arguments in debug mode.
Piclock fl – Like Piclock d , however, runs any other arguments with quickLogin enabled.
Function list
Spoiler
Local functions:printCentered(msg) – Self explanatory, (allows you to print something in the middle, (center), of the screen).
debugM(msg) – If debug is set to true, this will go ahead and display msg, (you can change the color of this via the color scheme).
setTheme(m) – This will set/reset the general theme of the program, and printCentered m on the top bar; (if m is not set, "Piclock" will be used).
hash(action, hash) – Allows you to store or retrieve the 3 [acronym='passcordLocation']locations[/acronym] hash. (hash("store", "123") will save "123" to the [acronym='passcordLocation']locations[/acronym] file - hash("read") will return the saved [acronym='passcordLocation']locations[/acronym] hash.
grabMouseInput() – This will return the x and y coordinates of a user's click x3. (Waits for the user to click 3 times then returns the 3 x-y coordinates).
createLock() – When called, Piclock will run through the setup process, (creating a new picture and 3 locations). (This is called when either the picture is missing or the [acronym='passcordLocation']locations[/acronym] hash file is missing).
loggedIn() – This is called when the correct coordinates where selected. See here.
Spoiler
The loggedIn function is called once the user click/selects the 3 correct [acronym='passcordLocation']locations[/acronym]. Inside this function you can enable/disable redstone, run another program, etc. Anything you can put into a function will work just fine here. In version 0.5 this function should be located somewhere around line 141, (that is if you didn't already edit anything else in the code).Spoiler
The incorrectLogin function is called once the user click/selects the 3 incorrect [acronym='passcordLocation']locations[/acronym]. Inside this function you can enable/disable redstone, run another program, etc. Anything you can put into a function will work just fine here. In version 0.5 this function should be located somewhere around line 141, (that is if you didn't already edit anything else in the code).Default:
Spoiler
local function incorrectLogin()– Failed to login
setTheme()
print("You've failed to login!")
print("Edit this message and more in the Piclock program.")
sleep(1)
parallel.waitForAny(function() local event, key = os.pullEvent("key") end, function() local event, button, x, y = os.pullEvent( "mouse_click" ) end)
if retryLogin then
main()
end
end
main() – Either calls createLock(), (if there is not a saved picture or [acronym='passcordLocation']locations[/acronym] hash file), or ask the user to select the 3 correct locations on the picture to login. (Gets called first).
Changing Piclock settings
Spoiler
Simply type edit <the location of Piclock (ex: /Piclock)>What do these settings do?
The variable PiclockDir changes the directory of anything Piclock works with, (such as the picture file or [acronym='passcordLocation']locations[/acronym] hash file). Default: ".PicLock" (saves to /.Piclock )
The variable pictureLocation changes the file name of the picture file. Default: ".picture" (saves to /<PiclockDir>/.picture )
The variable passcordLocation changes where the [acronym='passcordLocation']locations[/acronym] hash file is stored. Default: ".cordhash" (saves to /<PiclockDir>/.cordhash )
The variable retryLogin is, by default, used in the incorrectLogin() function to call main() if set to true. Default: true (When the user failed to login using the wrong locations, if the incorrectLogin() is set to the default, main() will be called again after either a mouse click or keyboard input is received.)
The variable quickLogin either bypasses the "Please login." message if set to true, or doesn't. Default: true (Bypasses the "Please login." message).
The variable debug in debugM() and that's it. See debugM() in the functions list for more information.Default: false (Doesn't display debug messages).
The variable StrUtilsLocation is the location Xtansia's String Utility API is saved. (This location is not based off PiclockDir) Default: "/<PiclockDir>/StrUtils" (Saves the API in /<PiclockDir>/StrUtils )
The variable ver isn't used, at all, and does literally nothing. Default: <your Piclock version which is on line 5>
The color scheme
Spoiler
(The variables needed to change the color scheme can be found on line 30-34)These variables can be defined below:

(http://i.imgur.com/MkvZO5t.png)
I hope you find my concept somewhat interesting ;^)
Please note this is a proof-of-concept;(mainly just an interesting idea). I urge you to make changes to this before implicating this into your OS or shiny new lock program.