Code fix
#4
If I'm understanding the problem correctly, this should achieve the desired effect.

Code: (Select All)
PRINT "Enter a digit"
K$ = "": F$ = ""
DO
    F$ = INKEY$
    IF F$ <> "" THEN
        IF F$ = CHR$(13) THEN
            F$ = "7"
        ELSE
            IF INSTR("0123456", F$) THEN F$ = MID$("0123456", INSTR("0123456", F$), 1) ELSE F$ = ""
        END IF
        K$ = K$ + F$
    END IF
    _LIMIT 30
LOOP UNTIL LEN(F$) <> 0
T# = VAL(K$): PRINT T#


and if you need the escape and spacebar options...

Code: (Select All)
PRINT "Enter a digit"
K$ = "": F$ = ""
DO
    F$ = INKEY$
    IF F$ <> "" THEN
        IF F$ = CHR$(13) THEN
            F$ = "7"
        ELSEIF F$ = CHR$(27) THEN
            GOTO escape
        ELSEIF F$ = CHR$(32) THEN
            GOTO spacebar
        ELSE
            IF INSTR("0123456", F$) THEN F$ = MID$("0123456", INSTR("0123456", F$), 1) ELSE F$ = ""
        END IF
        K$ = K$ + F$
    END IF
    _LIMIT 30
LOOP UNTIL LEN(F$) <> 0
T# = VAL(K$): PRINT T#
END

escape:
'do whatever escape is supposed to do
spacebar:
'do whatever the spacebar is supposed to do
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply


Messages In This Thread
Code fix - by Chris - 11-06-2022, 11:51 AM
RE: Code fix - by OldMoses - 11-06-2022, 12:24 PM
RE: Code fix - by mnrvovrfc - 11-06-2022, 12:50 PM
RE: Code fix - by OldMoses - 11-06-2022, 12:55 PM
RE: Code fix - by SMcNeill - 11-06-2022, 12:59 PM
RE: Code fix - by OldMoses - 11-06-2022, 01:11 PM
RE: Code fix - by SMcNeill - 11-06-2022, 01:20 PM
RE: Code fix - by Chris - 11-06-2022, 01:09 PM
RE: Code fix - by SMcNeill - 11-06-2022, 01:27 PM
RE: Code fix - by Dimster - 11-06-2022, 01:42 PM
RE: Code fix - by SMcNeill - 11-06-2022, 02:09 PM
RE: Code fix - by mnrvovrfc - 11-06-2022, 02:46 PM
RE: Code fix - by SMcNeill - 11-06-2022, 03:19 PM
RE: Code fix - by Dimster - 11-06-2022, 02:53 PM
RE: Code fix - by Pete - 11-06-2022, 06:21 PM
RE: Code fix - by Kernelpanic - 11-06-2022, 09:43 PM



Users browsing this thread: 2 Guest(s)