Posted: 2nd Feb 2003 0:23
This is a code designed for text-based adventures or a game that uses text for command entry.
hide mouse
+ Code Snippet
sync on : sync rate 20
print "What is your name?"
suspend for key
do
while returnkey()=0
new$=entry$()
for n=1 to len(new$)
	if asc(mid$(new$,n))=8
		line$=left$(line$,len(line$)-1)
	else
		line$=line$+mid$(new$,n)
	endif
next n
clear entry buffer
print line$
sync
cls
endwhile
exit
loop
print "Hello, ",line$
Posted: 2nd Feb 2003 19:55
And here is your code, put into a function where you can put a prompt in . V.useful code btw!

+ Code Snippet
sync on : sync rate 20
print "What is your name?"
sync
suspend for key
string$=text_input(">")
print "hello! " + string$
sync
suspend for key

function text_input(string$)
do
while returnkey()=0
new$=entry$()
for n=1 to len(new$)
   if asc(mid$(new$,n))=8
      line$=left$(line$,len(line$)-1)
   else
      line$=line$+mid$(new$,n)
   endif
next n
clear entry buffer
print string$ +line$
sync
cls
endwhile
exit
loop
endfunction line$
Posted: 5th Feb 2003 19:21
thanks for that code moggie, I think having code that enables you to input something is good. I have something similer, but you always need to see other versions as well.
I'm trying to use somthing like this for pasting sprites and incrementing the sprite numer on screen, so you can scroll through the sprite numbers and when you find the one you want you use paste it to the screen with the mouse.
Posted: 8th Feb 2003 15:12
adamsmasher23 made the code, I just put it in a function...
Posted: 8th Feb 2003 22:18
I got the idea for it from one of the examples for "perfect keyboard entry."
Posted: 21st Feb 2003 14:13
I made something like this for DB Unenhanced:

+ Code Snippet
`This function will allow an input prompt over 3D, so you can actually
`see what you are typing :-P

`syntax RTINPUT(Question,Sync On(1)/Off(Any other number)
`eg Name$=RTINPUT("What is your name?",1)
Function RTInput(Question$,SyncState)
  While Returnkey()=0
    If Inkey$()=""
      State=0
    Else
      Cls
      If state=0 and Keystate(14)=0 and returnkey()=0
        Name$=Name$+Inkey$()
        Inc Amount
        State=1
      Endif
      If Scancode()=14 and Amount>0 and State=0
        Name$=Left$(Name$,Amount-1)
        State=1
        Dec Amount
      Endif
    Endif
    Set Cursor 0, 20:Print Question$+" "+Name$
    If SyncState=1 Then Sync
  Endwhile
Endfunction Name$