I hate Input("")
Blitz3D Forums/Blitz3D Beginners Area/I hate Input("")
| ||
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? |
| ||
Well, you did it wrong. |
| ||
Are you using double buffering? If so the input command will be reached before the flip command. Sorry if i'm way off :) |
| ||
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. |
| ||
As always it is very easy to correct unknown code. |
| ||
Yeah i suppose the code would help a bit more with the problme :o) |
| ||
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 |
| ||
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. |
| ||
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. |