Hello,

I'm trying to get data out of a text file to read out player movement keys.
I'm using the following code (relevant piece) to do so:

Code:
var fhandle_n = file_open_read("keyMapping.ini"); // open file
	STRING* tempStr = str_create("");
	STRING* getCurrentKey = str_create("");
	
	// get player number from file
	str_cpy(tempStr, "player");
	str_cat(tempStr, str_for_int(NULL, playerStoreNumber+1));
	error(tempStr);
	file_str_read(fhandle_n, tempStr);
	error(tempStr);

	file_close(fhandle_n); // close file



now, playerStoreNumber is a global variable, that gets increased upon every player that is placed in the level.
Currently, I have 2 player models, and thus, this piece of code gets executed twice.
I've put in error's to see what my string outputs.
So the first time it says: player1, then the second one again after the file_str_read says player1 as well...
Nothing wrong yet, but when i run this function again (to initialise the key setup for the 2nd player; the first time i get player2, but right after the file_str_read, it displays player1 again...

I cant see why this should be a bug for me; since i only do a engine function call... Hope this info is usefull, but to be certain im not doing anything wrong, here's how my keyMapping.ini file looks like:

Code:
player1,w,a,s,d,q,e,c,r
player2,i,j,k,l,u,o,m,y



like I said, both times, I get the data from player1 only, even though the string appended does state player2 the second time, but get's reset after a file_str_read call.

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/