Originally Posted By: 3run
F.e. I would like to write all levels into one .txt file (or maybe separate all entities by types in the file), organize it like .ini file:
Quote:
[level1] list of entities
[level2] list of entities
If you guys would give me any advices about this, I would really appreciate it.
, with writing to txt file (simple example):
Code:
function file_skip1line(var handle_file)
{	
	file_asc_write(handle_file, 13); //new line
	file_asc_write(handle_file, 10);
}

...
function write_to_txtblabla() {
  var handle_file = file_open_write (filepath_str);
  file_str_write(handle_file, "Enemy 1");
  file_skip1line(handle_file);
  file_str_write(handle_file, "Enemy 2");
  file_close(handle_file);
}



For loading than use file_str_readto and str_parse is usefull too. Now for skipping to a certain string/point maybe try file_find , not sure about that one though. For only reading out number you can try file_var_read. Alternatively you can use txt_load if the text is not to big and use lite-c string functions to do your Acknex magic, than you can check with str_cmpni to check delimiters/strings that divide entities or levels or whatever.
For both you want some kind of delimiter/string to divide stuff in your text file, or keywords that help you find specific stuff like 'Damage:'.

This might also be helpfull to find specific stuff when you have it in your string:

Quote:
str_parse_tail(STRING* to,char*from,char* tail)
str_parse_head(STRING* to,char*from,char* head)
Extracts a word out of a string when its last characters (str_parse_tail) or its first characters (str_parse_head) are given.

Last edited by Reconnoiter; 09/21/16 09:42.