Pyro_guy: I've just recently added mouse support to it too
Basically it was a general routine for inputting that I can use in any project I may undertake. And as RPG's are my favourite type of game I tend to use a lot of text.
This is my first attempt I made when starting out with DBP so in a bit simpler and just inputs a line of text. It also had a nice flickery cursor effect. This also uses the ENTRY$() function.
FUNCTION InputString(X AS INTEGER,Y AS INTEGER,InputLength AS INTEGER, Prompt$ AS STRING, PreviousString$ AS STRING)
` This routine will be the main input routine
`
` X,Y Will be the coordinates on screen
` Prompt is a prompt on screen if Required
` Previous String if needed
`
` Setup Font and Characteristics
`
SET TEXT FONT "Courier New"
SET TEXT SIZE 15
SET TEXT OPAQUE
`
` Setup Temporary Veriables
`
PromptWidth=TEXT WIDTH(Prompt$)
InputX=X+PromptWidth+2
Res$=PreviousString$
CurrentPos=LEN(Res$)
IF InputLength<0
Numeric=1
InputLength=ABS(InputLength)
ELSE
Numeric=0
ENDIF
`
` Display the Prompt
`
SET CURSOR X,Y
PRINT Prompt$;
`
` Display Previous string
`
SET CURSOR InputX,Y
IF PreviousString$<>""
PRINT PreviousString$;
ENDIF
PRINT "_";
`
` Main Input Loop
`
DO
IF RETURNKEY()
WHILE RETURNKEY()
ENDWHILE
SET CURSOR InputX,Y
PRINT Res$;" ";
EXIT
ENDIF
Key$=ENTRY$()
IF Res$<>"" AND ASC(Key$)=8
Res$=LEFT$(Res$,LEN(Res$)-1)
Key$=""
SET CURSOR InputX,Y
PRINT Res$;"_ ";
ENDIF
IF Key$<>"" AND LEN(Res$)<=InputLength AND ASC(Key$)>31
IF ASC(Key$)>=48 AND ASC(Key$)<=57 THEN IsNumber=1 ELSE IsNumber=0
IF (Numeric AND IsNumber) OR Numeric=0
Res$=Res$+Key$
SET CURSOR InputX,Y
PRINT Res$;"_";
ENDIF
ENDIF
CLEAR ENTRY BUFFER
LOOP
ENDFUNCTION Res$
----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"