Jump to content
  • Advertisement
Sign in to follow this  
Lumpyspud

Blitz Basic question?

This topic is 4487 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to make a small little password and username verification program and well it works for numbers but it doesnt for words can someone help me? Here is the code: .loopbegin Username = Input$("Username: ") Password = Input$("Password: ") If Username = 123 And Password= 123 Then Print "Welcome" Else Print "Wrong Password and Username try agean" Delay 2000 Goto loopbegin EndIf WaitKey ______ What is suppose to happen is that if the password and username is right then it will display the text Welcome if rong it will display the text Wrong Password and username try agean and then go back to the log in text. Like i said this will only work for numbers can someone please help me?

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure how variables and data types work in Blitz, but I'm assuming its like PHP (whatever its called when you don't need to specify data type).

If that's how it works, then you'll need quotes '"' before and after the string you want it to match.


If Username = 123 And Password= 123 Then
Print "Welcome"


Should be


If Username = "usernamehere" And Password = "passwordhere" Then
Print "Welcome"

Share this post


Link to post
Share on other sites
That is what my dad said to do and i get a differnt effect instead of no matter what you put in for username and password it printing "welcome" it will print "Wrong Password and Username try agean" for any username and password. But i have just dound that it will work currectly with a Username of Words and a password of numbers.

Share this post


Link to post
Share on other sites
I'm not sure about blitz basic, but in most languages the comparison operator for equals is "==" not "=". That could cause problems as well.

So in addition to the poster above it should probably look like :



If Username == "usernamehere" And Password == "passwordhere" Then
Print "Welcome"

Share this post


Link to post
Share on other sites
Quote:
Original post by EricmBrown
I'm not sure about blitz basic, but in most languages the comparison operator for equals is "==" not "=". That could cause problems as well.

So in addition to the poster above it should probably look like :



If Username == "usernamehere" And Password == "passwordhere" Then
Print "Welcome"


That isn't the case in any BASIC flavor I've used... The quotes should be required, though.

Share this post


Link to post
Share on other sites

Goto loopbegin ;Call the sub.
.loopbegin
Username$ = Input("Username: ")
Password$ = Input("Password: ")
If Username$ = "123" And Password$ = "123" Then
Print "Welcome"
Else
Print "Wrong Password and Username try agean"
Delay 2000
Goto loopbegin
EndIf
Return ;To return the sub
WaitKey


In BB you need to show data types. $ = string, # = float, % = int. Also, end the sub... its been a while since I used BB but I still got it in me.

[Edited by - Narcis on April 4, 2006 1:13:46 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!