Jump to content
Sign in to follow this  
vienna1210

Reading files

Recommended Posts

Hi all

is it possible to read out information from any other files with arma scripts?

for example, i have a .txt file with info, and want arma2 to read out this file, when map starts.

any chance so far?

regards

Vienna.

Share this post


Link to post
Share on other sites

loadFile can load any file type inside your arma2 folder from what I know.

Share this post


Link to post
Share on other sites

this sounds good.

but how it will be loaded...i mean, which format and how to read the content of the loaded file?

Share this post


Link to post
Share on other sites

You'll get it as a string. At that point you will have to parse it to extract any useful information you want.

Alternatively, preprocess it outside of arma to produce code that creates data structures you want then use "call compile loadfile".

Eg

====FILE======

myList=[1,2,3,4,5,6];

aString="here's a string";

====ENDFILE====

call compile loadfile "FILE" ; will cause myList and aString to be added to the global namespace.

Share this post


Link to post
Share on other sites

thank you very much...this explains it.

and b.t.w. :D

how does it work, when i want arma2 to write data into a file?

something like a save or so, i mentioned.

sorry, but with this arma engine i dont find anything usefull on google yet.

thanks and regards

Vienna

Share this post


Link to post
Share on other sites

There is a lot of useful information on the Biki (command reference at http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2).

Unfortunately, saving to a file is a lot less easy. Depending on what you are trying to achieve, one approach is to use diag_log to dump text to the rpt file then post-process it to create something you can load with loadFile.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×