Posted 26 March 2013 - 10:03 PM
Hello guys ! Here's a little program I've made, it's really easy to use and to setup.
The program difficulty is "low-leveled". Almost anyone having screwed around ComputerCraft may know how it works.
Alright, here's the code. Feel free to edit and/or redistribute the program, please leave me credits though. ^_^/>
If you notice any error in the code, or things to be upgraded, please report to me, as I will review your change and see if it changes something. Thanks :)/>
Have fun on ComputerCraft !
Take a look at those persons, they helped me making the program safer, and more stablish ! :D/>
- svdragster
- GravityScore (A little)
- Engineer
The program difficulty is "low-leveled". Almost anyone having screwed around ComputerCraft may know how it works.
Alright, here's the code. Feel free to edit and/or redistribute the program, please leave me credits though. ^_^/>
-- Cabriolaile's login program v1.0
-- Author: Vortex
-- Program type: Computer, 1.5, security
-- Version: 1.0
-- Language used: Lua
while true do
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
if term.isColor then
term.setTextColor(colors.blue)
end
print("CraftOS Login v1.0 by Vortex")
if term.isColor then
term.setTextColor(colors.white)
end
print("Please identify yourself.")
local user="Steve" -- Replace it with your username
local pass="Password" -- Replace it with your own password.
term.setCursorPos(3,4)
write("Username: ")
term.setCursorPos(3,5)
write("Password: ")
term.setCursorPos(5,7)
write("Username: ")
input=read()
if input == user then
term.setCursorPos(3,4)
term.clearLine()
write("Username: "..user)
term.setCursorPos(5,7)
term.clearLine()
write("Password: ")
input=read("*")
-- input=read()
if input == pass then
term.setCursorPos(3,5)
term.clearLine()
write("Password: [hidden]")
-- write("Password: "..pass)
term.setCursorPos(5,7)
if term.isColor then
term.setTextColor(colors.lime)
end
write("Password correct! Access granted!")
sleep(2)
term.setCursorPos(1,1)
term.clear()
else
term.setCursorPos(3,7)
term.clearLine()
if term.isColor then
term.setTextColor(colors.red)
end
write("Password not correct. Access denied!")
sleep(2)
end
else
term.setCursorPos(5,7)
term.clearLine()
if term.isColor then
term.setTextColor(colors.red)
end
write("User doesn't exist! Access denied!")
sleep(2)
end
end
If you notice any error in the code, or things to be upgraded, please report to me, as I will review your change and see if it changes something. Thanks :)/>
Have fun on ComputerCraft !
Take a look at those persons, they helped me making the program safer, and more stablish ! :D/>
Spoiler
Persons who helped me fixing the program:- svdragster
- GravityScore (A little)
- Engineer