Making a piece of script use (this.eventId())

Hello,

Does anyone know how to make this script interpret (this.eventId()) as well as a eventId number? It's from Moghunters' Pixi Filter plugin.

Code:
Game_Interpreter.prototype.setFilterEvent = function(command, args) {
    var shatterType = -1;
    var event_id = 0;   
    if (command === "filter_event_id")  {
        event_id = Number(args[1]);
        filter_id = Number(args[3]);
    };
    $gameMap.events().forEach(function(event) {
    if (event.eventId() === event_id) {
        event._filterData = [true,filter_id];
        $gameSystem._pixiFilterRefresh = true;
    };
    }, this);   
};

Thanks in advance!
In plugin command or script command?
@Poryg @caethyril MOG Pixi Filters uses plugin commands. I imagine it would look like this if it works:

filter_event_id : ($gameMap.event(this.eventId())) : 0
@Chef
I think it would be better if you split that line into two commands.
first a control variable to store the this.eventID into the variable and then a second line using the plugin command with the number from the variable but not the this-placeholder.

this is a context-sensitive placeholder that changes depending on where in the code it is executed. If that execution is outside the event context, it will not even reference to an event-ID but return an error "method does not exist".
If you don't know where it is executed (like when it isn't executed in your own code but transferred to someone else' code), then it is better to resolve the data before transferring the code.
It definitely doesn't work this way. Plugin commands don't evaluate code, they only accept a string as a parameter and then fire whatever code was defined behind it. You need to edit the code you provided.

Code:
Game_Interpreter.prototype.setFilterEvent = function(command, args) {
   var shatterType = -1;
   var event_id = 0; 
   if (command === "filter_event_id")  {
       var id = Number(args[1]);
       event_id = id ? id : this.eventId();
       filter_id = Number(args[3]);
   };
   $gameMap.events().forEach(function(event) {
   if (event.eventId() === event_id) {
       event._filterData = [true,filter_id];
       $gameSystem._pixiFilterRefresh = true;
   };
   }, this); 
};

and then you use 0 for This event in the plugin command.
On a side note... That's some poorly optimized code.
And on another side note, please watch your tagging. Tagging people, who have liked a post, doesn't do any good.
Yes it works! Thank you both 😀

And sorry for that tag, thought he/she was interested.

Original thread: https://forums.rpgmakerweb.com/threads/making-a-piece-of-script-use-this-eventid.114228/