Fishing button mashing game

I've read other threads of people's button-mashing minigames but they all confused me with what the commands are supposed to do. I want to make a button-mashing minigame where you spam your keys to get fish, and depending on what fish it is the mashing should increase.

Untitled516_20230823210438.png
Screenshot_20230823-210602.jpg

sorry that the 2nd image is weird, the photo wouldn't download, and sorry if I was bad at giving information, If there is something I can clarify I'd be happy to. I'm not good at scripting so some things might confuse me but I'm willing to try
This can be done with eventing for the button mashing but storing and fetching the fish data is going to require a little bit of scripting. Are the fish items?

This will be very similar to my post here but I can modify it for you.
This can be done with eventing for the button mashing but storing and fetching the fish data is going to require a little bit of scripting. Are the fish items?

This will be very similar to my post here but I can modify it for you.
yeah, I do plan to make the fish items and have it When you select them in your inventory you get a nice image of the fish. And yes a modification would be very helpful thank you!
Ok, here's a first draft. You'll need to make a fishing hole event to trigger the fishing (If you want to trigger this when the player is by ANY water tile that's going to require more work so let's start here). When the player interacts with the fishing hole event, it will start the common event. The common event starts a timer of 5 seconds where the player needs to mash the ok button a certain number of times.

You need to create your fish items in the database (11 and 12 in this example) and put those item numbers into an array called fishPool for that fishing spot. Put in the notebox in the item database <fishStrength:x> (no spaces) where x is how many times the player needs to press the button to fish it out.

You'll also need 4 variables for this:
timer (I used 6)
buttonPresses (7)
fishStrength (10)
currentFish (15)

Edit: I edited the fishing hole event and common event because the player could move around the map after "casting a line" so I had to stop the player from moving

Script calls (Fishing Hole Event):
JavaScript:
var fishPool = [11, 12];
var randomIndex = Math.floor(Math.random() * fishPool.length);
$gameVariables.setValue(15, fishPool[randomIndex]);

Control variable 10 = $dataItems[$gameVariables.value(15)].meta.fishStrength;

JavaScript:
if($gamePlayer.moveByInputCached === undefined)
$gamePlayer.moveByInputCached = $gamePlayer.moveByInput;
$gamePlayer.moveByInput = function(){
return false;
}
I thought I got it right but maybe I put in a typo somewhere or didn't fully understand something. I looked around it trying to find spelling mistakes and fixed them but it still doesnt seem to work. do you know what I messed up?
1692849675989.png
1692849697677.png
1692849722460.png
1692849761347.png
1692849780721.png

edit: i see what ive done wrong im sorry
fishPool has to be the item numbers of your fish. I used 11 and 12. You need to change those numbers to 5 and 6 because that's what you're using. The third line should also be
$gameVariables.setValue(15, fishPool[randomIndex]);

Do not change "randomIndex". You can change 15 if you want to use a different variable for current fish but you need to update every instance of 15 to that number.

You also have a typo on the $gameParty.gainItem line. The 15 has to be in parentheses.

Also as an aside, if you're using a number in Javascript do not use leading zeros, i.e. 0005 and 0006. Javascript will parse it as octal and it will read it as a different number if it's 8 or above (In this case it would still be 5 and 6 but 8 or higher will result in a different number)
fishPool has to be the item numbers of your fish. I used 11 and 12. You need to change those numbers to 5 and 6 because that's what you're using. The third line should also be
$gameVariables.setValue(15, fishPool[randomIndex]);

Do not change "randomIndex". You can change 15 if you want to use a different variable for current fish but you need to update every instance of 15 to that number.

You also have a typo on the $gameParty.gainItem line. The 15 has to be in parentheses.

Also as an aside, if you're using a number in Javascript do not use leading zeros, i.e. 0005 and 0006. Javascript will parse it as octal and it will read it as a different number if it's above 10 or above (In this case it would still be 5 and 6 but 10 or higher will result in a different number)
Oh awesome it worked! thanks man, but i thought you were gonna clown on me for this
1692851319214.png

thanks again!
No, I wouldn't clown on someone for not knowing Javascript, especially a beginner. Also, you may want to update the events with the changes I made above because my original draft lets the player walk around after casting a line.

Original thread: https://forums.rpgmakerweb.com/threads/fishing-button-mashing-game.160567/