GLBasic forum

Main forum => GLBasic - en => Topic started by: Kirkkaf on 2011-Apr-18

Title: Basic Input
Post by: Kirkkaf on 2011-Apr-18
Hi everyone,

I am new to GLBasic and am having problems with basic input for the keyboard. The input command seems to behave different to other languages I have used.

If I write something simple like,
Code (glbasic) Select
INPUT name$, 0, 0
after typing a name in and pressing the ENTER key this creates a blank space and doesn't move on within the program.

Should this behave like this? What am I doing wrong?

Thanks.
Title: Re: Baisc Input
Post by: ampos on 2011-Apr-18
It is a bug with latest GLB (9.040).

Try the previous one, or get the beta.
Title: Re: Basic Input
Post by: Kitty Hello on 2011-Apr-18
Or don't use INPUT$ at all. It's a bit of a stupid function.
Title: Re: Basic Input
Post by: Kirkkaf on 2011-Apr-18
What other way can I get input from the keyboard and store it in a variable?
Title: Re: Basic Input
Post by: MrTAToad on 2011-Apr-18
You could use DDgui, or most games read one character at a time and build up a string from that.
Title: Re: Basic Input
Post by: Kirkkaf on 2011-Apr-18
Cheers, I will use this method as Input isn't working. (My program would be alot simplier if this did work though)

I wanted to start with a simple console program but seem to be having trouble even displaying text on the console screen. The print command doesn't seem to do anything.
Title: Re: Basic Input
Post by: erico on 2011-Apr-18
Quote from: Kirkkaf on 2011-Apr-18
The print command doesn't seem to do anything.

...you have SHOWSCREEN on your code right?
Title: Re: Basic Input
Post by: Kirkkaf on 2011-Apr-18
Yes, and still my console window appears blank.

EDITED: I didn't think console windows use double buffers either.
Title: Re: Basic Input
Post by: MrTAToad on 2011-Apr-18
With console programs, you use STDIN and STDOUT
Title: Re: Basic Input
Post by: Kirkkaf on 2011-Apr-18
So how do you write to a console window?
Title: Re: Basic Input
Post by: MrTAToad on 2011-Apr-18
You cant write to
Title: Re: Basic Input
Post by: Kirkkaf on 2011-Apr-18
That is what I ment, thanks for correcting me, how about an example because I can't seem to write IN the console window.
Title: Re: Basic Input
Post by: matchy on 2011-Apr-18
Code (glbasic) Select

// Echo Win32 keyboard input to GLB Output in debug mode only
WHILE TRUE
DEBUG INKEY$()
        SHOWSCREEN
WEND

Title: Re: Basic Input
Post by: MrTAToad on 2011-Apr-18
Try :

Code (glbasic) Select
STDOUT "This is a test"
KEYWAIT


in a console program