Using the _key commands
#1
Is the following sample using the _KeyClear,  _Limit, and _keyhit functions correctly? (not worried about the rest at this point). It seems to be ok, but I'm not sure about placement of  _limit, and whether it will be called more times than necessary.
_KeyClear
Print "hit a key"
GetAnAction:
_Limit 30 '                                              limit resource usage
k = _KeyHit '                                            get code of key press
Locate 12, 40: Print k; Space$(5) '                      erase previous key code
If k < 1 Then GoTo GetAnAction '                        if there are no keys pressed, have another look - but only do this max 30 times per second
Locate 13, 1: Print Space$(13); '                        erase previous key code announcement
Locate 13, 1
Print "ok, saw"; k '                                    announce key that was recognized
GoTo GetAnAction '                                      look for another key press
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Reply


Messages In This Thread
Using the _key commands - by PhilOfPerth - 11-23-2022, 02:23 AM
RE: Using the _key commands - by King Mocker - 11-23-2022, 02:37 AM
RE: Using the _key commands - by SMcNeill - 11-23-2022, 02:42 AM
RE: Using the _key commands - by PhilOfPerth - 11-23-2022, 02:49 AM



Users browsing this thread: 1 Guest(s)