Skip to content
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

Server and Global Scores Display Current User in "Highest streak" if the Highest Streak is 1 #5

Closed
CzarHey opened this issue Feb 6, 2021 · 1 comment · Fixed by #6
Assignees
Labels
bug Something isn't working

Comments

@CzarHey
Copy link
Owner

CzarHey commented Feb 6, 2021

On a server where the command has never been used before, or in a server where all of the scores have been reset, all of the scores variables are empty. The "Highest streak" section in the scoreboard will display "None yet!"

Screen Shot 2021-02-05 at 7 36 00 PM

If a user is bombed and defuses the bomb successfully, the scoreboard will record their streak as "1", but will incorrectly display the username of the user who requested the command rather than the user who defused the bomb.

Screen Shot 2021-02-05 at 7 37 32 PM

If another user is able to get a streak of 2 or higher, the scoreboard will display the correct username. The issue will not appear again unless the scoreboard is reset.

Screen Shot 2021-02-05 at 7 39 01 PM

This issue has been noted on both the Public Tags and Custom Command version. It's been observed only on the local server score streak, but is believed to also affect the global score streak as well, as the code between the two is very similar.

@CzarHey CzarHey self-assigned this Feb 6, 2021
@CzarHey
Copy link
Owner Author

CzarHey commented Feb 6, 2021

I think I found the culprit of this issue. It's on Line 457 - 460 of the CC version (the code's similar in the PT version but whatever).

{//;If not null, check to see if the current streak is higher than the streakrecord}{if;{get;timebomb-scores-streak-{get;~victim}};>;{get;timebomb-scores-streakrecord-total};
	{//;If it's higher, set streakrecord to match score-streak}{set;timebomb-scores-streakrecord-total;{get;timebomb-scores-streak-{get;~victim}}}
	{//;Note down the victim's user ID as they are the new crown-holder}{set;timebomb-scores-streakrecord-crown;{get;~victim}}
}

Here's what I'm guessing is causing the issue:

  • When a user successfully defuses a bomb, the "if" check checks to see if the victim's streaks score is higher than the recorded total. If it is, then it will run the code that sets the new streaks record holder. If it is equal to or lower, then it doesn't run anything.
  • The problem is that, when a user first defuses a bomb, both their user highest streak and the server's highest streak counts are 1. The code is checking to see if the user highest streak is greater than the server's highest streak. Since they are equal, the code that would set the "Who is the current record holder" variable is never run, so that variable remains blank.
  • The Scores display output uses the "person" Public Tag to display user info. If that tag is not given a user ID, it will return the current user's information. Since the "Who is the current record holder" variable is blank, it returns the current user ID, and therefore that's why the Scores display output shows the current user rather than the defusing user.
  • If someone gets a streak higher than 1, that will cause the code to execute and thus correctly set the record-holder.

If I had more time, I'd write a shorter letter. But this is what I've gathered from the issue, and at least now I know what's causing it.

@CzarHey CzarHey added the bug Something isn't working label Feb 6, 2021
CzarHey added a commit that referenced this issue Feb 6, 2021
Address issue #5
CzarHey added a commit that referenced this issue Feb 6, 2021
Address issue #5
@CzarHey CzarHey mentioned this issue Feb 6, 2021
@CzarHey CzarHey linked a pull request Feb 6, 2021 that will close this issue
@CzarHey CzarHey closed this as completed in #6 Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant