Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Conversation

@MrOwnership
Copy link
Member

New leaderboard command to display up to the top 10 entries in any given leaderboard.

Can be run using leaderboard or lb and takes the leaderboard ID as the only parameter:
leaderboard <id>
lb <id>

image

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));
Copy link
Contributor

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)

return `**Time:** ` + this.formatValues(hours, minutes, seconds) + "." +
String(milliseconds).padStart(2, '0');
case 'TIMESEC': // Number of seconds
var hours = Math.trunc(score / 360);
Copy link
Contributor

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)

Copy link
Member

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

Copy link
Member Author

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.

Comment on lines +63 to +66
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));
Copy link
Contributor

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

Copy link
Member

@Jamiras Jamiras Jan 7, 2022

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.


return `**Time:** ` + this.formatValues(hours, minutes, seconds) + "." +
String(milliseconds).padStart(2, '0');
case 'TIMESEC': // Number of seconds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be TIMESECS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants