Warzone Stats Command Help

Hello,

I was doing a google search for warzone stats command on nightbot and found one on this website. I kind of understand how to set it up but the only thing I can’t seem to get is to return the username value no matter what I try.

Website for information I’m getting. stealthsan#4929051’s Warzone Detailed - COD Warzone Tracker

First Command:

!wzstats $(eval $(querystring).toLowerCase().replace(%20,/))

Second Command:

_wzstats $(eval s=$(urlfetch json https://api.tracker.gg/api/v2/warzone/standard/profile/$(query)).data.segments[0].stats; r=s.kdRatio.value; k=s.kills.value; d=s.deaths.value; dw=s.downs.value; w=s.wins.value; whp=s.weeklyHeadshotPct.value; wkdr=s.weeklyKdRatio.value; Wins: ${w} | Kills: ${k} | Downs: ${dw} | Deaths: ${d} | K/D Ratio: ${r} | Weekly K/D Ratio: ${wkdr} | Weekly Headshot %: ${whp}%)

I put this in chat

!wzstats atvi StealthSan#4929051

it returns the info I put “Wins: XX | Kills: XX | Downs: XX | Deaths: XX | K/D Ratio: XX | Weekly K/D Ratio: XX | Weekly Headshot %: XX%”

but I want it to return “StealthSan#4929051: Wins: XX | Kills: XX | Downs: XX | Deaths: XX | K/D Ratio: XX | Weekly K/D Ratio: XX | Weekly Headshot %: XX%”

I have no clue what to put in order for the command to return the username I’m searching.

Hey @StealthSan!

Please link the post you’re referring to, I assume it’s this one, but I may be mistaken.


The first command formats the data in such way the API can use it, we could use the input of the that command, but luckily for us, the API has that data stored too, you can fetch it like the rest of the data, but we’ll have to modify the second command a bit:

$(eval a=$(urlfetch json https://api.tracker.gg/api/v2/warzone/standard/profile/$(query)).data; u=a.platformInfo.platformUserHandle; s=a.segments[0].stats; r=s.kdRatio.value; k=s.kills.value; d=s.deaths.value; dw=s.downs.value; w=s.wins.value; whp=s.weeklyHeadshotPct.value; wkdr=s.weeklyKdRatio.value; `${u}: Wins: ${w} | Kills: ${k} | Downs: ${dw} | Deaths: ${d} | K/D Ratio: ${r} | Weekly K/D Ratio: ${wkdr} | Weekly Headshot %: ${whp}%`)

That worked. Thank you very much.

Now I have one last question.

Is there a way to make the command always put the atvi that I’m putting before the username so I don’t have to type atvi?

For example can I just put !wzstats StealthSan#4929051

Yes there is, but this would exclude users that are not on Activision from using your command, but in that case you wouldn’t need to use the first command either, you could have everything in one:

$(eval a=$(urlfetch json https://api.tracker.gg/api/v2/warzone/standard/profile/atvi/$(querystring)).data; u=a.platformInfo.platformUserHandle; s=a.segments[0].stats; r=s.kdRatio.value; k=s.kills.value; d=s.deaths.value; dw=s.downs.value; w=s.wins.value; whp=s.weeklyHeadshotPct.value; wkdr=s.weeklyKdRatio.value; `${u}: Wins: ${w} | Kills: ${k} | Downs: ${dw} | Deaths: ${d} | K/D Ratio: ${r} | Weekly K/D Ratio: ${wkdr} | Weekly Headshot %: ${whp}%`)

And if you even want a command that’ll always output your data exclusively, you can have that too:

$(eval a=$(urlfetch json https://api.tracker.gg/api/v2/warzone/standard/profile/atvi/stealthsan%234929051).data; u=a.platformInfo.platformUserHandle; s=a.segments[0].stats; r=s.kdRatio.value; k=s.kills.value; d=s.deaths.value; dw=s.downs.value; w=s.wins.value; whp=s.weeklyHeadshotPct.value; wkdr=s.weeklyKdRatio.value; `${u}: Wins: ${w} | Kills: ${k} | Downs: ${dw} | Deaths: ${d} | K/D Ratio: ${r} | Weekly K/D Ratio: ${wkdr} | Weekly Headshot %: ${whp}%`)

Actually, I guess I can find a solution for users to only have to enter their user handle, but I don’t have time right now, maybe later, I’ve been meaning to write a cleaner guide than the post I linked earlier for some time now.

Sounds like a plan. I just thought everyone is technically on Activision since they’re forced to have one in order to be able to play cross-play.

Oh, that’s interesting, I didn’t know that, thanks for letting me know.

hi i put this is but the weekly kd shows up in like 15 decimal places. how do i round this to 2 decimal places.
this is wat it does:
Wins: 153 | Kills: 14257 | Downs: 14452 | Deaths: 6067 | K/D Ratio: 2.35 | Weekly K/D Ratio: 2.8260869565217392 | Weekly Headshot %: 26.54%

Hey @jestin73!

I don’t know how you’re getting that number, if you shared the command code that’d be easier, but basically, here’s how to solve the issue:

let n = 2.8260869565217392; // declaring the variable so the example makes sense
// the line bellow is the important bit of code
n = (Math.round(n * 100)) / 100;
// multiply the number by 100 → 282.60869565217392
// rounds the number to the nearest integer → 283
// divide the number by 100 → 2.83
console.log(n); // 2.83
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.