Architheutis
Member
Hi guys,
I´ve got some trouble with my highscore table, before xmas.
I programmed some objects and put them into different rooms in senseful order.
programmed a name-entry screen for it, too. Everything works, but any time I
finished the name entry in testing-mode, GMS2 says:
FATAL ERROR in
action number 1
of Key Press Event for <Enter> Key
for object oAlphabetRun:
ini_write_real argument 3 incorrect type (string) expecting a Number (YYGR)
at gml_Object_oAlphabetRun_KeyPress_13 (line 26) - ini_write_real(string(i), "SCORE", global.score_array[i, 1]);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oAlphabetRun_KeyPress_13 (line 26)
The concerning non-sprited object has following codes:
As you can see, the previously described error report is coming from
ini_write_string(string(i), "NAME", global.score_array[i, 0]);
ini_write_real(string(i), "SCORE", global.score_array[i, 1]);
within the keypressed enter-block. Can anybody see what I can´t see becuz of
my business blindness? Ghaa!!!
If we don´t communicate until Santa´s Rising, I wish you all a peacefull
and fat...
. . . . . . . . . . . . . .
. . . . . . . . . . . . .
MERRY X-MAS!
Archie.
I´ve got some trouble with my highscore table, before xmas.
I programmed some objects and put them into different rooms in senseful order.
programmed a name-entry screen for it, too. Everything works, but any time I
finished the name entry in testing-mode, GMS2 says:
FATAL ERROR in
action number 1
of Key Press Event for <Enter> Key
for object oAlphabetRun:
ini_write_real argument 3 incorrect type (string) expecting a Number (YYGR)
at gml_Object_oAlphabetRun_KeyPress_13 (line 26) - ini_write_real(string(i), "SCORE", global.score_array[i, 1]);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oAlphabetRun_KeyPress_13 (line 26)
The concerning non-sprited object has following codes:
Code:
CREATE
image_index = 0;
image_speed = 0;
if !audio_is_playing(au_HighscoreSound){
audio_play_sound(au_HighscoreSound,1,true);
}
letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890@*?!&_+-"
position = 1;
name = "";
limit = 12;
w = room_width/2;
h = room_height/2;
STEP
if keyboard_check_pressed(vk_right){
position += 1;
if position>string_length(letter){
position = 1;
}
}
if keyboard_check_pressed(vk_left){
position -= 1;
if position < 1 {
position = string_length(letter)}
}
if keyboard_check_pressed(vk_down){
if string_length(name)<limit {
name += string_char_at(letter, position)}
}
if keyboard_check_pressed(vk_up){
name = string_delete(name, string_length(name), 1)}
DRAW
draw_set_font(Kiddybox_Font3);
draw_set_halign (fa_center);
draw_set_valign (fa_center);
draw_text(w, h+65, name);
draw_set_font(Kiddybox_Font4);
draw_set_halign (fa_center);
draw_set_valign (fa_center);
draw_text(w, h-54, string_char_at(letter, position));
KEYPRESSED ENTER
global.name = name;
ini_open("HighScoreSA.ini");
for (i = 0; i < 10; i++)
{
global.score_array[i, 0] = ini_read_string(string(i), "NAME", "............");
global.score_array[i, 1] = ini_read_real(string(i), "SCORE", 0);
}
ini_close();
for (i = 0; i < 10; i++){
if (score>global.score_array[i, 1]){
for (j = 9; j > i; j--){
global.score_array[j, 0] = global.score_array[j-1,0];
global.score_array[j, 1] = global.score_array[j-1,0];}
global.score_array[i, 0] = global.name;
global.score_array[i, 1] = score;
break;
}
}
ini_open("HighScoreSA.ini")
for (i = 0; i < 10; i++){
ini_write_string(string(i), "NAME", global.score_array[i, 0]);
ini_write_real(string(i), "SCORE", global.score_array[i, 1]);
}
ini_close();
room_goto(Highscore);
As you can see, the previously described error report is coming from
ini_write_string(string(i), "NAME", global.score_array[i, 0]);
ini_write_real(string(i), "SCORE", global.score_array[i, 1]);
within the keypressed enter-block. Can anybody see what I can´t see becuz of
my business blindness? Ghaa!!!
If we don´t communicate until Santa´s Rising, I wish you all a peacefull
and fat...
. . . . . . . . . . . . . .
. . . . . . . . . . . . .
MERRY X-MAS!
Archie.