Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, NewbieZorro), 16,055 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
1 of my highscore field didnt refresh after updating #216614
07/17/08 20:58
07/17/08 20:58
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
Please download this small code (but long to post here).
[DOWNLOAD]

When I enter new record and save into .txt file, everything is ok except 1 of the field didn't refresh. If I quit and reload the game, the highscore is up to date.

I tried something like this but still no luck:

0. Display Highscore Using Panel <-- here is the problem
1. Game load
2. Load highscore.txt
3. Prompt for new record
4. Bubble sort
5. Save into highscore.txt
6. Load highscore.txt <-- I hope this can solve my problem but still not ok

Re: 1 of my highscore field didnt refresh after updating [Re: Coisox] #216641
07/18/08 01:32
07/18/08 01:32
Joined: Aug 2005
Posts: 1,230
M
MichaelGale Offline
Serious User
MichaelGale  Offline
Serious User
M

Joined: Aug 2005
Posts: 1,230
I tried something like this:

0. Helping others <-- here is the problem
1. Open the thread
2. Read the post
3. Search for code that can be fixed <-- This could help, but it's not there

wink


Your friendly mod is at your service.
Re: 1 of my highscore field didnt refresh after updating [Re: MichaelGale] #216652
07/18/08 05:42
07/18/08 05:42
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
Sorry Michael, I'm not really get what you mean. Did you mean I asked too many questions here and my help:ask ratio didn't qualified for another help?

How can I help other people when I'm too new and not good enough? I did answered other people problems that are within my capability. It's just too few for you to notice.

Regarding searching in the forum, yes I did and found several quite similar coding but not match my problem.

Please help me.

Re: 1 of my highscore field didnt refresh after updating [Re: Coisox] #216717
07/18/08 12:45
07/18/08 12:45
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
he tried to say that your question is odd and that we cant help you with only that kind of explanation. give us more details and part of the code where is the error.



Ubi bene, ibi Patria.
Re: 1 of my highscore field didnt refresh after updating [Re: croman] #216730
07/18/08 14:01
07/18/08 14:01
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
The code is too long. So I have to put a download link (on my 1st post) to my code.

Ok, here's my code which is very ugly. I'm not sure which part is the error but must has something to do with how I use pointer (this is my 1st time using pointer). It's better for you to download the code and open using ur compiler:

Code:
#include <acknex.h>
#include <default.c>

var GameLevel = 9;
var GameElapsed = 0;

FONT* fontHighScore = "Arial#20b";

STRING* PlayerName  = "#40";
STRING* HOF_Name_00 = "Anonymous";
STRING* HOF_Name_01 = "Anonymous";
STRING* HOF_Name_02 = "Anonymous";

var HOF_Level[3];
var HOF_Elapsed[3];

PANEL* HallOfFame =
{
	layer = 3;
	
	digits (50,  50, HOF_Name_00, fontHighScore, 0, 0);
	digits (50,  70, HOF_Name_01, fontHighScore, 0, 0);
	digits (50,  90, HOF_Name_02, fontHighScore, 0, 0);
	
	digits (400,  50, "%03.0f", fontHighScore, 1, HOF_Level[0]);
	digits (400,  70, "%03.0f", fontHighScore, 1, HOF_Level[1]);
	digits (400,  90, "%03.0f", fontHighScore, 1, HOF_Level[2]);
	
	digits (500,  50, "%06.0f secs", fontHighScore, 1, HOF_Elapsed[0]);
	digits (500,  70, "%06.0f secs", fontHighScore, 1, HOF_Elapsed[1]);
	digits (500,  90, "%06.0f secs", fontHighScore, 1, HOF_Elapsed[2]);
	
	flags = VISIBLE;
}

TEXT* InputName =	
{
  layer = 4;
  pos_x = 50;
  pos_y = 500;
  font = fontHighScore;
  string (PlayerName);
  flags = VISIBLE;
} 

function HOFRead()
{
	var filehandle;
	
	filehandle = file_open_read("hs_name.txt");
		file_str_read(filehandle,HOF_Name_00);
		file_str_read(filehandle,HOF_Name_01);
		file_str_read(filehandle,HOF_Name_02);
	file_close(filehandle);
	
	filehandle = file_open_read("hs_level.txt");
		var temp0; for (temp0=0; temp0<3; temp0++) HOF_Level[temp0] = file_var_read(filehandle);
	file_close(filehandle);
	
	filehandle = file_open_read("hs_elapsed.txt");
		var temp0; for (temp0=0; temp0<3; temp0++) HOF_Elapsed[temp0] = file_var_read(filehandle);
	file_close(filehandle);
}

function HOFWrite()
{
	var filehandle;
	
	filehandle = file_open_write("hs_name.txt");
		file_str_write(filehandle,HOF_Name_00);
		file_str_write(filehandle,",");
		file_str_write(filehandle,HOF_Name_01);
		file_str_write(filehandle,",");
		file_str_write(filehandle,HOF_Name_02);
	file_close(filehandle);
	
	filehandle = file_open_write("hs_level.txt");
		var temp0; for (temp0=0; temp0<3; temp0++) file_var_write(filehandle,HOF_Level[temp0]);
	file_close(filehandle);
	
	filehandle = file_open_write("hs_elapsed.txt");
		var temp0; for (temp0=0; temp0<3; temp0++) file_var_write(filehandle,HOF_Elapsed[temp0]);
	file_close(filehandle);
}

function HOFUpdate()
{
	// bubble sort
	//=============================================================
		STRING* tempName;
		var tempLevel;
		var tempElapsed;
		var temp0;
		var pass;
		
		for(pass=0; pass<3; pass++)
		{
			for (temp0=2; temp0>0; temp0--)
			{
				if (HOF_Level[temp0] > HOF_Level[temp0-1] || (HOF_Level[temp0] == HOF_Level[temp0-1] && HOF_Elapsed[temp0] < HOF_Elapsed[temp0-1]) )
				{
					tempLevel = HOF_Level[temp0-1];
					tempElapsed = HOF_Elapsed[temp0-1];
					switch (temp0)
					{
						case 1:
							tempName = HOF_Name_00;
							HOF_Name_00 = HOF_Name_01;
							HOF_Name_01 = tempName;
							break;
						case 2:
							tempName = HOF_Name_01;
							HOF_Name_01 = HOF_Name_02;
							HOF_Name_02 = tempName;
							break;
					}
					HOF_Level[temp0-1] = HOF_Level[temp0];
					HOF_Elapsed[temp0-1] = HOF_Elapsed[temp0];
					HOF_Level[temp0] = tempLevel;
					HOF_Elapsed[temp0] = tempElapsed;
				}
			}
		}

		HOFWrite();
}

function HOFEnterNewRecord()
{
	HOF_Elapsed[2] = GameElapsed;
	result = inkey(PlayerName); // wait until [enter] pressed]
	HOF_Name_02 = PlayerName;
	HOF_Level[2] = GameLevel;
	HOFUpdate();
}

function HOFCheckQualify()
{
	if (GameLevel > HOF_Level[2] || (GameLevel == HOF_Level[2] && GameElapsed < HOF_Elapsed[2])) HOFEnterNewRecord();
}

function main()
{
	video_mode = 8;
	video_window(nullvector,nullvector,1,NULL);
	vec_set(screen_color,vector(128,128,128));
	
	HOFRead();
	wait(-2);
	GameElapsed = 999;
	HOFCheckQualify();
}


Re: 1 of my highscore field didnt refresh after updating [Re: MichaelGale] #216734
07/18/08 14:08
07/18/08 14:08
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
Sorry Michael, I misunderstand what you are trying to say. Sorry again...


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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