eventing a Button Smashing Event

If: Button Mash Width < 25
◆Control Variables: #0026 Casting Distance = 1
◆Else If: Button Mash Width >= 25 and Button Mash Width < 50
◆Control Variables: #0026 Casting Distance = 2
◆Else If: Button Mash Width >= 50 and Button Mash Width < 75
◆Control Variables: #0026 Casting Distance = 3
◆Else If: Button Mash Width >= 75
◆Control Variables: #0026 Casting Distance = 4
◆End

Please make sure to adjust your event to match this structure. Each "Else If" follows right after the "End" of the previous condition without an intervening "Else" or another "End". This is the correct way to structure conditional branching in RPG Maker MZ for it to function as intended. After you've made these adjustments, remember to test the event to ensure that the casting distance is being set correctly based on the button mash width. How do I set up the Elese if? please put this into a event properly.
if (variable)
//do your stuff
else
if (other thing)
//whatever happened
else
if (whatever)
//last thing to happen
end
end
end

other wise use a scriptcall:
JavaScript:
let mashBtn = $gameVariables.value(1)
let val = $gameVariables.value(2)
if (mashBtn <= 25) {
    val = 1
} else if (mashBtn >= 26 && mashBtn <= 50) {
    val = 2
} else if (mashBtn >= 51) val = 3;

something like this, whatever works for you and how the entire event looks like.
otherwise there is an mash button part in MV tutorial which can be used in MZ

[here] is the tutorial for MV, should work in MZ as well.

Original thread: https://forums.rpgmakerweb.com/threads/eventing-a-button-smashing-event.167408/