Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, degenerate_762, ozgur), 1,311 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
record function adapted from aum 70 #328514
06/13/10 17:34
06/13/10 17:34
Joined: Mar 2003
Posts: 3,010
analysis paralysis
NITRO777 Offline OP
Expert
NITRO777  Offline OP
Expert

Joined: Mar 2003
Posts: 3,010
analysis paralysis
Hello,
I have been attempting to change aum code from aum 70 to simply play data from an external file without reading it first. (The data is created in a different instance of the engine) I have been trying to adapt the code but I have found no way to determine how long the list of numbers in the file is, therefore I cannot set the loop counter fro the read instruction, can anyone help with this?

This is what I have so far...
Code:
function play(entity_number)
{
	STRING* rec_str = "       "; // stores the name of the recorded data file
	STRING* temp_str = "  "; // just a temporary string
	var filehandle;

	
	str_cpy(rec_str, str_for_num(temp_str, entity_number)); // create the name of the data file depending on entity's number
	str_cat(rec_str, ".txt"); // and then add it the ".txt" extension
	filehandle = file_open_read(rec_str); // now we can try to open the file
	if (filehandle) // the file exists? Then open it for playback!
	{
		
		var temp = 0;
		while (temp <= global_index) // read all the array values from the 1.txt... 50.txt files (if they exist)
		{
			recorded_position[temp][entity_number] = file_var_read(filehandle); // and put them inside the array
			temp += 1;
		} 		
		file_close(filehandle); // close the file
		
		
		while (global_counter < 70000) 
	   {
	 	   my.x = recorded_position[global_counter][entity_number]; // restore the xyz
	 	    
				my.y = recorded_position[global_counter + 1][entity_number];
				my.z = recorded_position[global_counter + 2][entity_number];
				my.pan = recorded_position[global_counter + 3][entity_number]; // the angles
				my.tilt = recorded_position[global_counter + 4][entity_number];
				my.roll = recorded_position[global_counter + 5][entity_number];
				my.frame = recorded_position[global_counter + 6][entity_number]; // and the frame number
				wait(1);
				global_counter +=1;
	   }
   }
	
}



I believe it is the global_index variable which I need help determining how long the external text file is.

Thanks very much

Re: record function adapted from aum 70 [Re: NITRO777] #328560
06/13/10 22:10
06/13/10 22:10
Joined: Mar 2003
Posts: 3,010
analysis paralysis
NITRO777 Offline OP
Expert
NITRO777  Offline OP
Expert

Joined: Mar 2003
Posts: 3,010
analysis paralysis
Nevermind I think I got it figured out.

Re: record function adapted from aum 70 [Re: NITRO777] #328767
06/15/10 05:28
06/15/10 05:28
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
The counter will be set at a value that's equal with the number of saved frames.

Re: record function adapted from aum 70 [Re: George] #328796
06/15/10 12:20
06/15/10 12:20
Joined: Mar 2003
Posts: 3,010
analysis paralysis
NITRO777 Offline OP
Expert
NITRO777  Offline OP
Expert

Joined: Mar 2003
Posts: 3,010
analysis paralysis
Hi George thanks for the reply,
I look at the files I developed and they always have the number 1 at every 7th location so in adapting your code I probably messed something up during the writing phase. Otherwise yes perhaps I could look into that idea if I had a way to count the frames.

Re: record function adapted from aum 70 [Re: NITRO777] #329073
06/17/10 11:47
06/17/10 11:47
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
If the "1" repeats periodically you are probably writing a fixed number (not a variable) to the file.


Moderated by  George 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1