Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PAUSE not working (*solved*)
#9
Sure. During the INPUT prompt, enter a character, then delete it and you'll see the cursor jump up to the line above.
Code:
#include <input.bas>
DIM ans AS Integer
DIM scoreToWin AS uByte

FUNCTION userInputFN(inputXPos AS uByte, prompt AS String, default AS Byte, ansMaxLen AS uByte, ansMinVal AS Byte, ansMaxVal AS Byte) AS Integer
    Prompt:
    PRINT AT 23,inputXPos; prompt; " [";default;"]: ";
    INK 1
    answer$=INPUT(ansMaxLen)
    INK 0
    'String checks
    IF answer$="" THEN
        ans=default
    ELSE
        FOR n=0 TO (LEN answer$)-1
            IF CODE answer$(n)<45 OR CODE answer$(n)>57 THEN
                PRINT AT 23,inputXPos; "Entry error",,
                PAUSE 50
                GO TO Prompt:
            END IF
        NEXT n
        'Checks passed, convert to value
        ans=INT(VAL(answer$))
    END IF
    IF ans<ansMinVal THEN ans=ansMinVal: PRINT AT 23,0; "Constrained to min",: PAUSE 50
    IF ans>ansMaxVal THEN ans=ansMaxVal: PRINT AT 23,0; "Constrained to max",: PAUSE 50
    PRINT AT 23,0;,,
    RETURN ans
END FUNCTION

scoreToWin=5
scoreToWin=userInputFN(0, "Score to win match (1-9)", scoreToWin, 1, 1, 9)
PRINT scoreToWin

I just tried beta 1.14 in Mac OS and it doesn't seem to have fixed the INPUT/PAUSE issue. The code I posted above still isn't PAUSEing properly even when compiled using 1.14.
Reply


Messages In This Thread
PAUSE not working (*solved*) - by patters - 12-29-2020, 03:56 AM
RE: PAUSE - by patters - 12-29-2020, 12:48 PM
RE: PAUSE - by boriel - 12-29-2020, 05:07 PM
RE: PAUSE - by patters - 12-29-2020, 05:11 PM
RE: PAUSE - by boriel - 12-29-2020, 05:20 PM
RE: PAUSE - by boriel - 12-29-2020, 05:37 PM
RE: PAUSE - by patters - 12-29-2020, 05:45 PM
RE: PAUSE - by boriel - 12-29-2020, 05:54 PM
RE: PAUSE - by patters - 12-29-2020, 06:08 PM
RE: PAUSE - by boriel - 12-29-2020, 07:18 PM
RE: PAUSE - by patters - 12-29-2020, 07:34 PM
RE: PAUSE - by boriel - 12-29-2020, 08:13 PM
RE: PAUSE - by patters - 12-29-2020, 11:52 PM
RE: PAUSE - by boriel - 01-02-2021, 02:20 PM
RE: PAUSE not working (*solved*) - by patters - 01-03-2021, 12:52 AM
RE: PAUSE not working (*solved*) - by boriel - 01-03-2021, 05:02 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)