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.
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.
shouldn't this be score / 3600?
(there are 3600 seconds in an hour)
There was a problem hiding this comment.
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.
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.
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.
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 |
New leaderboard command to display up to the top 10 entries in any given leaderboard.
Can be run using
leaderboardorlband takes the leaderboard ID as the only parameter:leaderboard <id>lb <id>