Jump to content
  • 0

Loading files from the file system (cached - content always the same)


jahangir13

Question

Hi all,

 

maybe someone has an idea or solution for this:

 

If I load a file from the file system, e.g. via loadFile or preprocessFile, I can only load it once per mission load/reload. Means I change the content of the file each x seconds and if I login with my player and have a look at the output of the diag_log command I have in my script the output always has the same content, until I relogg again.

 

Is there any way to switch off this caching of files (or how to call it). I mean if I create a new file with a new name (file1.sqf, file2.sqf, file3.sqf,...) this new file gets loaded with the updated content...but if I read the same filename again and again it shows always the same content.

 

2.) Is there a way to delete files from the file system via the game?

 

jahan.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Not sure what you are trying to do here... loading something for the server to use via those load options simply gives the server the instruction it needs... it's not supposed to change itself. 

 

Can you give a better example? 

Link to comment
Share on other sites

  • 0

Just want to know if there is a way to do it ,)

No, I am using the Linux server version. Everything going via Hive is not available there. So everything is loaded via files.

It's a real pain if you want to load changing things via files due to this caching mechanism. Real events are not working just as an example. I wrote a 'Hive' function to get freash date/time to a file. I now need a new file everstime I want to allow the player to get the updates values. Things like that.

Did not read anything so far which gows around this...so I think it's not possible (and I always need a mechanism how to change the files).

But maybe someone know a way which I did not think of or heard of so far.

Link to comment
Share on other sites

  • 0

Do you know the Linux port? Do you ask too many questions ;))

 

No, you can use these functions from the server files and it will read files from the server directory.

 

Example from the server_playerLogin.sqf (server pbo):

//Do Connection Attempt
_doLoop = 0;
while {_doLoop < 5} do {
    _key = format["CHILD:101:%1:%2:%3:",_playerID,dayZ_instance,_playerName];
    diag_log (_key);
        _key = format["\cache\players\%1\%2.sqf", MyPlayerCounter, _playerID];
        diag_log ("LOAD PLAYER: "+_key);
        _res = preprocessFile _key;
        diag_log ("PLAYER CACHE: "+_res);

        .....

 

...and so on. The files are loaded from the server file system (here e.g directory cache). All Hive calls (which are non-existent for Linux so far) are handled by logging to the server-log and parsing these things (CHILD:xxx:yyy:) via perl. All database communication is then handled by this script. Answers are written into these files and loaded back into the server.

 

But as I said. 1 file only once per player login or mission read (or don't know exactly). I can load another file name but not the same (or with the same old content).

But ok...seems that this is the way it works and I need to go around this which is a bit annoying.

 

Never used Arma2net...but sounds a bit like this (for windows then). Custom sql calls, is it that?

Link to comment
Share on other sites

  • 0

Do you know the Linux port? Do you ask too many questions ;))

 

No, you can use these functions from the server files and it will read files from the server directory.

 

Example from the server_playerLogin.sqf (server pbo):

//Do Connection Attempt

_doLoop = 0;

while {_doLoop < 5} do {

    _key = format["CHILD:101:%1:%2:%3:",_playerID,dayZ_instance,_playerName];

    diag_log (_key);

        _key = format["\cache\players\%1\%2.sqf", MyPlayerCounter, _playerID];

        diag_log ("LOAD PLAYER: "+_key);

        _res = preprocessFile _key;

        diag_log ("PLAYER CACHE: "+_res);

        .....

 

...and so on. The files are loaded from the server file system (here e.g directory cache). All Hive calls (which are non-existent for Linux so far) are handled by logging to the server-log and parsing these things (CHILD:xxx:yyy:) via perl. All database communication is then handled by this script. Answers are written into these files and loaded back into the server.

 

But as I said. 1 file only once per player login or mission read (or don't know exactly). I can load another file name but not the same (or with the same old content).

But ok...seems that this is the way it works and I need to go around this which is a bit annoying.

 

Never used Arma2net...but sounds a bit like this (for windows then). Custom sql calls, is it that?

 

Yeah it sounds about the same...meaning you can query your own made SQL tables right ? I guess you probably now how to expand that script to make your own call to custom tables right?

I am not sure what the limit in characters a linux SQL can bring....but based on arma OA beta patch it was cut down substantially a few beta releases back.

Now if the script your are trying to call is small in size...you could put all the script inside a longtext table cell in the database, then with a custom SQL 'select' it from the database and then call compile the value that holds the cell.

I've tested this and it works 100%....but the catch is its not working for long scripts....i just managed to spawn the skalisty bridge...that i saved in the database.

Now....probably...(not sure how to make it though), you could 'select' partially an SQL table and then loop that selection till you reach the end of the cell...then merge all the values into 1 variable and then you'll have your whole script in one variable which you can call compile again and voila...you got your whole script loaded from a database instead of a file.

 

The above would also work with the SQL equivalent to get the server's time/date...you can 'select' the current date time and get the real time into your scripts:

SELECT SYSDATETIME()
    ,SYSDATETIMEOFFSET()
    ,SYSUTCDATETIME()
    ,CURRENT_TIMESTAMP
    ,GETDATE()
    ,GETUTCDATE();
/* Returned:
SYSDATETIME()      2007-04-30 13:10:02.0474381
SYSDATETIMEOFFSET()2007-04-30 13:10:02.0474381 -07:00
SYSUTCDATETIME()   2007-04-30 20:10:02.0474381
CURRENT_TIMESTAMP  2007-04-30 13:10:02.047
GETDATE()          2007-04-30 13:10:02.047
GETUTCDATE()       2007-04-30 20:10:02.047

All the above will work only if you can write custom SQL queries..Epoch doesnt have 999 calls....hence the mentioning of Arma2Net...With arma2net you can do that...but like you said it wasnt working for linux.

Although i am 98% sure that i read somewhere in the arma2net forum that its been done in linux...and there were instructions as well on how to do it.

 

Loadfile will always work the way it does now...its caching the mission file..and you can only use that cache. Same thing goes for .html files. You can put descriptions and text as .html...but they all have to be inside the mission file to load them.

Maybe in linux things are a bit different...i dont know...what i do know is that what you want can be done with mysql queries and tables...Only question is how 'bad' you want this script to happen to write yourself a 'loop'/'join' script to grab that special cell from the database and make it a variable and then an executable script ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...