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

password app code

Started by oasis9, 30 October 2012 - 06:48 AM
oasis9 #1
Posted 30 October 2012 - 07:48 AM
This didn't work out.
In the forum.
The PC works great!


Code:

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1, 3)
print " OASIS9'S"
print " CINEMA"
print " SYSTEMS"
term.setCursorPos(10, 10)
print "******************************"
term.setCursorPos(10, 11)
print "* WARNING! *"
term.setCursorPos(10, 12)
print "* ———- *"
term.setCursorPos(10, 13)
print "* HACKING THIS SYSTEM IS *"
term.setCursorPos(10, 14)
print "* PUNISHABLE BY DEATH AND *"
term.setCursorPos(10, 15)
print "* LOSS OF YOUR VALUABLES! *"
term.setCursorPos(10, 16)
print "******************************"
term.setCursorPos(15, 18)
write "Enter Password: "
local password = "kittens"
local input = read"*"
if input == password then
term.clear()
term.setCursorPos(1, 1)
print "Access Granted"
sleep(3)
term.clear()
term.setCursorPos(1, 1)
else
term.clear()
term.setCursorPos(1, 1)
print "Access Denied"
sleep(3)
print "Restarting…"
sleep(3)
os.reboot()
end


Output will be:




OASIS9'S
CINEMA
SYSTEMS


*******************************************************************
* WARNING! *
* ————— *
* HACKING THIS SYSTEM IS *
* PUNISHABLE BY DEATH *
* AND LOSS OF YOUR *
* VALUABLES! *
********************************************************************

ENTER PASSWORD: _

***************************************
IF INPUT IS CORRECT THEN
***************************************
Access Granted

***************************************
WAITS THREE SECONDS THEN
***************************************
> _

***************************************
IF INPUT IS INCORRECT THEN
***************************************
Access Denied

***************************************
WAITS THREE SECONDS THEN
***************************************
Access Denied
Restarting…

***************************************
WAITS THREE SECONDS THEN
***************************************
*PC IS RESTARTED*
remiX #2
Posted 30 October 2012 - 11:06 AM
Use code tags please :P/>/> And if you use print, you don't have to use term.setCursorPos(x,y) because printing will make it go onto the next line anyway.
ChunLing #3
Posted 30 October 2012 - 07:30 PM
Never warn unauthorized users that the wrong password will spring a deathtrap. Deathtraps are only effective when they are a surprise.
zekesonxx #4
Posted 30 October 2012 - 08:02 PM
Agreed with ChunLing and sldEklck_.

Also what is with all the caps? IT IS REALLY ANNOYING TO READ THINGS WRITTEN IN CAPS
DarkCoder #5
Posted 04 November 2012 - 10:22 AM
I think this is a quite good idea. (Layout etc.) However with that said you shouldnt tell them if they will die :D/>/>
Madster #6
Posted 19 February 2013 - 07:46 PM
Basic, and good program. Also, I would do as remiX had suggested. ;)/>


Use code tags please :)/>/> And if you use print, you don't have to use term.setCursorPos(x,y) because printing will make it go onto the next line anyway.
superaxander #7
Posted 28 February 2013 - 04:59 AM
I dont think This is a tutorial is it?
oeed #8
Posted 28 February 2013 - 10:06 AM
I dont think This is a tutorial is it?

Nope.
Cruor #9
Posted 28 February 2013 - 10:14 AM
Moved to programs sub forum.
SuicidalSTDz #10
Posted 28 February 2013 - 11:02 AM
There are already soo many lock programs…. "Make Mario in CC", said GravityScore. I for one agree with him ;)/>. Oh well, looks nice (The layout that is). Oh and please use code tags and a spoiler…

Spoiler
This looks much nicer!
zekesonxx #11
Posted 28 February 2013 - 11:08 AM
Stop necromancing.
SuicidalSTDz #12
Posted 28 February 2013 - 03:15 PM
Stop necromancing.
Who is necromancing? I saw this for the first time today. Just posting my feelers. Oh well. It'll just get locked like every other outdated thread.