TGC Codebase Backup



Password Protect by The Lone Programmer

23rd Sep 2003 23:31
Summary

An organized password box. Correct password equals continue and wrong password equals fail.



Description

When you execute the code I made it will ask to type in the password. The password I set as default is please.
If you type the right password it will take you to where you have set and if you get the password wrong you can either re-type it or cancel.

Works as stand alone. No extra files needed.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    correct_pass$="Click To Enter"
wrong_pass$="Password Wrong. Click Here To Try Again"
no_menu$="NO"
yes1_menu$="YES"

x=238
y=238

x1=238
y1=238

x2=340
y2=280

x3=240
y3=280

w=text width(correct_pass$)
h=text height(correct_pass$)

w1=text width(wrong_pass$)
h1=text height(wrong_pass$)

w2=text width(no_menu$)
h2=text height(no_menu$)

w3=text width(yes1_menu$)
h3=text height(yes1_menu$)


pass_start:
rem background for menu
Ink 400000,0
BOX 123,216,500,325

rem make menu raw
Ink 5000000,0

`left line
Line 125,325,125,217
Line 124,325,124,217
Line 123,325,123,217

`right line
Line 500,325,500,217
Line 499,325,499,217
Line 498,325,498,217

`middle line
Line 123,216.6,500,216.6
Line 123,217.6,500,217.6
Line 123,218.6,500,218.6

`bottom line
Line 123,325,500,325
Line 123,326,500,326
Line 123,327,500,327

` Text on Menu
Ink 999999999999999999999999999999,0
Perform checklist for fonts
Set text size 20
Set text font "Abaddon"
Text 190,230,"What Is The Correct Password?"

`note that the password is case sensitive
realPassword$="please"
set cursor 250,275
input "*";userPassword$
if realPassword$=userPassword$ then goto correct_pass else goto wrong_pass



` Goto and What happens on mouseclick
wrong_pass:
cls
rem background for menu
Ink 400000,0
BOX 123,216,500,325

rem make menu raw
Ink 5000000,0

`left line
Line 125,325,125,217
Line 124,325,124,217
Line 123,325,123,217

`right line
Line 500,325,500,217
Line 499,325,499,217
Line 498,325,498,217

`middle line
Line 123,216.6,500,216.6
Line 123,217.6,500,217.6
Line 123,218.6,500,218.6

`bottom line
Line 123,325,500,325
Line 123,326,500,326
Line 123,327,500,327

do
` Text on Menu
Ink 999999999999999999999999999999,0
Perform checklist for fonts
Set text size 20
Set text font "Abaddon"
Text 160,230,"Password Incorrect!  Re-Type Password?"

` If Yes is Clicked
if mousex()>=x3 and mousex()<=x3+w3 and mousey()>=y3 and mousey()<=y3+h3
      ink rgb(0,232,0),0
      rollover=2
      if mouseclick()=1 then goto pass_start
   else
  ink rgb(255,255,255),0
      rollover=1
   endif
   text x3,y3,yes1_menu$

` If No is Clicked
if mousex()>=x2 and mousex()<=x2+w2 and mousey()>=y2 and mousey()<=y2+h2
      ink rgb(0,232,0),0
      rollover=2
      if mouseclick()=1 then end
   else
  ink rgb(255,255,255),0
      rollover=1
   endif
   text x2,y2,no_menu$
loop
end


` Goto and What happens on mouseclick
correct_pass:
cls

rem background for menu
Ink 400000,0
BOX 123,216,500,325

rem make menu raw
Ink 5000000,0

`left line
Line 125,325,125,217
Line 124,325,124,217
Line 123,325,123,217

`right line
Line 500,325,500,217
Line 499,325,499,217
Line 498,325,498,217

`middle line
Line 123,216.6,500,216.6
Line 123,217.6,500,217.6
Line 123,218.6,500,218.6

`bottom line
Line 123,325,500,325
Line 123,326,500,326
Line 123,327,500,327

do
` Text on Menu
Ink 999999999999999999999999999999,0
Perform checklist for fonts
Set text size 20
Set text font "Abaddon"
Text 135,230,"Password Correct!  Do You Want To Continue?"
Text 240,280,"YES"

` If No is Clicked
if mousex()>=x2 and mousex()<=x2+w2 and mousey()>=y2 and mousey()<=y2+h2
      ink rgb(0,232,0),0
      rollover=2
      if mouseclick()=1 then end
   else
  ink rgb(255,255,255),0
      rollover=1
   endif
   text x2,y2,no_menu$
loop
end