LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

How do you use the buttons

Root / Programming Questions / [.]

ElzoBroCreated:
Cool!

Ummm to have two or more buttons do the same thing then maybe like: IF (BUTTON() AND #A) OR (BUTTON() AND #B) THEN BEEP And just add more "OR (BUTTON() AND blah)" for more buttons. If you want every button to do the same thing the use: IF BUTTON()>0 THEN BEEP
In this case, OR shouldn't be used. || should be used instead.
IF (BUTTON() AND #A) || (BUTTON() AND #B) THEN BEEP
OR and || are different. OR is the binary bitwise OR method, while || is the logical comparison OR.

This thing I found shows that OR and || do the same thing in comparisons (page 4) AHH IT DIDNT WORK lel i fixed it

Cool!
Already finished the extremely small and extremely messy code for Simon Says. It works really good but its text based and I forgot to add the high score and total score feature before adding it here lol. I'll make sure to do that.

Yeah don't use ==, use AND. Using == is like a noob mistake.

Well that's how I got used to doing it sooo

Oh, hey. my old post is suddenly popular now... interesting... .-.

doesnt work what goes in parentheses

doesnt work what goes in parentheses
...You can see what commands do in some detail by placing the cursor next to a command and tapping the question mark on the top right* bottom screen. Did you even check? Regardless, (0) means "held down", (1) means "pressed with repeat", (2) means "pressed with no repeat", and 3 means "after releasing button".
Spoiler*Right, not left.

If you have a New 3DS or Circle Pad Pro, put XON EXPAD near the top of your code to enable ZL, ZR, and the C-Stick (XOFF EXPAD turns it all off). STICK OUT X,Y is how you read the magnitude of the Circle Pad (Magnitude is how far from the center it is pushed). X and Y can be replaced with whatever variables you want receiving the data. STICKEX OUT X,Y does the exact same thing, but for the C-Stick. Make sure you've turned it on if you plan on using it! Also, button presses are only registered every frame. If you use IF BUTTON(2) AND #A THEN for example, it will still output true as long as no frames have passed. Use VSYNC 1 properly to avoid this. Don't use WAIT 1 because that's also pretty amateur/useless.

I'm not sure if you understood me; in my example, you wouldn't care about the other button (L). All you want to know is if the user pressed A, but pressing another button while pressing A will prevent the following from working: IF BUTTON() == #A THEN BEEP With this you can ONLY be pressing A and nothing else or else it won't BEEP; Holding L while pressing A won't trigger this. By doing this: IF BUTTON() AND #A THEN BEEP You can be pressing all the buttons you want and it would ignore them, only caring about if you pressed A; you could be holding UP, DOWN, L, R, etc. and press A and it will still BEEP.
Thanks, i didnt know that!

If you have a New 3DS or Circle Pad Pro, put XON EXPAD near the top of your code to enable ZL, ZR, and the C-Stick (XOFF EXPAD turns it all off). STICK OUT X,Y is how you read the magnitude of the Circle Pad (Magnitude is how far from the center it is pushed). X and Y can be replaced with whatever variables you want receiving the data. STICKEX OUT X,Y does the exact same thing, but for the C-Stick. Make sure you've turned it on if you plan on using it! Also, button presses are only registered every frame. If you use IF BUTTON(2) AND #A THEN for example, it will still output true as long as no frames have passed. Use VSYNC 1 properly to avoid this. Don't use WAIT 1 because that's also pretty amateur/useless.
Thanks I came to this one to figure out about my new 2ds. I needed every button.