Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (EternallyCurious, AndrewAMD, TipmyPip, Quad), 889 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
in need of a simple highscore. #411317
11/15/12 14:08
11/15/12 14:08
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
Hello for my latest little project i am trying to create a
working highscore (No need for name imput)

I use this for now.

Code:
function highscore()
{
	if (score_count >= hscore_count )
	set(highscore_pan,SHOW);
}



basicly i have two var. one is the score_count the other is hscore count wich is set on a certain number. No when highscore is broken i need the hscore_count to go the same as the score from here but also saves this new highscore at game end.

Any ideas or examples you could point me to laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: in need of a simple highscore. [Re: Realspawn] #411319
11/15/12 14:16
11/15/12 14:16
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
As far as I understand you you want to save and load the highscore, is this right?


POTATO-MAN saves the day! - Random
Re: in need of a simple highscore. [Re: Kartoffel] #411320
11/15/12 14:28
11/15/12 14:28
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Well if I understood you right here's a small - not testet - example:

Code:
#define HIGH_SCORE_SAVE_FILE "hs.score"

TEXT* input_file = { strings = 1; } // used to load saved information, only one string needed

void load_highscore()
{
	txt_load(input_file, HIGH_SCORE_SAVE_FILE);
		wait(1); // wait one frame to load the text file - important!
	
	hscore_count = str_to_float( (input_file.pstring)[0] ); // (<text>.pstring) [ line, beginning with 0! ] -> convert to float
}

void save_highscore()
{
	var file_handle = file_open_write(HIGH_SCORE_SAVE_FILE);
	wait(1); // wait to open the file?? - not sure if this is needed
	
	file_str_write(file_handle, str_for_float(NULL, (double)hscore_count)); // convert the highscore to a string -> write into file
	file_close(file_handle);
}



POTATO-MAN saves the day! - Random
Re: in need of a simple highscore. [Re: Kartoffel] #411323
11/15/12 14:38
11/15/12 14:38
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
that's indeed what i ment. I will give this a shot laugh
so do i need to create a txt file first and put it in my work directory ?

Last edited by Realspawn; 11/15/12 14:45.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: in need of a simple highscore. [Re: Realspawn] #411326
11/15/12 14:49
11/15/12 14:49
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Well actually no wink
The file gets written automatically if you call save_highscore();
and if it already exists it gets overwritten, so theres no need to delete the file before writing a new highscore over it.

I defined the file name in my example with:
#define HIGH_SCORE_SAVE_FILE "hs.score"

EDIT: thats not very secure... but with an easy encryption it should be secure enough smile
EDIT#2: if you need some help with en- and decrypting the highscore let me know wink

Last edited by Kartoffel; 11/15/12 15:21.

POTATO-MAN saves the day! - Random

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