My current code is set so when x is pressed, the ladybrown arm goes to load. When X is pressed, it scores. I want to know how to make it all one button so its like, first B, Load, press B again, hold, and press B again, score.
You can use a variable. Different values of the variable would correlate to the different functions you want. Every time the button is pressed, the variable is also increased by 1 once the button is released. After a certain point, the variable would be reset to 0, and the cycle repeats.
How would I go about accomplising such a task?
This explanation will be in a more block-code-like format, but the logic is the same as text-based coding.
When started
set variable to 0
——————————
When X is pressed
If variable = 0
Ladybrown arm goes to
Increase variable by 1
If variable = 1
Ladybrown arm goes to
Increase variable by 1
If variable = 2
Ladybrown arm goes to
Set variable to 0
Yes, this should work better.
However, I’m not sure if your If variable = # statements are formatted correctly because I don’t remember if VexCode allows such a shorthand or wants something like this:
If (variable == #) {
Insert Ladybrown Code Here
}
Try out what you have and if it doesn’t work, then try formatting it the way I formatted it.