22.02.2017, 22:36
Hey everyone,
I'm currently looking for the best file reader include or plugin to read from a file that can be easily edited with a text editor or program. I will be using it to load multiple objects into the game and want to ability to add more to the file so it can be loaded on the fly (Dynamically)
Structure of file
Then I have a function something like
NOTE: wrote this code here on the forum (EXAMPLE ONLY)
I've been looking at a few different options but from what I can see none really want to do what I want.
y_ini, dini, dini2, sqlite, djson, xml reader
Some of these may do what I want Such as XML reader will. However its not the easiest thing to edit and you have to put tags on everything. This is the same with djson i believe. I am wanting something simple like the INI format of things, but cant find a way of easily reading while in a loop.
I'm currently looking for the best file reader include or plugin to read from a file that can be easily edited with a text editor or program. I will be using it to load multiple objects into the game and want to ability to add more to the file so it can be loaded on the fly (Dynamically)
Structure of file
Код:
NonTagedData = nottaged [Object 1] ObjectID = xxx ObjectPosX = xxx.xxx ObjectPosY = xxx.xxx ObjectPosZ = xxx.xxx [Object 2] ObjectID = xxx ObjectPosX = xxx.xxx ObjectPosY = xxx.xxx ObjectPosZ = xxx.xxx [Object 3] ObjectID = xxx ObjectPosX = xxx.xxx ObjectPosY = xxx.xxx ObjectPosZ = xxx.xxx [Object 4] ObjectID = xxx ObjectPosX = xxx.xxx ObjectPosY = xxx.xxx ObjectPosZ = xxx.xxx ISLAST = 1
NOTE: wrote this code here on the forum (EXAMPLE ONLY)
Код:
new ID, Float:x, Float:y, Float:z, nottaggeddata[32]; for(new i=1; i<MAX_OBJECTS; i++) { new ISLAST = 0; new file = file_read("Objects.ini"); new str[32]; file_String(file, "", "NonTagedData", nottaggeddata, 32); format(str, 32, "Object %i", i); ID = file_Int(file, str, "ObjectID"); x = file_Float(file, str, "ObjectPosX "); y = file_Float(file, str, "ObjectPosY "); z = file_Float(file, str, "ObjectPosZ "); ISLAST = file_Int(file, str, "ISLAST"); CreateObject(ID, x, y, z); if(ISLAST) break; }
y_ini, dini, dini2, sqlite, djson, xml reader
Some of these may do what I want Such as XML reader will. However its not the easiest thing to edit and you have to put tags on everything. This is the same with djson i believe. I am wanting something simple like the INI format of things, but cant find a way of easily reading while in a loop.