Why are you clearing the screen and redrawing it every loop? Try:
ACLS
{commands related to drawing your menu}
@LOOP
{commands related to checking for button press}
GOTO @LOOP
SmileBASIC is similar to standard BASIC, but not exact. There's a list of the major difference in the user guide. The one that always trips me up is that arrays in SmileBASIC use [square brackets] to hold the index, vs standard BASIC's use of (rounded brackets)
What kind of command do you want the user to be able to execute? Unless it's a built-in command such as "FILES" you're going to have to interpret the user's input and supply some code to perform the required action.
For some simple ones it wouldn't be very hard to create a program to do it automatically, but for the more complex it would be almost impossible. It would have to parse each MML command to determine which are musical notes and which are commands - like those that adjust pitch & octave, then determine how to rearrange them. Very complex... good luck. Let us know when you're done with it.
Honestly, it's just my idea of how a battle could work. Others will have different ideas. The key for Random_Battle is in the screenshot. The code seems to work for me, but there could be mistakes or bugs in it. Modify the player & weapon data and attack & defense formulas and observe the results.
Define a chance of the attack hitting the target. This can be modified by the attacker's & defender's fighting skill levels.
Define the minimum and maximum damage the attacker's weapon can inflict. This can be modified by the attacker's strength and the defender's armour.
Then use the SmileBASIC random number function to pick numbers within those ranges.
Recording 4 seconds isn't a problem. Playing it back is the tricky part. It has to be played back in slices no thicker than 2 seconds each. Anyway, the code in this screenshot works. Note: recording starts when the button is released.
Once you figure out how the enemy should behave. You have to define the rules he must play by. A really simple example is the "house rules" for the card game "blackjack": "The dealer must hit until the cards total 17 or more points."
Just imagine you're standing over the shoulder of someone controlling the enemy, but who has never played the game before. You have to tell him what he should do.
...
Ok. Look, he's over there. Rotate your ship towards that direction. Now apply your thrusters. When you get within range, fire. Oh. He moved. Ok. Reverse thrusters. We have to avoid the gravitation field of that star. ... etc.