Hi, 7RS.
This "any key" problem for your keyconfig interested me, so I decided to give it a try.
Please check to see if the function included in the following code snippet would work for you.
The code includes a small main program with some sample usage, so it should be easy to test via copy/paste/compile/run.
//=============================================================================
//### SECTION - SAMPLE CODE (see function at end)
//-----------------------------------------------------------------------------
SetDisplayAspect( -1 )
SetPrintColor(255, 255, 255)
SetClearColor(0, 0, 0)
Scancode as integer
// Wait for keypress ...
do
print("FPS = " + str(ScreenFPS()))
Print("")
Print("Waiting for ANY keypress to CONTINUE.")
// Update screen
Sync()
// Exit on ANY keypress ... but save scancode for later use ...
Scancode = GetAnyKey()
if (Scancode) then exit
loop
// Show scancode...
do
print("FPS = " + str(ScreenFPS()))
Print("")
Print("Scancode = " + str(Scancode))
Print("")
Print("Press ANY key to QUIT.")
// Update screen
Sync()
// Exit on ANY keypress ...
if (GetAnyKey()) then exit
loop
//=============================================================================
//# FUNCTION - GetAnyKey
//-----------------------------------------------------------------------------
//
// Purpose
// =======
// Returns scancode of the last key pressed ... after the key
// has been released.
//
// To call
// =======
// No parameters required.
//
// Returns
// =======
// If no key was pressed,
// returns 0.
//
// If a key was pressed,
// returns the AGK specific scancode of the keypress.
//
// Dependencies
// ============
// None, tested with AGK build 1076, using Windows 7.
//
// Programmer's notes
// ==================
//
// o Unlike the GetRawLastKey, which continues to return the scancode
// of the last key pressed even when the key has been released,
// this function will only return a valid scancode when a complete
// key down + key up event has occurred. This is easily achieved
// by waiting for the "key released" state from GetRawKeyReleased.
//
// IMPORTANT: GetRawKeyReleased(), will only return TRUE (1)
// before the next Sync() call. After a Sync(), it will reset,
// and will return 0 on successive calls. (So, it's perfect when
// ANY keypress needs to be detected.)
//
// o AGK appears to update the key release state, only after a call
// to Sync(). So, you will need to maintain proper call order;
// always call this function only AFTER you have called Sync().
// And realize, that two successive calls to GetAnyKey(), without
// a Sync() in between, will always return the same output, so
// that will not be useful.
//
// o For a listing of the AGK scancodes, refer to:
// http://www.appgamekit.com/documentation/guides/scancodes.htm
//
// o This function was written in response to the discussion here:
// http://forum.thegamecreators.com/?m=forum_view&t=199458&b=41
//
// Author: agentsam@codefield.com
// ==============================
//
// o If anything I have written above turns out to be incorrect,
// then please correct me.
//
//---------------------------------------------------------------------------
function GetAnyKey()
// Declare local variables
v_Scancode as integer
v_Result as integer
// Initialize local variables
v_Result = 0 // 0 = Keypress has not been detected...
// Get last key pressed
v_Scancode = GetRawLastKey()
// If key has been released... Key DOWN + Key UP event has occurred.
if (GetRawKeyReleased(v_Scancode))
// Return this scancode!
v_Result = v_Scancode
endif
endfunction v_Result
Cheers,
AgenTsam
[EDIT: Fixed a typo in the message, and a comment in the code. ]