Hi, I'm having a menu with three buttons. I want to be able to change which one is selected by pressing w/s buttons. I can't seem to find a way to make it work properly. Each button has two frames. First one is deselected button, and the second one is selected button.
My code looks something like this:
If a variable is equal to 1, button 1 gets selected. Whilst it's selected, if I press S button, the variable gets changed to 2
If variable is equal to 2, button 1 returns to normal, and button 2 gets selected instead. Whilst it's selected If I press S it changes variable to 3, and if I press W it changes variable to 1.
The problem with this setting is, that when I press S and variable changes to 2, it immedietely reads the line that tells it to change to 3, therefore buttons change really quick from button 2 to 3 or 1.
I can't seem to find any useful command that would execute script on moment of press of a button, not when it's just pressed. Is there such command? Or just a better solution?