Just Wondering??

Blitz3D Forums/Blitz3D Beginners Area/Just Wondering??

W
 #1
Hey guys, I was just looking over some of the coding I wrote as a beginner in 2004, and I came across a program that was unfinished and didn't work correctly at all. I attempted, back then, to compare a variable string to the users input to verify that their input was the passoword. But it didn't work and I am not sure as to exactly why, so just for fun could someone explain on it a little for me?

;here's the code
Graphics 800,600,16,1
SetBuffer BackBuffer()

Global welcome$ ="Welcome User..."
Global passrequest$ = "Password Please...."
Global angrypassrequest$ = "Try Again..Password Please..."
Global angrypassrequest1$ = "No..No..WRONG...THE PASSWORD IS...?"
Global finalangrypassrequest2$ = "Just Give UP Your Obviously not user..."
Global done = 0
Global attempts% = 0
Global rite$ = "4hale06"

Print welcome$

While Not done = 1


Inputer()

CheckPass()



Ender()


Wend 
End 

Function CheckPass()

If answer$ = rite$
	Print "Welcome Master Anthony, You are God!!!!!!!!!"
	Delay 5000
	done = 1
EndIf
If answer$ <> rite$ 
	attempts% = attempts% + 1
	Print "Sorry Try Again...."  
EndIf  
End Function 

Function Inputer()

If attempts% = 0
	answer$ = Input$(passrequest$)
	Print "password is " + rite$
ElseIf attempts% = 1
	answer$ = Input$(angrypassrequest$)
ElseIf attempts% = 2
	answer$ = Input$(angrypassrequest1$)
ElseIf attempts% = 3
	answer$ = Input$(finalangrypassrequest2$)
EndIf 

End Function 



Function Ender()

If attempts% > 3
	done = 1
EndIf 

End Function 


,thanks for any replies guys!

You didn't define answer$ as global. From inside the Inputer function, it gets assigned a value, but once you leave the function, answer$ does not exist, and so a new variable answer$ starts out as Nil (ie =""), and so would never equal rite$ (unless rite$ also equalled Nil)

Hi W
Looks like you need to add " Global answer$ " to the bottom of your globals list.
take care

Gnu

lol nevermind.

Gnu

Is nevermind related the neverwinter RPG? :)

Never played Neverwinter. It's what I tell my wife when I say too much ;)

Gnu

Never played Neverwinter? Aarrgghh! Great game!

I lost many friends to Everquest many years ago... Never to be heard from again. Not going to touch a mmorph for a long time ;)

Regards
Gnu

Neverwinter Nights can be played in single player mode as well as online.