I hate Input("")

Blitz3D Forums/Blitz3D Beginners Area/I hate Input("")

po(Posted 2003) [#1]
It seems if you put Input at the very bottom of code, it will run first, before everything, before anything is drawn, Input will appear until you press enter and then the rest of your code will work.
How do I get around this?


eBusiness(Posted 2003) [#2]
Well, you did it wrong.


Ross C(Posted 2003) [#3]
Are you using double buffering? If so the input command will be reached before the flip command. Sorry if i'm way off :)


Ross C(Posted 2003) [#4]
I think there was a function somewhere that used keyhit()'s to compile a string. I might have made that up though. Certainly do-able.


eBusiness(Posted 2003) [#5]
As always it is very easy to correct unknown code.


Ross C(Posted 2003) [#6]
Yeah i suppose the code would help a bit more with the problme :o)


eBusiness(Posted 2003) [#7]
No, it's not sensible to use keyhit(), but getkey() is perfect.

		value=0
		cmsg$=""
		period=0
		Color 0,0,0
		While value<>13
			value=GetKey()
			If value<>0 And value<>13 Then
				If value<>8 Then 
					If Len(cmsg)<24 Then
						cmsg=cmsg+Chr(value)
					
					End If
				Else
					cmsg=LSet(cmsg,Len(cmsg)-1)
				End If
			End If
			Color 255,255,255
			Rect 0,0,200,15
			Color 0,0,0
			If period<250 Then
				Text 0,0,cmsg
			Else
				Text 0,0,cmsg + "_"
			End If
			Delay 2
			period=period+1
			If period=500 Then period=0
		Wend



jfk EO-11110(Posted 2003) [#8]
Maybe you should try to write an input function that allows to enter a string without to stop the program flow, a parallel keyboard poll sotosay.


BTW, the blinking cursor can also be made like this:

If (int(millisecs()/250) and 1)=1 Then
 Text 0,0,cmsg
Else
 Text 0,0,cmsg + "_"
End If


so you don't need "period" and it will blink with the same speed on all machines.


eBusiness(Posted 2003) [#9]
Well, this was just what I needed for Trio, it can easily be converted into not stopping program flow, just take out the content of the while-wend loop. And it does run at almost same speed on all machines, the delay 2 command takes the major time of the time consumption. But your method seems smarter anyway, exept that int() is unneeded.