-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New leaderboard command #89
base: master
Are you sure you want to change the base?
New leaderboard command #89
Conversation
…ard ID passed in with the command.
var hours = Math.trunc(score / 216000); | ||
var minutes = Math.trunc((score / 3600) - (hours * 60)); | ||
var seconds = Math.trunc((score % 3600) / 60); | ||
var milliseconds = Math.trunc(((score % 3600) % 60) * (100.0 / 60.0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this last part of the formula be 1 thousand divided by sixty?
(since it's milliseconds)
commands/rautil/leaderboard.js
Outdated
return `**Time:** ` + this.formatValues(hours, minutes, seconds) + "." + | ||
String(milliseconds).padStart(2, '0'); | ||
case 'TIMESEC': // Number of seconds | ||
var hours = Math.trunc(score / 360); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be score / 3600
?
(there are 3600 seconds in an hour)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a copy/paste error from a previous version of the code. I fixed it on the server a few weeks ago: https://github.com/RetroAchievements/RAWeb/pull/862/files#diff-e0db928da9ff4e187815476ab499f2a091d324ba8415d871315b30d91caba627L567
Note also that that PR adds two more formats: MINUTES and VALUE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and added in new formats.
var hours = Math.trunc(score / 360000); | ||
var minutes = Math.trunc((score / 6000) - (hours * 60)); | ||
var seconds = Math.trunc((score % 6000) / 100); | ||
var milliseconds = Math.trunc((score % 100)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar thing here...
3,600,000 milliseconds in an hour
60,000 milliseconds in a minute
1,000 milliseconds in a second
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except MILLISECS is poorly named and is really hundreths of a second.
https://docs.retroachievements.org/Leaderboards/#value-format
NOTE: Time (Milliseconds) is actually hundredths of a second, not thousandths of a second. i.e. a Value of 6234 would be 62.34 seconds, not 6.234 seconds.
commands/rautil/leaderboard.js
Outdated
|
||
return `**Time:** ` + this.formatValues(hours, minutes, seconds) + "." + | ||
String(milliseconds).padStart(2, '0'); | ||
case 'TIMESEC': // Number of seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be TIMESECS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
New leaderboard command to display up to the top 10 entries in any given leaderboard.
Can be run using
leaderboard
orlb
and takes the leaderboard ID as the only parameter:leaderboard <id>
lb <id>