This is how I've done it (the part with changing specific line in the string):
Code:
void save_into_file(){
	
	STRING* read_str = ""; STRING* write_str = ""; 
	STRING* before_str = ""; STRING* after_str = "";
	
	var fhandle = file_open_read("map.dat");
	if(fhandle == NULL){ error("File wasn't found!"); return; }
	
	var len_var = file_length(fhandle);	
	file_str_readto(fhandle, read_str, ";", len_var);	
	file_close(fhandle);
	
	// BEFORE string:
	var start_var = str_stri(read_str, "[ROOM 2]");
	str_cut(before_str, read_str, 0, start_var + 7);
	
	// AFTER string:
	var end_var = str_stri(read_str, "[ROOM 3]");
	str_cut(after_str, read_str, end_var, len_var);
	
	// get the part of the string, where we need to change stuff:
	str_cut(write_str, read_str, start_var + 8, end_var - 1);
	str_cpy(write_str, "THIS IS NOT THE SECOND ROOM!");
	
	// add empty space:
	str_cat(before_str, " ");
	// use that empty space to move pointer to the next line:
	str_setchr(before_str, str_len(before_str), 10);
	
	// add empty space to the stuff we've changed:
	str_cat(write_str, " ");
	// add changes to BEFORE string:
	str_cat(before_str, write_str);
	// use empty space at the end to move pointer to the next line:
	str_setchr(before_str, str_len(before_str), 10);
	// add AFTER str (so the whole string is complete now)
	str_cat(before_str, after_str);
	
	// write this all into the file:
	var fhandle = file_open_write("map.dat");
	file_str_write(fhandle, before_str);
	file_close(fhandle);
}

This code, changed txt file, with this:
Quote:
[ROOM 1]
This is first room!
[ROOM 2]
This is second room!
[ROOM 3]
This is third room!
[ROOM 4]
This is fourth room!
Into this:
Quote:
[ROOM 1]
This is first room!
[ROOM 2]
THIS IS NOT THE SECOND ROOM!
[ROOM 3]
This is third room!
[ROOM 4]
This is fourth room!
Maybe it may come in handy for someone. Didn't test it any farther, maybe it won't work in some situations grin

Greets!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung