Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, dr_panther, Quad), 935 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
high score carryover #408332
09/29/12 16:43
09/29/12 16:43
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
How can I use the saved high score, which is in a text file, in an equation in a subsequent level which is a separate game.

Re: high score carryover [Re: JazzDude] #408335
09/29/12 17:10
09/29/12 17:10
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Just read the text file again with the file_open_read/ file... instructions.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: high score carryover [Re: Superku] #408356
09/30/12 04:53
09/30/12 04:53
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Thanks, Superku

I tried this:

Code:
function points_startup()
{
var filehandle;
filehandle = file_open_read("highscore.txt");
if (filehandle)&&(level == 2) 
	{
	   file_str_read(filehandle, name_str);
	   points = file_var_read(filehandle);
	}
else 
{
	str_cpy(name_str, "None");
	points = 0;
}
             
}


But I'm doing something wrong. When level 2 starts the points variable reads 0 instead of the saved high score.

Just had a thought. Maybe I should save the high score as a .dat file instead of a .txt

Last edited by JazzDude; 09/30/12 04:58.
Re: high score carryover [Re: JazzDude] #408361
09/30/12 08:34
09/30/12 08:34
Joined: Nov 2011
Posts: 274
de
lemming Offline
Member
lemming  Offline
Member

Joined: Nov 2011
Posts: 274
de
The extension is irrelevant. The problem is you don't close the file after reading it. http://www.conitec.net/beta/afile_close.htm
So when you start the function a secound time in level 2 the file is still open.
If you don't need access to a file anymore always close it.

Last edited by lemming; 09/30/12 08:36.
Re: high score carryover [Re: lemming] #408409
09/30/12 18:42
09/30/12 18:42
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Thanks. It's working now.

Yes, I found the .dat extension only changes the saved number with decimals.


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

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