MV How to Get the EventNote Meta from an Event of another Map (DataManager.loadMap?)

problem solved!

I needed to read the meta data from events of another map,
in order to get their event ID based on their EventNote.

this can be solved by replycating parts of the datamanager. and load the map from which you want to read the events meta.
Then this map can be accest over the console aswell ^^

By default "$dataMap" does read the events for the map on which you are .
So by replicating the Setup of "$dataMap" and adding another mapID this can be solved.

some example code that shows hopefully what i mean
(compare this code to the default code from "rpg_managers", in order to see what i changed, or in other words how i replicated the Setup of "$dataMap" .In my Case i named it "$dataGrave", because its for an "eventgrave"- plugin..)

JavaScript:
// Data Manager (import Grave Map Data)----------------------------------------------------------------

    //"$dataGrave" stores the Grave Map data (similar to "$dataMap" for default "$gameMap").

    DataManager.loadGraveData = function(mapId) {
        if (mapId > 0) {
            var filename = 'Map%1.json'.format(mapId.padZero(3));
            this._mapLoader = ResourceHandler.createLoader('data/' + filename, this.loadDataFile.bind(this, '$dataGrave', filename));
            this.loadDataFile('$dataGrave', filename);
        } else {
            this.makeEmptyMap();
        }
    };

    var _DataManager_onLoad = DataManager.onLoad
    DataManager.onLoad = function(object) {
        _DataManager_onLoad.call(this, object);
        if (object === $dataGrave) {
            this.extractMetadata(object);
            for (var i = 0; i < object.events.length; i++) {
                var data = object.events[i];
                if (data && data.note !== undefined) {
                    this.extractMetadata(data);
                }
            }
        }
    };

    //load Grave Map data
    // _GraveMapId is the map id which you want to read
    DataManager.loadGraveData(_GraveMapId);
//----------------------------------------------------------
If you look up the JavaScript Questions That Don't Deserve Their Own Thread thread, somewhere in the last couple of pages was recently written a chunk of code to load a second map from the database for the purposes of reading its data when not the active map.

That should be able to help you.
this is solved & can be closed thx

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-get-the-eventnote-meta-from-an-event-of-another-map-datamanager-loadmap.141791/