btnp seems to completely stop working iff _update60 is used instead of the normal _update
to reproduce:
- run the program below
- press Esc
- type some sort of statement (for some reason the bug only occurs if you type something before typing resume) e.g. ?"hello"
- type resume
- push or hold down the button (O)
expected: "pushed" will appear onscreen
actual: "pushed" no longer appears onscreen
function _update60() pushed = btnp(4) end function _draw() cls() if pushed then print("pushed", 52, 60, 8) end end |
Ah!
I've seen btnp() stop working on several occasions and I never knew what caused it. Thanks for figuring it out! 👍
I hope it's an easy fix.
Interesting find!
btnp() also bugs out a bit with the regular update, but doesn't stop working completely.
With the reproduction code above, if you swap _update60 to _update and follow the steps, you can see that
- A quick button press will no longer register, and
- When holding, the text appears, but it blinks a lot faster.
I briefly mentioned this here:
https://www.lexaloffle.com/bbs/?tid=35317
But nice to have this too clearly stated and with a good reproduction method.
Thank you for this! As noppa mentioned, it doesn't behave as expected with regular _update() either. I thought something was wrong with my program and have spent hours today trying to track down the bug! 😂
I noticed that after a resume, in _update btnp(X) does not work, but btnp(O) works fine. To be more specific, this only happens after entering a console command.
Steps to reproduce:
1) Hit Esc to halt cartridge
2) Enter a console command (could be anything like 'dir')
3) Enter 'resume' command
4) btnp(X) no longer registers key presses
I'm also seeing this behaviour using the usual draw function (at 30fps)
[Please log in to post a comment]