Posted: 24th Sep 2003 6:56
Well I am somewhat a newb...
Been experimenting on stuff and I decided to try out a password thing. Well here it is.

+ Code Snippet
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


You do not need to have any extra files. Just copy and paste what I have here and it will work, or at least should. The password to the one is
please
The buttons do work.

Please comment on what I did. I would like to know if im getting learning progress.

Thanks
Nicolas
Posted: 24th Sep 2003 11:15
pretty good, try and make it so that instead of printing what you write it prints out starts(*) instead.
Posted: 24th Sep 2003 17:21
I would do that except at the moment I have no clue how. I got to figure it out.

Probably easy though.

Nicolas
Posted: 27th Sep 2003 11:23
Heres an encoder you could use with it... (This is not mine, i do not hold responsibility for the effects it may cause)

+ Code Snippet
` *=---------------------------------------------------------------------=*
`
`                     >> Keyword Addition Cipher V0.01 <<
`
`                              By Kevin Picone
`
`                                29,Nov,2001
`
`         (c) copyright 2001, By Kevin Picone, All rights reserved.
`
` *=---------------------------------------------------------------------=*
`
`  So what does this do ?:
`  =======================
`
`   This is a very simple cipher that will allow you to 'scramble' your
` games  private information, so players can't easily cheat, or rip your
` models/gfx/maps off.
`
`
`
`  Release Info:
`  =============
`
`   Your welcome to use this code providing you give credit, or add a link
`  to your site to mine :).. If you add a link, PLEASE TELL ME, and i'll
`  add your link here also.
`
`
`  Cya,
`  Kevin Picone
`  www.uwdesign.50megs.com
`
` *=---------------------------------------------------------------------=*







 sync on

 ` Holds the current encoded string (max of 256 bytes)
  Dim Encode_Buffer(256)


  Keyword$="My Secret password"


  t$="Big humungo balls that sagg like little bitches! HAHAHAHAHA! ha"

  print "Original String:";t$
  print
  print "  Cipher String:";EncodeString(t$,KeyWord$)
  print
  print " Decoded String:";DecodeString(keyword$)

end




` *=---------------------------------------------------------------------=*
`                              Encode String
` *=---------------------------------------------------------------------=*
`
`   This Function encodes a STRING of text, with your KEYWORD.. The encoded
` text, is placed into an array which you can then save, or do whatever
` you wish with..
`
`   Note: You'll need to save elements 0 to length of your encopded string
`  from the array, since the first character (at offest zero) is in fact
`  the length of this encoded string in encoded format.

` *=---------------------------------------------------------------------=*

Function EncodeString(text$,KeyWord$)
   k=1
   ` Encode the strings length
   Encode_Buffer(0)=(len(text$)+asc(mid$(keyword$,k)))&255
    For lp=1 to len(text$)
        inc k
         if k > len(keyword$) then k=1
       Encode_Buffer(lp)=(asc(mid$(text$,lp))+asc(mid$(keyword$,k)))&255
       print chr$(Encode_Buffer(lp));
    next lp
EndFunction



` *=---------------------------------------------------------------------=*
`                              Decode String
` *=---------------------------------------------------------------------=*
`
`   This Function decodes a STRING of scrambled text held in the
` "Encode_Buffer" array.  To decode the string back to it's original state
` you have to supply this function with the correct KEYWORD
`
`   Note: to really use these functions you'll have to modify them to your
`  own personal needs.. But at least it should give an idea of a way to
`  encode/decode data.
`
` *=---------------------------------------------------------------------=*



Function DecodeString(keyword$)
   DecodedString$=""
   k=1
    ` First byte of run is the length
     Bytes=(Encode_Buffer(0)-asc(mid$(keyword$,k)))&255
     For lp=1 to bytes
         inc k
          if k > len(keyword$) then k=1
         c=(Encode_Buffer(lp)-asc(mid$(keyword$,k)))&255
         DecodedString$=DecodedString$+chr$(c)
    next lp
EndFunction DecodedString$
Posted: 27th Sep 2003 20:17
Where would I paste that code into my code to get the results?

Thanks
Nicolas
Posted: 29th Sep 2003 17:50
well, you would make it so the program askes you to set a password first and encode that and save it into an exteranl file...

Then when you ask the user for the password, you can decrypt the saved one and then check that against the input text...

Hope I Helped...
Posted: 1st Oct 2003 2:43
what kind of code does that? If you know how can you give me some code for it. I would like to know but I dont got that kind of experience.

Thanks
Nicolas
Posted: 3rd Oct 2003 1:18
Great looking program! Really neat!
Posted: 6th Oct 2003 23:46
Hi,

This code will encrypt / decrypt a password for you...

encryption("PASSWORD","KEY")

PASSWORD = This is the password you want to encrypt
KEY = This is the key used to encrypt the password. A different key will encrypt the password in a different way.

Hope this helps you!
Posted: 7th Oct 2003 0:16
Forgot to say that the KEY string has to be the same one when you encrypt and decrypt. If you are encrypting a different string then you can use a different KEY.
Posted: 7th Oct 2003 15:16
You might want to change your code slightly ... it would be possible for a value of 256 to be calculated which would convert to the ascii value of zero.

DBPro uses this value to indicate where the string ends, so it is not valid for you to use it in your strings.

+ Code Snippet
rem The following line will be treated as A + emptystring + A
a$=chr$(65) + chr$(0) + chr$(65)
print len(a$) : rem Will print 2
wait key
Posted: 7th Oct 2003 21:38
Is this better?
Posted: 9th Oct 2003 8:37
Actually, if this is a password thingy where you get things in games, such as 1000 free GP or something, you do not need to worry about the asteriks as it does not need to be concealed from prying eyes. Also do not forget to put dims and if...thens to shorten the snippet when you are done... it'll make it easier for me to work with.
-Mathew Larribas
Posted: 10th Oct 2003 1:58
IanM,
The code you gave me I think only works in DBP. I currently have DBC at the moment. If it is for DBC then please explain.

Josh,
Thanks for you help on encrypting it. Havent had a chance to try it yet (been working on other things), but it looks good. Thanks.

Vash the Stampede 815 (a.k.a Homie G),
Not sure if you know what your talking about. I will see you tommorrow so if you read this than tell me at school.

Thanks Guys
Nicolas