I have the Smart Basic app on my iPad and trying to port and older basic program I wrote years ago to work on iPad. It is basically a text adventure game with different options so the user interface needs to provide the ability to receive text input via the keyboard.
The support help for the app suggests INKEY$() ‘returns output from physical keyboard. This command I am familiar with however it goes on to say Physical keyboard support should be turned on (OPTION KEYBOARD ON command) for this function to operate.
My Q therefore is in Smart Basic what is the correct syntax to code this?
Here is an example I would like to code for a simple Y/N selection option as follows :-
OPTION KEYBOARD ON
DIM IN$(1)
IN$(1) = INKEY$()
IF IN$(1) <> "" THEN
PRINT "Hello Mum"
ENDIF
IF ASC(IN$(1))> 90 THEN
IN$(1)= CHR$(ASC(IN$(1)) - 32)
ENDIF
IF IN$(1) = "Y" THEN
RETURN
ENDIF
IF IN$ (1) = "N" THEN
RETURN
ELSE
PRINT "No Y/N selected"
END IF
REM ENDP ynsel
It’s not clear how the statement INKEY$() should work as I receive this syntax error
Index array is out of bounds
IN$(1) = INKEY$.()
If anyone could provide a corrected example I would appreciate it as all the subroutines I previously coded should all work in the same way if I can understand the syntax rules of Simple Basic for iPad.
Regards
David S
The support help for the app suggests INKEY$() ‘returns output from physical keyboard. This command I am familiar with however it goes on to say Physical keyboard support should be turned on (OPTION KEYBOARD ON command) for this function to operate.
My Q therefore is in Smart Basic what is the correct syntax to code this?
Here is an example I would like to code for a simple Y/N selection option as follows :-
OPTION KEYBOARD ON
DIM IN$(1)
IN$(1) = INKEY$()
IF IN$(1) <> "" THEN
PRINT "Hello Mum"
ENDIF
IF ASC(IN$(1))> 90 THEN
IN$(1)= CHR$(ASC(IN$(1)) - 32)
ENDIF
IF IN$(1) = "Y" THEN
RETURN
ENDIF
IF IN$ (1) = "N" THEN
RETURN
ELSE
PRINT "No Y/N selected"
END IF
REM ENDP ynsel
It’s not clear how the statement INKEY$() should work as I receive this syntax error
Index array is out of bounds
IN$(1) = INKEY$.()
If anyone could provide a corrected example I would appreciate it as all the subroutines I previously coded should all work in the same way if I can understand the syntax rules of Simple Basic for iPad.
Regards
David S