Yanfly Buffs States Core - Custom Remove Effect

Hi, I'm trying to use Lunatic Mode on Yanfly's Buffs State Core plugin to apply state 2 after state 1 ends. Here's what the plugin documentation says:

<Custom Remove Effect>
code
code
</Custom Remove Effect>

I'm not sure exactly what goes in the code section. I know it's supposed to be javascript, but I don't know where to go to learn what to add. So far I've found this document and tried:

$gameActors.actor(actorId).addState(14);
this.actor.add_state(14);
a.add_state(14);
user.add_state(14);
target.addState(14);

My best guess is that I'm using the wrong code to refer to the affected actor.
After it ends, or after it's removed? Because there's a difference. If you want this to happen when the state is removed by any means, <Custom Remove Effect> is right. But if you want this to happen ONLY when the state expires through time, you want <Custom Leave Effect> instead.

Either way, within the state code, it should be:

user.addState(14);
It worked!! Thanks so much.

Custom remove effect is what I intend, but thanks for the heads up.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-buffs-states-core-custom-remove-effect.107338/