Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passwords
#1
how would i go about making it so when you type something in, the letters are replaced by a *?

:bounce:
Reply
#2
Use INKEY$.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#3
Code:
CLS
b$ = ""
y = 1

LOCATE y
PRINT "_"

DO
   a$ = ""
   WHILE a$ = ""
      a$ = INKEY$
   WEND

   SELECT CASE a$
      CASE CHR$(13)
         EXIT DO
      CASE CHR$(27)
         b$ = ""
      CASE CHR$(8)
         IF b$ = "" THEN
            BEEP
         ELSE
            b$ = MID$(b$, 1, LEN(b$) - 1)
         END IF
      CASE ELSE
         b$ = b$ + a$
   END SELECT

   LOCATE y
   PRINT STRING$(LEN(b$), "*"); "_"; SPACE$(78 - LEN(b$))
LOOP
Reply
#4
This problem has been done so many times now... I even held a challenge here to simulate a password thing (which I think Meg won with a "matrix" password thing). Check the challenge thread for all the problems you could have with password things, and the solutions people came up with Smile
Reply
#5
flex: Your code only prints the letter typed to make it print '*' you need this
Code:
CLS
b$ = ""
y = 1
DO
    a$ = ""
    WHILE a$ = ""
        a$ = INKEY$
    WEND
    SELECT CASE a$
       CASE CHR$(13)
            EXIT DO
       CASE CHR$(27)
            b$ = ""
        CASE CHR$(8)
            IF b$ = "" THEN
                BEEP
            ELSE
                b$ = MID$(b$, 1, LEN(b$) - 1)
            END IF
        CASE ELSE
            b$ = b$ + "*"
            c$ = c$ + a$
    END SELECT

    LOCATE y: PRINT b$; SPACE$(80 - LEN(b$))
LOOP
PRINT c$
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#6
i edited my code just to add a cursor marker... but come on, if you can't see why my code is fine... then you need some professional help Smile




[Flexibal>
Reply
#7
Quote:i edited my code just to add a cursor marker... but come on, if you can't see why my code is fine... then you need some professional help Smile




[Flexibal>
oh. nvm. yours is still better
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#8
*flattered*
:bounce:





[Flexibal>
Reply
#9
thx
Reply
#10
Here's another one: (submitted to Q-Tech by Zack)

Code:
CLS
PRINT "Enter Password: ";
row = 1
col = 17
LOCATE row, col
DO
press$ = INKEY$
IF press$ <> "" AND press$ <> CHR$(8) THEN
IF press$ = CHR$(13) THEN EXIT DO
LOCATE row, col
PRINT "*";
pswd$ = pswd$ + press$
col = col + 1
LOCATE row, col
END IF
IF press$ = CHR$(8) AND col - 1 >= 17 THEN
a$ = LEFT$(pswd$, LEN(pswd$) - 1)
col = col - 1
LOCATE row, col: PRINT " ";
pswd$ = a$
END IF
LOOP
B 4 EVER
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)