Skotty TV

Veteran
Veteran
Joined
Nov 4, 2015
Messages
98
Reaction score
184
First Language
German, English
Primarily Uses
Hi There!


I just want to know if anyone (good scripter) can help me out.


I want to create a new array with all map info stored in ->


- var array = [];


- array[1] = Map001.json


something like this...


The thing is, in $datamap is always just the last map stored. And $dataMapInfos doesnt have all infos i need.


I need the "note" information of each map.


Basicly i just need a new array where all "Map00x.json" objects are stored in.


- DataManager._databaseFiles.push({name: "$datamap1", src: "Map001.json"});


<- This is not a solution because at that point the length of $dataMapInfos is not given,


so a "for loop" has to go up to 999 which will give the error "Map00X is not found".... :(


Help!


The final array should look like this:


$myarray[]


- 0: Map001


       - data


- 1: Map002


       - data


 2: ....
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,545
Reaction score
8,155
First Language
German
Primarily Uses
RMMV
I think you better tell us what you want to do - so far you only told us how you want to do something, not what and why.


Because unfortunaly, storing the entire map-jsons will require a lot of memory, and you won't need 99% of all that data.


So better to tell us what you want to do, because then we might be able to point you to another way that stores only the minimum info you need.


Because there are a lot of reasons why only one map is loaded...
 

Skotty TV

Veteran
Veteran
Joined
Nov 4, 2015
Messages
98
Reaction score
184
First Language
German, English
Primarily Uses
I think you better tell us what you want to do - so far you only told us how you want to do something, not what and why.


Because unfortunaly, storing the entire map-jsons will require a lot of memory, and you won't need 99% of all that data.


So better to tell us what you want to do, because then we might be able to point you to another way that stores only the minimum info you need.


Because there are a lot of reasons why only one map is loaded...



First of all thanks for the quick awnser!


I dont want to store all of it of course... i just want to create an array with all maps noteboxes.


The Plugin i want to create will handle some sort of "Level Selection".


I want to determine the "Chapter" of a map with <Chapter: X> in the Maps Notebox


and the "Level" with <Level: X>.


Another part will be if the Level/Chapter is: Revealed, finished, hidden... etc.


thats why i need to create a new array that will get saved inside a savegame file.


Telling here what the script is for and what it will do exactly would be kinda dumb, i hope you´re with me.


The final array should (now) look like this:


$myarray[]


- 0: Map001


       - note


- 1: Map002


       - note


- 2: ....


How to read a JSON file proper will might be all help i need ->


for (var i = 1; i < $dataMapInfos.length; i++) {


****var tmp = read Json Map(i).note****


      mylist.push(tmp);


        }


...i dunno :(
 

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,075
First Language
Portuguese
Primarily Uses
Other
For loading a json from the data directory:


function loadData(filename) {
var fs = require('fs');
var dir = window.location.pathname.replace(/(\/www|)\/[^\/]*$/, '/');

if (dir.match(/^\/([A-Z]\:)/)) {
dir = dir.slice(1);
}

filename = decodeURIComponent(dir) + 'data/' + filename + '.json';

return JsonEx.parse(fs.readFileSync(filename, 'utf8'));
};




Wonder how will that be if you use like 200 maps xD
 
Last edited by a moderator:

Skotty TV

Veteran
Veteran
Joined
Nov 4, 2015
Messages
98
Reaction score
184
First Language
German, English
Primarily Uses
For loading a json from the data directory:


Wonder how will that be if you use like 200 maps xD



Nice!


Thank you a lot! BD


Works fine!


Btw: Tested now with 150 maps.... (whole map.json data!)


2-3 Seconds to load game, 138-142 FPS.


So everything is ok :D


You will get credited for your help!


I will send you a private massage as soon the plugin is finished.


This can be closed.
 
Last edited by a moderator:

Lantiz

PunyMagus
Veteran
Joined
Dec 29, 2012
Messages
723
Reaction score
1,075
First Language
Portuguese
Primarily Uses
Other
Awesome!


Glad I could help, you don't need to worry about credtis [:


I'll wait the message tho.


Be cautious about that speed, maybe it's fast because your machine is fast. I guess It's always nice to think about the budget players.


Cheers!
 

Latest Threads

Latest Posts

Latest Profile Posts

After gathering, sorting out & reconsidering hundreds of enemy battlers over the last two das, finally my favorite part begins: Inventing names and lore for them all :D
I'm running a sale for Learn RPG Maker MV on Itch.io, can I compete with NSFW games earning goals?
Another Friday and another Zoom call that could have been an email. Working from home is awesome.
Finished with the semester; finally have some time to play around with MV :kaopride:
Started work on the fishing Mini-Game

Forum statistics

Threads
111,369
Messages
1,060,530
Members
144,698
Latest member
punisama
Top