MV I need to obtain the name of the current common event

What i need, as the title says, is the name of the current common event that is being executed. The scriptcall has to be done inside the common event, the result is going to be saved into a variable.

Thanks!
Solved by myself. Can be closed.
How did you solve it? Iam just curious.
How did you solve it? Iam just curious.
There is a couple of ways.
If you have the common event Id, you can just do the:
$dataCommonEvents[ID].name

If you do not have the ID, meaning that somehow you are executing common events dynamically, you can find the id using the common event list. But that example will only work if you execute the script call in that common event context:

JavaScript:
for(let i = 1; i < $dataCommonEvents.length; i++){
    const commonEvent = $dataCommonEvents[i]
    const commandList = commonEvent.list

    if(commandList === this._list){
        const commonEventId = i
        const commonEventName = commonEvent.name
        break
    }
}

Original thread: https://forums.rpgmakerweb.com/threads/i-need-to-obtain-the-name-of-the-current-common-event.150222/