Well Im currently have a script as follows
Rem Re: Project: Password that works
Rem ***** Main Source File *****
`*********************************************************************************************
INITIALISE=0 : Rem Set INITIALISE to 1 if you want to start with a new user and login.dat file
: Rem Remember to reset it back to 0 on your second run
`*********************************************************************************************
FILENAME$="login.dat"
If INITIALISE=1 and File Exist(FILENAME$)
Delete File FILENAME$
EndIf
Rem Hide Mouse and make writing colour a bright green on black background
Hide Mouse : Ink RGB(0,255,0),0
Sync On
Rem A function that will type all your messages to screen like a typewriter
Rem You were unnecessarily using too many string variables and lines of code to repeat the same thing over and over
Rem This is the perfect example of what a Function really comes in handy for:
_TypeWriterEffect("Attempting to find server...",2.5)
_TypewriterEffect("Phoenix Server found. Attempting to connect...",2)
_TypeWriterEffect("Connection OK...Booting Operating System...",1.5)
rem "operating system" setup
`Ink RGB(255,255,255),1s 0 :
Ink RGB(0,255,0),1 : Box 0,0,635,50
Ink RGB(0,0,0),1 : Box 3,3,632,47
Ink RGB(0,255,0),0
_TypewriterEffect("Phoenix Server Remote Login",2)
Rem Username/Password Access
Rem Re: "this is where I want new code to go but I keep getting errors"
Rem I'm changed the code accordingly, here:
Rem Checking for the logfile, if it exists, then user must match the Username and password stored in the file
Rem Otherwise, user is treated as a new user and can input new codes
USERNAME$="" : PASSWORD$=""
USER$="" : PASS$=""
If File Exist(FILENAME$)
_TypewriterEffect("Please wait, accessing security files...",2)
Open To Read 1,FILENAME$
Read String 1,USERNAME$
Read String 1,PASSWORD$
Close File 1
_TypewriterEffect("Done...",1)
` Print USERNAME$
` Print PASSWORD$
Rem User must enter his original name and password
Rem This looks crap on screen using Input, so make a function to type each individual character on screen and check user input via other means
Repeat
Set Cursor 250,100 : Input "User Name: ",USER$
Set cursor 250,150 : Input "Password: ",PASS$
Cls
Until USER$=USERNAME$ And PASS$=PASSWORD$
Else
_TypewriterEffect("New User, please enter your details...",0)
Rem Here you would create a new user
Rem because there is no log file, so it must be his first time
Rem This looks crap on screen using Input, so make a function to type each individual character on screen and check user input via other means
Repeat
Set Cursor 250,100 : Input "User Name: ",USER$
Set cursor 250,150 : Input "Password: ",PASS$
Cls
Until USER$<>USERNAME$ And PASS$<>PASSWORD$
_TypewriterEffect("Please wait, creating new security files...",2)
Open To Write 1,FILENAME$
Write String 1,USER$ : Rem Make Sure I save thew users new input and not USERNAME$ which will be different
Write String 1,PASS$ : Rem The same with with PASS$, don't write PASSWORD$ here accidentally
Close File 1
_TypewriterEffect("Done...",1)
Rem Now copy strings held in tempory variables to the ones you'll be using in the rest of your program
Rem As I assume you will want to stick with using USERNAME$ and PASSWORD$ rather than USER$ and PASS$
USERNAME$=USER$ : PASSWORD$=PASS$
EndIf
_TypeWriterEffect(USERNAME$+" Logged in.",1)
Ink rgb(0,255,0),1
_TypeWriterEffect("Welcome "+USERNAME$+".",0)
_TypeWriterEffect("You are now being re-directed to User Control",1.5)
_TypeWriterEffect("Welcome Agent. You have been chosen due to your expertise in this field.",0)
_TypeWriterEffect("You are required to gather company information by any means neccessary.",0)
_TypeWriterEffect("Are you ready?",0)
Wait 1000
Set Cursor 300,100 : _TypeWriterEffect("(Y)es",0)
Repeat
Until Scancode()=28 or (Inkey$()="Y" or Inkey$()="y")
Rem If I send an empty string, with a small REFRESH setting, to my function, it will clear the screen immediately
Rem However, this is just another example of the flexibility of Functions
Rem To optimize my code, it's better to simply call "CLS : Sync" here instead
_TypeWriterEffect("",0.001)
_TypeWriterEffect("Example finished, terminating Program...",1)
Rem Tidy Up : Returning DBPro to how I found it
Sync Off
End
Function _TypeWriterEffect(MESSAGE$,REFRESH#)
Rem Set REFRESH# to >0 if you want the MESSAGE$ deleted after a delay
For T=1 to Len(MESSAGE$)
If T=Len(MESSAGE$)
Print Mid$(MESSAGE$,T) : Rem Allows Print to start a new line once the whole of MESSAGE$ has been printed
Else
Print Mid$(MESSAGE$,T);
EndIf
Rem You could play a typewriter sound effect here
Sync : Wait 10 : Rem Change Waits value to speed or slow down typing here
Next T
If REFRESH#>0
Wait REFRESH#*1000 : CLS : Sync
EndIf
EndFunction
But ass soon as it gets to the part where it asks for the password I would Like either a little window to appear in the top right of the screen which looks like a password cracker. or to have a button which will do the same thing. I have an Idea of what I want the Cracker to look Like but dont know how to do it. I can email it to you if you want.
Windows XP Home 2.53 GHz 512 Meg RAM Darkbasic Pro Patched