Post #1 · Posted at 2015-01-08 06:43:50pm 9.2 years ago
Th3_Ov3rHell_3XoduZ | |
---|---|
Member | |
313 Posts | |
Reg. 2012-09-13 | |
"ITG, The Best Dance Machine!" |
Last updated: 2015-01-10 01:51am
If I choose a song in Expert, on the next screen "ScreenStageInfomation" it show me the current grade of the selected difficulty that is saved in the profile but I never used it and I delete it (stupid)...
Now I need this code but I cant remember how i made it... Anyone here can help me to do that...
Thanks anyway
Post #2 · Posted at 2015-01-08 08:43:45pm 9.2 years ago
dbk2 | |
---|---|
Member | |
332 Posts | |
Not Set | |
Reg. 2012-04-30 | |
So, you want to get the letter Grade for the top high score associated with the selected chart?
Start by looking here: https://github.com/dguzek/Simply-Love-SM5/blob/master/BGAnimations/ScreenSelectMusic%20overlay/panedisplay.lua
Lines 229-269 show how you can get a MachineProfile high score, and lines 324-368 show the same for a player's profile. Either one of those will give you the percent score.
Lua.xml shows that there is a global function GetGradeFromPercent() that you can pass a percentage and will return a grade tier.
I haven't used it, but in theory, it would work like...
-- replace percent_score with an actual score...
local percent_score = 77.41
-- get the long form of the grade tier; this will be something like "Grade_Tier02"
local grade_tier = GetGradeFromPercent(percent_score)
-- truncate the string so that "Grade_Tier02" becomes "Tier02"
local grade_tier_short = ToEnumShortString(grade_tier)
-- you have the grade_tier now, so use it to load the appropriate graphic
LoadActor(THEME:GetPathG("", "_grades/"..grade_tier_short..".png"))..{
Name="Grade",
InitCommand=cmd()
}
Hopefully that gets you started.
Start by looking here: https://github.com/dguzek/Simply-Love-SM5/blob/master/BGAnimations/ScreenSelectMusic%20overlay/panedisplay.lua
Lines 229-269 show how you can get a MachineProfile high score, and lines 324-368 show the same for a player's profile. Either one of those will give you the percent score.
Lua.xml shows that there is a global function GetGradeFromPercent() that you can pass a percentage and will return a grade tier.
I haven't used it, but in theory, it would work like...
-- replace percent_score with an actual score...
local percent_score = 77.41
-- get the long form of the grade tier; this will be something like "Grade_Tier02"
local grade_tier = GetGradeFromPercent(percent_score)
-- truncate the string so that "Grade_Tier02" becomes "Tier02"
local grade_tier_short = ToEnumShortString(grade_tier)
-- you have the grade_tier now, so use it to load the appropriate graphic
LoadActor(THEME:GetPathG("", "_grades/"..grade_tier_short..".png"))..{
Name="Grade",
InitCommand=cmd()
}
Hopefully that gets you started.
Post #3 · Posted at 2015-01-08 08:55:37pm 9.2 years ago
I prefer this one below as an example. The Grade image is a sprite. It can be 4x2 or 3x3.
http://codepad.org/Xcjf0s4F
http://codepad.org/Xcjf0s4F
Post #4 · Posted at 2015-01-10 01:50:42am 9.2 years ago
Th3_Ov3rHell_3XoduZ | |
---|---|
Member | |
313 Posts | |
Reg. 2012-09-13 | |
"ITG, The Best Dance Machine!" |
Finally I got how I made the script before... I remember what exactly I did... I dont use the examples above because I got the result I want by another way...
Anyway, Thanks dbk2 because with your code of a way... it helped me to remember how I made it XD...
Quote
local t = Def.ActorFrame{};
local Song = GetCurrentSong()
local StepsP1 = GetCurrentSteps(PLAYER_1)
GradeValues = {
'Grade_Tier01',
'Grade_Tier02',
'Grade_Tier03',
'Grade_Tier04',
'Grade_Tier05',
'Grade_Tier06',
'Grade_Tier07',
'Grade_Tier08',
'Grade_Tier09',
'Grade_Tier10',
'Grade_Tier11',
'Grade_Tier12',
'Grade_Tier13',
'Grade_Tier14',
'Grade_Tier15',
'Grade_Tier16',
'Grade_Tier17',
'Grade_TierNone',
nil
}
t[#t+1] = Def.ActorFrame {
LoadFont("Common Normal")..{
InitCommand=cmd(Center;zoom,1);
OnCommand=function(self)
local Profile = PROFILEMAN:GetProfile(PLAYER_1):GetHighScoreList(Song,StepsP1)
local HighScores = Profile:GetHighScores()
local LastHighScore = HighScores[1]:GetGrade()
self:settext(LastHighScore)
end
};
};
return t
local Song = GetCurrentSong()
local StepsP1 = GetCurrentSteps(PLAYER_1)
GradeValues = {
'Grade_Tier01',
'Grade_Tier02',
'Grade_Tier03',
'Grade_Tier04',
'Grade_Tier05',
'Grade_Tier06',
'Grade_Tier07',
'Grade_Tier08',
'Grade_Tier09',
'Grade_Tier10',
'Grade_Tier11',
'Grade_Tier12',
'Grade_Tier13',
'Grade_Tier14',
'Grade_Tier15',
'Grade_Tier16',
'Grade_Tier17',
'Grade_TierNone',
nil
}
t[#t+1] = Def.ActorFrame {
LoadFont("Common Normal")..{
InitCommand=cmd(Center;zoom,1);
OnCommand=function(self)
local Profile = PROFILEMAN:GetProfile(PLAYER_1):GetHighScoreList(Song,StepsP1)
local HighScores = Profile:GetHighScores()
local LastHighScore = HighScores[1]:GetGrade()
self:settext(LastHighScore)
end
};
};
return t
Anyway, Thanks dbk2 because with your code of a way... it helped me to remember how I made it XD...