Try putting a VSYNC after the INPUT. That will insert one frame between the input and the next check, which gives tells the 3DS to check for a new trigger rather than use the one from the current frame. If that's not enough, you can do a bit more, like vsync 5.
Edit: nevermind, one should be enough.
Pressing A during an INPUT
Root / Programming Questions / [.]
WaulyCreated:
Hi guys! I'm new to this website but not too new to smileboom. I had petit computer and now smilebasic and I have a lot of fun toying and learning.
Anyway, I have this problem where when I INPUT a name and press A to enter it (while the game is running of course) it keeps A pressed for my actual "if button(2) and #a".
You know what, a vsync 60 does the job. I'm just surprised BUTTON(2) would do this to me D:
Edit: Actually, this is strange. I tested the lowest vsync I could do, holding down A with the input and I got VSYNC 29, but, when I move the "IF BUTTON(2) and #A..." to the top line of my while loop, VSYNC 28 works. So the processing is taking some time someplaces I guess?
I did a test
ACLS INPUT "Name";N$ VSYNC X WHILE WLOOP==0 IF BUTTON(2) AND #A THEN BREAK IF A==0 THEN ?"While" A=A+1 WEND ?"Break"Tested by holding A after inputting a name. If "While" shows up, it worked. I noticed it was inconsistent and the time for "While" to show up was also Edit2: I edited the program to this
ACLS INPUT "Name";N$ B=MAINCNT VSYNC X WHILE WLOOP==0 IF BUTTON(2) AND #A THEN BREAK C=MAINCNT-B IF A==0 THEN ?C A=A+1 WEND ?"Break"Instead of printing "While", now it prints how many frames it took to get to the while loop if the amount of VSYNC allows it VSYNC 400 is around the sweet spot. something like 380 works a fraction of the time the frame count is pretty much always different It's just a mess
Now I could be wrong, but I'm fairly certain the VSYNC needs to be INSIDE of the loop, in order to work optimally.
I've done many loops similar to the code you gave above, with the vsync inside, and I haven't had an issue like that.
@LOOP VSYNC 1 IF(BUTTON(2) == 16) THEN BEEP GOTO @LOOPAgain, I could be wrong. I apologize if I'm wrong. I'm not an expert. :p
okay okay here we go guys
WHILE !(BUTTON() AND #A):VSYNC:WEND