K
kuroyuki4
Guest
Hi everyone,
I'm having a problem with a high score table I'm programming for my game. It's intended to show up if the player scores high enough to place somewhere on the table and allow them to enter their initials. However, nothing is being displayed on the table at all (though the player can still "enter" their initials just fine).
The initials are also not being saved at all; there's just blank space there instead of, for example, "E.C". How can I fix this?
Code that selects the position to overwrite:
Code that is supposed to display the high score table:
The code that replaces the place values with characters is essentially "if argument0 = x {argument0 = string(val)}". Maybe this is why it isn't being saved correctly?
EDIT: I forgot to include the code that's supposed to append the characters.
I'm having a problem with a high score table I'm programming for my game. It's intended to show up if the player scores high enough to place somewhere on the table and allow them to enter their initials. However, nothing is being displayed on the table at all (though the player can still "enter" their initials just fine).
The initials are also not being saved at all; there's just blank space there instead of, for example, "E.C". How can I fix this?
Code that selects the position to overwrite:
Code:
if score >= global.entry5Score and score < global.entry4Score
{
global.overwrite = 5
global.entry5Score = score
instance_deactivate_object(self)
exit
}
if score >= global.entry4Score and score < global.entry3Score
{
global.overwrite = 4
global.entry4Score = score
instance_deactivate_object(self)
exit
}
if score >= global.entry3Score and score < global.entry2Score
{
global.overwrite = 3
global.entry3Score = score
instance_deactivate_object(self)
exit
}
if score >= global.entry2Score and score < global.entry1Score
{
global.overwrite = 2
global.entry2Score = score
instance_deactivate_object(self)
exit
}
if score >= global.entry1Score
{
global.overwrite = 1
global.entry1Score = score
instance_deactivate_object(self)
exit
}
Code that is supposed to display the high score table:
Code:
if global.displayHighScores = true
{
{
draw_set_font(global.highScoreFont)
draw_set_color($FFFFFF)
draw_set_halign(fa_center)
format2timeout = string_format(global.timeoutPeriod,2,0)
format8entry1Score = string_format(global.entry1Score,8,0)
format8entry2Score = string_format(global.entry2Score,8,0)
format8entry3Score = string_format(global.entry3Score,8,0)
format8entry4Score = string_format(global.entry4Score,8,0)
format8entry5Score = string_format(global.entry5Score,8,0)
leading0entry1Score = string_replace_all(format8entry1Score," ","0")
leading0entry2Score = string_replace_all(format8entry2Score," ","0")
leading0entry3Score = string_replace_all(format8entry3Score," ","0")
leading0entry4Score = string_replace_all(format8entry4Score," ","0")
leading0entry5Score = string_replace_all(format8entry5Score," ","0")
leading0timeout = string_replace_all(format2timeout," ","0")
}
{
if global.highScoreEntry = true
{
draw_text(112,0,"HIGH SCORES")
draw_text(112,48,"CONGRATULATIONS!")
draw_text(112,80,"ENTER YOUR NAME")
draw_text(112,216,"TIME REMAINING: " + string(leading0timeout))
}
{
if global.overwrite = 1
{
draw_text(112,120,"*1 " + string(leading0entry1Score))
draw_text(112,136,"*2 " + string(global.entry2Name) + " " + string(leading0entry2Score))
draw_text(112,152,"*3 " + string(global.entry3Name) + " " + string(leading0entry3Score))
draw_text(112,168,"*4 " + string(global.entry4Name) + " " + string(leading0entry4Score))
draw_text(112,184,"*5 " + string(global.entry5Name) + " " + string(leading0entry5Score))
draw_sprite(highScoreCharSet,global.place1,56,120)
draw_sprite(highScoreCharSet,global.place2,64,120)
draw_sprite(highScoreCharSet,global.place3,72,120)
}
if global.overwrite = 2
{
draw_text(112,120,"*1 " + string(global.entry1Name) + " " + string(leading0entry1Score))
draw_text(112,136,"*2 " + string(leading0entry2Score))
draw_text(112,152,"*3 " + string(global.entry3Name) + " " + string(leading0entry3Score))
draw_text(112,168,"*4 " + string(global.entry4Name) + " " + string(leading0entry4Score))
draw_text(112,184,"*5 " + string(global.entry5Name) + " " + string(leading0entry5Score))
draw_sprite(highScoreCharSet,global.place1,56,136)
draw_sprite(highScoreCharSet,global.place2,64,136)
draw_sprite(highScoreCharSet,global.place3,72,136)
}
if global.overwrite = 3
{
draw_text(112,120,"*1 " + string(global.entry1Name) + " " + string(leading0entry1Score))
draw_text(112,136,"*2 " + string(global.entry2Name) + " " + string(leading0entry2Score))
draw_text(112,152,"*3 " + string(leading0entry3Score))
draw_text(112,168,"*4 " + string(global.entry4Name) + " " + string(leading0entry4Score))
draw_text(112,184,"*5 " + string(global.entry5Name) + " " + string(leading0entry5Score))
draw_sprite(highScoreCharSet,global.place1,56,152)
draw_sprite(highScoreCharSet,global.place2,64,152)
draw_sprite(highScoreCharSet,global.place3,72,152)
}
if global.overwrite = 4
{
draw_text(112,120,"*1 " + string(global.entry1Name) + " " + string(leading0entry1Score))
draw_text(112,136,"*2 " + string(global.entry2Name) + " " + string(leading0entry2Score))
draw_text(112,152,"*3 " + string(global.entry3Name) + " " + string(leading0entry3Score))
draw_text(112,168,"*4 " + string(leading0entry4Score))
draw_text(112,184,"*5 " + string(global.entry5Name) + " " + string(leading0entry5Score))
draw_sprite(highScoreCharSet,global.place1,56,168)
draw_sprite(highScoreCharSet,global.place2,64,168)
draw_sprite(highScoreCharSet,global.place3,72,168)
}
if global.overwrite = 5
{
draw_text(112,120,"*1 " + string(global.entry1Name) + " " + string(leading0entry1Score))
draw_text(112,136,"*2 " + string(global.entry2Name) + " " + string(leading0entry2Score))
draw_text(112,152,"*3 " + string(global.entry3Name) + " " + string(leading0entry3Score))
draw_text(112,168,"*4 " + string(global.entry4Name) + " " + string(leading0entry4Score))
draw_text(112,184,"*5 " + string(leading0entry5Score))
draw_sprite(highScoreCharSet,global.place1,56,184)
draw_sprite(highScoreCharSet,global.place2,64,164)
draw_sprite(highScoreCharSet,global.place3,72,184)
}
}
}
if global.highScoreEntry = false
{
draw_text(112,0,"HIGH SCORES")
draw_text(112,80,"TOP PLAYERS")
draw_text(112,120,"*1 " + string(global.entry1Name) + " " + string(leading0entry1Score))
draw_text(112,136,"*2 " + string(global.entry2Name) + " " + string(leading0entry2Score))
draw_text(112,152,"*3 " + string(global.entry3Name) + " " + string(leading0entry3Score))
draw_text(112,168,"*4 " + string(global.entry4Name) + " " + string(leading0entry4Score))
draw_text(112,184,"*5 " + string(global.entry5Name) + " " + string(leading0entry5Score))
draw_text(112,216,"CAN YOU BEAT THE")
draw_text(112,224,"TOP SCORE?")
}
}
The code that replaces the place values with characters is essentially "if argument0 = x {argument0 = string(val)}". Maybe this is why it isn't being saved correctly?
EDIT: I forgot to include the code that's supposed to append the characters.
Code:
if global.overwrite = 1
{
global.entry1Name = string(global.place1 + global.place2 + global.place3)
}
if global.overwrite = 2
{
global.entry2Name = string(global.place1 + global.place2 + global.place3)
}
if global.overwrite = 3
{
global.entry3Name = string(global.place1 + global.place2 + global.place3)
}
if global.overwrite = 4
{
global.entry4Name = string(global.place1 + global.place2 + global.place3)
}
if global.overwrite = 5
{
global.entry5Name = string(global.place1 + global.place2 + global.place3)
}
Last edited by a moderator: