Basic Input

Previous topic - Next topic

Kirkkaf

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.

ampos

It is a bug with latest GLB (9.040).

Try the previous one, or get the beta.

Kitty Hello

Or don't use INPUT$ at all. It's a bit of a stupid function.

Kirkkaf

What other way can I get input from the keyboard and store it in a variable?

MrTAToad

You could use DDgui, or most games read one character at a time and build up a string from that.

Kirkkaf

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.

erico

Quote from: Kirkkaf on 2011-Apr-18
The print command doesn't seem to do anything.

...you have SHOWSCREEN on your code right?

Kirkkaf

Yes, and still my console window appears blank.

EDITED: I didn't think console windows use double buffers either.

MrTAToad

With console programs, you use STDIN and STDOUT

Kirkkaf

So how do you write to a console window?

MrTAToad

You cant write to
  • it, you write in it.

Kirkkaf

That is what I ment, thanks for correcting me, how about an example because I can't seem to write IN the console window.

matchy

#12
Code (glbasic) Select

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


MrTAToad

Try :

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


in a console program