07-30-2024, 03:18 PM
(07-29-2024, 06:12 PM)Pete Wrote:You make a good point. I wonder why this is the way it works. It would make more sense to be filled with NULLs than spaces.(07-28-2024, 04:07 PM)SMcNeill Wrote: Works as expected. Try this:Wow, missing out on that porta-potty contract is really eating at you!
...
The issue is you're printing it in an loop. You press "A", it pops up on the screen for a poop, and then the loop just keeps repeating, and it's replaced almost instantly by nothing as it waits for the next keypress to poop up the next key being processed.
Pete
- I'm in with the INKEY$ crowd!
EDIT: @justsomeguy
I don't use a dim as string approach with INKEY$, I noticed this approach makes a null string as CHR$(32) + CHR$(32). That will be problematic if you intend to trap a spacebar press.
Code: (Select All)Type tt
' Use 2 bytes to capture 2 byte combinations
'k AS STRING ' Works
k As String * 2 ' Does Not work
End Type
Dim As tt t
' Note you cannot detect a spacebar press with this 'Dim as String' approach.
Do
t.k = InKey$
If Len(LTrim$(t.k)) Then
Locate 1, 1
Print "k:"; t.k, Asc(Mid$(t.k, 1, 1)), Asc(Mid$(t.k, 2, 1)); " "; ' Cover up larger output strings.
End If
Loop
It would be also nice, that we have new LEN() function that returns the actual length of the string.
2D physics engine https://github.com/mechatronic3000/fzxNGN
Untitled Rouge-like https://github.com/mechatronic3000/Untitled-Rougelike
QB Pool https://github.com/mechatronic3000/QBPool
Untitled Rouge-like https://github.com/mechatronic3000/Untitled-Rougelike
QB Pool https://github.com/mechatronic3000/QBPool