MZ Call common event of script end?

Im trying to get a common event to play when a state expires and Im using Skills and States Core VisuStella MZ script however the information I found for it just says "
<JS On Expire State>
code
code
</JS On Expire State> "
Im not experienced enough to fill in a blank.

basically, I have an actor SV sprite changed when a skill is used on them and a state is applied to them which stuns the user for three turns. With the built in settings the actor sprite will only change back on turn end, I need it to change back immediately (or before the turn.)
The code to call a common event is $gameTemp.reserveCommonEvent(ID); where you replace ID with the numerical ID of your common event (the number right next the the Common Event's Name in your database. So supposing the common event's ID is 7, your note tag would look like this:

Code:
<JS On Expire State>
 $gameTemp.reserveCommonEvent(7);
</JS On Expire State>

Though I think that the JS On Expire State note tag only applies to states that wear off naturally. The JS On Erase State tag should apply both when a state wears off naturally *and* when it is prematurely removed (like by a cleansing skill or something), so it might be better to use the latter instead, in most cases. i.e:

Code:
<JS On Erase State>
 $gameTemp.reserveCommonEvent(7);
</JS On Erase State>
The code to call a common event is $gameTemp.reserveCommonEvent(ID);

This is not correct - there simply is no call common event function available anywhere in the engine, this is only the next best but not optimal solution.

what the code above really does is something else, and everyone trying to use it needs to know the difference.

That code tells the engine to reserve a slot in the list of common events to be executed at the next opportunity.

But "next opportunity" is not the same as "now" - depending on where and how you use that code, the actual execution of the common event can be delayed until the engine is ready for it.

This is especially problematic if you try to time the common event at a specific point in the sequence of the notetags and damage calculation. Because that timing can suddenly be off if the common event is delayed to the "next opportunity".
This is not correct - there simply is no call common event function available anywhere in the engine, this is only the next best but not optimal solution.
My statement wasn't incorrect. I never said that it causes any common event to be executed right at that very instant, under any possible circumstance. We're just interpreting the word "call" differently. But I will agree that my choice of terminology was probably irresponsible.

I am aware of how reserveCommonEvent works, but I decided not to elaborate on it, because the distinction isn't relevant to the OP's question. I figured that explaining something that he/she didn't ask about, and that has no impact on the answer to his/her question had a higher chance of confusing him/her than helping. But now that I've had a good night's sleep, I am leaning moreso toward the notion that I probably should have included a disclaimer regarding the matter.

Original thread: https://forums.rpgmakerweb.com/threads/call-common-event-of-script-end.148456/