Logo

[Help] Get The Current Saved Grade (SOLVED)

Register Log In Back To Forums

Post #1 · Posted at 2015-01-08 06:43:50pm 9.2 years ago

Offline Th3_Ov3rHell_3XoduZ
Th3_Ov3rHell_3XoduZ Avatar Member
313 Posts
Chile
Reg. 2012-09-13

"ITG, The Best Dance Machine!"

Last updated: 2015-01-10 01:51am
Hello, time ago I figured out by my self a LUA Script that show me the current saved Grade from the current Difficulty... for example...

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

Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released

Post #2 · Posted at 2015-01-08 08:43:45pm 9.2 years ago

Offline dbk2
dbk2 Avatar 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.

Post #3 · Posted at 2015-01-08 08:55:37pm 9.2 years ago

Offline razorblade
razorblade Avatar Member
1,099 Posts
Not Set
Reg. 2011-03-01


Last updated: 2015-01-08 09:00pm
I prefer this one below as an example. The Grade image is a sprite. It can be 4x2 or 3x3.

http://codepad.org/Xcjf0s4F

Post #4 · Posted at 2015-01-10 01:50:42am 9.2 years ago

Offline Th3_Ov3rHell_3XoduZ
Th3_Ov3rHell_3XoduZ Avatar Member
313 Posts
Chile
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...

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

Anyway, Thanks dbk2 because with your code of a way... it helped me to remember how I made it XD...
Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released
Register Log In Back To Forums

0 User(s) Viewing This Thread (Past 15 Minutes)

©2006-2024 Zenius -I- vanisher.com -5th style- IIPrivacy Policy
Web Server: 4% · Database: 4% · Server Time: 2024-04-20 02:05:20
This page took 0.005 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language