Hi everyone!
I am struggeling now

I am trying to make a highscoorelist. Take the players name wiht inkey and save it to a txt file, then at the end of the game take the highscoore and save it to another txt file. Then open them bouth and display them at the same line.
I get the name to show but not the highscoore. I can see that it has been saved, but cant get it to show.
here is how I want it to look like:
1. petter 45678
2. line 37895
Does anyone of you have any suggestions on how to solve this. I cant see it....
Here is my codes:
Code:
var data_handle;
string playerName_str[30];
text playerName_txt
{
font = standard_font;
layer = 30;
pos_x = 300;
pos_y = 275;
string = playerName_str;
}
function add_Player()
{
playerName_txt.string = "Please enter your name.";
playerName_txt.visible = on;
sleep (3); // show the text for 3 seconds
playerName_txt.string = PlayerName_str;
str_cpy(playerName_str, ""); // reset the string
while (str_cmpi (playerName_str, "") == 1) // run this loop until the player has typed something
{
inkey (playerName_str); // store player's input in name_str
wait (1);
playerName_txt.visible = off;
}
data_handle = file_open_write("playerName.txt"); // open (or create and open) this file
file_str_write (data_handle, playerName_str); // write the name of the player to the file
file_close (data_handle);
}
function show_Player()
{
panel_main.visible = off;//close main panel
butt1.visible = off;//close button
butt2.visible = off;//close button
butt3.visible = off;//close button
butt4.visible = off;//close button
butt5.visible = off;//close button
highscoore_pan.visible = on;//open higscoore panel
var filehandle;
filehandle = file_open_read ("playerName.txt");//open the file
file_str_read (filehandle, playerName_str);//we copy the string to display_string
file_close (filehandle);//close the file
playerName_txt.visible = on;//make the text visible
}
//*******************************************//
var highscoore = 1467; //added some scoore so I can see that it is showing....
text highscoore_txt
{
font = standard_font;
layer = 31;
pos_x = 500;
pos_y = 275;
string = highscoore;
}
var scoore_temp;
function save_higscoore("save_scoore.txt")
{
scoore_temp=file_open_write("save_scoore.txt");
file_var_write(scoore_temp,highscoore);
file_close(scoore_temp);
}
function open_higscoore("save_scoore.txt")
{
panel_main.visible = off;//close main panel
butt1.visible = off;//close button
butt2.visible = off;//close button
butt3.visible = off;//close button
butt4.visible = off;//close button
butt5.visible = off;//close button
highscoore_pan.visible = on;//open higscoore panel
scoore_temp=file_open_read("save_scoore.txt");
highscoore = file_var_read(scoore_temp);
file_close(scoore_temp);
highscoore_txt.visible = on;//make the text visible
}
//******************************
Function add_to_highscoorelist()//add player name and highscoore to a txt file
{
add_Player();
save_higscoore();
}
Function show_highscoorelist()//open and shows playername and the players hihgscoore
{
show_Player();
open_higscoore();
}