- 3
- Posts
- 4
- Years
- USA
- Seen Apr 6, 2025
Hello,
I've been making a custom battle UI and decided to change the move button layout; my only issue is that when moving the cursor, it stops at the fourth slot even when I have less than 4 moves. For some reason I can't wrap my mind around how to properly program it so that it stops at the last available move.
Here is my layout:
![[PokeCommunity.com] [Code] Changing move button layout [PokeCommunity.com] [Code] Changing move button layout](https://data.pokecommunity.com/attachments/73/73290-e49c4439a3841f2baaf79ecc40cfef01.jpg)
Here is my current code:
I've been making a custom battle UI and decided to change the move button layout; my only issue is that when moving the cursor, it stops at the fourth slot even when I have less than 4 moves. For some reason I can't wrap my mind around how to properly program it so that it stops at the last available move.
Here is my layout:
![[PokeCommunity.com] [Code] Changing move button layout [PokeCommunity.com] [Code] Changing move button layout](https://data.pokecommunity.com/attachments/73/73290-e49c4439a3841f2baaf79ecc40cfef01.jpg)
Here is my current code:
Ruby:
oldIndex = cw.index
pbUpdate(cw)
if Input.trigger?(Input::LEFT)
cw.index -= 1 if cw.index != 0
elsif Input.trigger?(Input::RIGHT)
cw.index += 1 if cw.index != 3
end