Posts: 10
Threads: 1
Joined: Dec 2022
Reputation:
0
12-11-2022, 02:06 PM
The following code does the following
prints "*" when entering a password (scratch built) and then return the plaintext back.
Instead it returns a zero and blank text. What did I miss? thanks.
Code: (Select All) Print "-Enter Password: "; pInput$ = silentInput$
Print pInput$ 'DEBUG DELETE AFTER TESTING
Code: (Select All) Function silentInput$
Dim Txt$
Dim KeyPress$
Txt$ = ""
' GREAT FOR PASSWORDS
Do
Do: KeyPress$ = InKey$: Loop Until KeyPress$ > ""
If KeyPress$ <> Chr$(13) Then
Txt$ = Txt$ + KeyPress$
Print "*"; ' crate a visual
End If
Loop Until KeyPress$ = Chr$(13)
Print
silentInput$ = Txt$
End Function
PS, appreciate you guys keeping the qb64 going!! thank you
3 out of 2 people have trouble with fractions
Posts: 82
Threads: 21
Joined: Apr 2022
Reputation:
5
12-11-2022, 02:30 PM
(This post was last modified: 12-11-2022, 02:32 PM by NasaCow.)
Adding a colon will fix it or a new line. Not sure why but it did!
Code: (Select All) PRINT "-Enter Password: ";: pInput$ = silentInput$
or
Code: (Select All) PRINT "-Enter Password: ";
pInput$ = silentInput$
Good luck!
Posts: 10
Threads: 1
Joined: Dec 2022
Reputation:
0
YES! that does work.
And I think I know why.
silentInput$ is a variable and I am still "printing" the var - it would seem to be similar to using
input "some text: ";a$
I think LOL
beuler, beuler??
3 out of 2 people have trouble with fractions
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
Adding the colon is the same as separating the silentInput$ statement from the PRINT statement. So why does it need to be separated? Well, it's because that semi-colon ";" after the PRINT statement is telling PRINT you want to include IF pInput$ = silentInput$ to it. Like Ra7eN figured out, that's a variable comparison expression when it is used that way.
PRINT a = b' That would be false, so it returns zero.
PRINT "Pete" = "Steve" ' That would be false, so it returns zero.
PRINT "Pete" > "Steve" ' Well, that's a story for another time!
So even though it still successfully calls the function, it isn't assigning the string variable pInput$ to the function return, it's comparing the null string pInput$ to the results of the the function. So it will always print "0" unless you just hit Enter without typing, which would return a -1, since a null string and an empty string are the same thing.
Pete
If eggs are brain food, Biden takes his scrambled.
Posts: 1,510
Threads: 53
Joined: Jul 2022
Reputation:
47
12-11-2022, 03:44 PM
(This post was last modified: 12-11-2022, 03:45 PM by mnrvovrfc.)
(12-11-2022, 02:06 PM)Ra7eN Wrote: PS, appreciate you guys keeping the qb64 going!! thank you Welcome to the forums. You made Pete change away from his cowboy clothes into three-piece suit and back. Now let me see if I could remember that Looney Tunes episode... it must have been the "Wentworth" one ROFLMAO.
Wait, but not:
Code: (Select All) PRINT "PETE" > "steve"
???
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
(12-11-2022, 03:44 PM)mnrvovrfc Wrote: (12-11-2022, 02:06 PM)Ra7eN Wrote: PS, appreciate you guys keeping the qb64 going!! thank you Welcome to the forums. You made Pete change away from his cowboy clothes into three-piece suit and back. Now let me see if I could remember that Looney Tunes episode... it must have been the "Wentworth" one ROFLMAO.
Wait, but not:
Code: (Select All) PRINT "PETE" > "steve"
???
Well, apparently another time is here...
I've long said that's a bug in QB64...
First, let's change what you wrote to...
PRINT "pete" > "STEVE"
But wait, that dog won't hunt... "Expected variable required after =..." [Syntax error message].
So we have to go to the extra work and code...
a$ = "Pete"
b$ = "Steve"
PRINT a$ > b$
'output -1
Hey wait. TARNATION, that' still buggy!!!
Pete
Posts: 10
Threads: 1
Joined: Dec 2022
Reputation:
0
MAN I FEEL LIKE A MORON LOL
that ":" was becasue (after a 2nd look) it was a completely different command (assignment)
Im such a ":"
:-D
btw
Im old school, just had to remake an account!
but glad to be back!!
3 out of 2 people have trouble with fractions
Posts: 10
Threads: 1
Joined: Dec 2022
Reputation:
0
(12-11-2022, 05:03 PM)Pete Wrote: (12-11-2022, 03:44 PM)mnrvovrfc Wrote: (12-11-2022, 02:06 PM)Ra7eN Wrote: PS, appreciate you guys keeping the qb64 going!! thank you Welcome to the forums. You made Pete change away from his cowboy clothes into three-piece suit and back. Now let me see if I could remember that Looney Tunes episode... it must have been the "Wentworth" one ROFLMAO.
Wait, but not:
Code: (Select All) PRINT "PETE" > "steve"
???
Well, apparently another time is here...
I've long said that's a bug in QB64...
First, let's change what you wrote to...
PRINT "pete" > "STEVE"
But wait, that dog won't hunt... "Expected variable required after =..." [Syntax error message].
So we have to go to the extra work and code...
a$ = "Pete"
b$ = "Steve"
PRINT a$ > b$
'output -1
Hey wait. TARNATION, that' still buggy!!!
Pete
cant be STEVE=UCASE
pete = LCASE
therefore STEVE > pete :-D
3 out of 2 people have trouble with fractions
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
12-11-2022, 06:01 PM
(This post was last modified: 12-11-2022, 11:23 PM by Pete.)
We do have fun around here. My excuse is I was too much Star Trek, and have a warped sense of humor.
Pete
If eggs are brain food, Biden takes his scrambled.
Posts: 241
Threads: 10
Joined: Apr 2022
Reputation:
30
I never understood the sense of a silent/hidden (or what ever you wanna call) input field.
Simply don't type your password if too many suspicious creatures hanging around you.
And..., if I would be one of those creatures, then I would follow your fingers on the keyboard, so you should better get a keyboard with blank keys instead.
|