Help Writing Script Call or Plugin to Clear Shake Screen Effect.

Essentially, I have the screen shaking, but in order to keep it shaking for the length of time it needs to continue shaking, after 999 frames have passed, I have to redose it with another Shake Screen 999 frames. The thing is, when I finally switch maps, I need it to immediately stop, no matter how many frames of shaking are queued up.. I imagine this can be accomplished with a simple script call, but if not, I want to write a plugin to make it happen.


I found this in rpg_objects.js


Game_Screen.prototype.clear = function() {
    this.clearFade();
    this.clearTone();
    this.clearFlash();
    this.clearShake();
    this.clearZoom();
    this.clearWeather();
    this.clearPictures();
};




I'm assuming that can be used somehow, but what I entered didn't have an effect.


I've set up a JS class I will take but haven't started yet. I'm sure that would help but in the mean time, anyone know how to do this?
In a Script event command, just do this:


$gameScreen.clearShake();


You don't need to write a whole script to do it.
Cool, I knew it was something like that. what I put in was 


    this.clearShake();


So... the "this" only works if the function described has already been established?


Either way, thanks. I thought I was on the right track.
'this' only works if the command is being run by the class that owns the function.  Script calls are processed by Game_Interpreter, not by Game_Screen.  So you need to know how to refer to the Game_Screen object from within Game_Interpreter.  Thankfully, there are a number of event commands processed by Game_Interpreter that do things with the screen - Shake Screen is one of them 🙂   It's just a matter of looking up the existing function in Game_Interpreter and seeing how it makes the reference.

Original thread: https://forums.rpgmakerweb.com/threads/help-writing-script-call-or-plugin-to-clear-shake-screen-effect.71483/