Creating a fully fledged rpg battle system is a big task - certainly not something I would recommend for beginners. At first I typed out something which might get you started but it was quite a lot and I decided not to because it was too much complex information all at once.
I would recommend shrinking down your goal - if you want to make a battle system, you should create a very simple one first. Perhaps just 2 characters. You play as just one. It is either your turn or the computer's turn. Then the computer can pick a random attack for the enemy to do.
Even this is really quite a bit more complicated than you might think.
The best thing to do would be to build it slowly, piece by piece. Get 2 sprites on the screen at first, try to get a menu which you can select from.
There was a pretty good thread a little while back about menu systems - feel free to use the code I posted. You can find the thread here: https://fuzearena.com/forum/topic/1910/menu-system-program
Take it one step at a time and do not worry yet about making a fully working game. It will come in time, with patience!