English Amiga Board

Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

Thread Tools
Old 08 October 2019, 09:42   #1
Registered User

Join Date: Mar 2014
Location: Akaa
Posts: 57
Simple While/Wend loop for waiting inkey buffer is empty?

mean this code waits if there is keys inkey buffer.

while len(inkey$)<>0
when is empty code later parts code. i need clear keyboard buffer in my project. i think is i can do it this way.is any better way do it in blitz basic.
JPQ is offline  
Old 08 October 2019, 10:23   #2
Registered User

Daedalus's Avatar
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,533
Not that I'm aware of, well not easily anyway. You can access the OS directly and clear the keyboard buffer but that's not as simple as a single command. What exactly are you trying to do? It's unusual to need to clear the keyboard buffer.

If you're running a window that you're detecting keypresses from, you can try clearing the event queue instead:

or, to just clear keyboard events:

FlushEvents $400
This will only work if you're using a window as a source of your program's events however...
Daedalus is online now  
Old 08 October 2019, 17:34   #3
Registered User

Join Date: Mar 2014
Location: Akaa
Posts: 57
i try make multitasking game what gives questons and wait ansver for example 30 seconds. and i dont want user holding key mess next queston ansver they given single key presses. and this thanks for this FlusheEvents tip.
JPQ is offline  
Old 08 October 2019, 23:05   #4

E-Penguin's Avatar
Join Date: Jul 2016
Location: Darmstadt
Posts: 889
You could do the check in the VBlank period, using an interrupt handler. Then the code would check the keyboard every 1/50th of a second and you can carry on with the rest of the programme in the background.
E-Penguin is online now  

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Waiting for disk activity to finish losso Coders. Asm / Hardware 6 05 June 2018 14:47
Copper - waiting for the end of a line h0ffman Coders. Asm / Hardware 21 14 March 2017 20:59
Waiting for the blitter... jayminer Coders. Blitz Basic 8 20 July 2015 02:12
Have you played Banshee? If not what are you waiting for? vroom6sri Amiga scene 14 18 June 2013 01:01
Waiting for disk activity to finish Dreedo project.WHDLoad 11 07 December 2010 16:07

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 17:53.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.10201 seconds with 15 queries