PDA

View Full Version : Code to get some new stats kill/sortie and kill/dead



SG1_Gunkan
Jul-09-2012, 07:21
I miss two stats in your great server: kill/sortie and kill/dead. From a hardcore german pilot point of view, the most important stat is the survavility. Only kills show that you are good but if you can survive that means you are not only good but great pilot.

So i write this -very very- simple and quick code in PHP to get this data.

Thanks again for the server and i hope this can be usefull for someone.

http://i45.tinypic.com/c80lk.jpg


<?
echo "<html><br>";
echo ">>>START SCRIPT>>>><br>";

$html = file('http://216.52.148.29:2012/ATAGStats/ATAGStatsV1.html');
//$html = file('http://localhost/ATAGStatsV1.html');

////////////////////////////////////////////////////////
// Take the stats file in html and remove html tags
////////////////////////////////////////////////////////
foreach ($html as $num_linea => $html) {
$html = strip_tags($html);
$linea[$num_linea] = $html;
}

//Number of lines
$nlineas = count($linea);

$i = 61; // first data line
$j = 0;

while ($i < $nlineas)
{
$piloto[$j]['pilot_name'] = $linea[$i+2];
$piloto[$j]['sorties'] = $linea[$i+3];
$piloto[$j]['kills'] = $linea[$i+5];
$piloto[$j]['landings'] = $linea[$i+13];
$piloto[$j]['deads'] = $linea[$i+11];
$piloto[$j]['arties'] = $linea[$i+13];
$piloto[$j]['ships'] = $linea[$i+15];

// Calculadas
if ($piloto[$j]['sorties']==0)
{
$piloto[$j]['kill/sortie'] = 0;
}
else
{
$piloto[$j]['kill/sortie'] = round($piloto[$j]['kills'] / $piloto[$j]['sorties'],2);
}

if ($piloto[$j]['deads']==0)
{
$piloto[$j]['kill/dead'] = $piloto[$j]['kills'];
}
else
{
$piloto[$j]['kill/dead'] = round($piloto[$j]['kills'] / $piloto[$j]['deads'],2);
}

$j++;
$i = $i + 41; //Next pilot data
}

// Number of pilots
$pilotos = count($piloto);

echo "Number of pilots: $pilotos";

echo "<table border=1>\n";

echo "<tr><td>PILOT</td><td>Sorties</td><td>Kills</td><td>Deads</td><td>Kills/dead</td><td>Kills/sortie</td></tr>";

//Main bucle
for ($k=0;$k<$pilotos;$k++)
{
echo "<tr>";
echo "<td>";
echo $piloto[$k]['pilot_name'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['sorties'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['kills'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['deads'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['kill/dead'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['kill/sortie'];
echo "</td>";
echo "</tr>";
}


echo "</table>";

echo ">>>END SCRIPT>>><br>";
echo "</HTML>";
//////////////////////////
?>

Congratulations to ATAG_Deacon (19.67) and Adj_Pierrot (26.67) :stunned:

ATAG_Deacon
Jul-09-2012, 08:37
Thank you Gunkan :D

From my personal perspective, I get in the most trouble when I go low to help someone that is already in trouble themselves.

As a Red pilot, I would prefer to stay high and fast...:idea: I tend to live more that way.



I miss two stats in your great server: kill/sortie and kill/dead. From a hardcore german pilot point of view, the most important stat is the survavility. Only kills show that you are good but if you can survive that means you are not only good but great pilot.

So i write this -very very- simple and quick code in PHP to get this data.

Thanks again for the server and i hope this can be usefull for someone.

http://i45.tinypic.com/c80lk.jpg


<?
echo "<html><br>";
echo ">>>START SCRIPT>>>><br>";

$html = file('http://216.52.148.29:2012/ATAGStats/ATAGStatsV1.html');
//$html = file('http://localhost/ATAGStatsV1.html');

////////////////////////////////////////////////////////
// Take the stats file in html and remove html tags
////////////////////////////////////////////////////////
foreach ($html as $num_linea => $html) {
$html = strip_tags($html);
$linea[$num_linea] = $html;
}

//Number of lines
$nlineas = count($linea);

$i = 61; // first data line
$j = 0;

while ($i < $nlineas)
{
$piloto[$j]['pilot_name'] = $linea[$i+2];
$piloto[$j]['sorties'] = $linea[$i+3];
$piloto[$j]['kills'] = $linea[$i+5];
$piloto[$j]['landings'] = $linea[$i+13];
$piloto[$j]['deads'] = $linea[$i+11];
$piloto[$j]['arties'] = $linea[$i+13];
$piloto[$j]['ships'] = $linea[$i+15];

// Calculadas
if ($piloto[$j]['sorties']==0)
{
$piloto[$j]['kill/sortie'] = 0;
}
else
{
$piloto[$j]['kill/sortie'] = round($piloto[$j]['kills'] / $piloto[$j]['sorties'],2);
}

if ($piloto[$j]['deads']==0)
{
$piloto[$j]['kill/dead'] = $piloto[$j]['kills'];
}
else
{
$piloto[$j]['kill/dead'] = round($piloto[$j]['kills'] / $piloto[$j]['deads'],2);
}

$j++;
$i = $i + 41; //Next pilot data
}

// Number of pilots
$pilotos = count($piloto);

echo "Number of pilots: $pilotos";

echo "<table border=1>\n";

echo "<tr><td>PILOT</td><td>Sorties</td><td>Kills</td><td>Deads</td><td>Kills/dead</td><td>Kills/sortie</td></tr>";

//Main bucle
for ($k=0;$k<$pilotos;$k++)
{
echo "<tr>";
echo "<td>";
echo $piloto[$k]['pilot_name'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['sorties'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['kills'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['deads'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['kill/dead'];
echo "</td>";

echo "<td>";
echo $piloto[$k]['kill/sortie'];
echo "</td>";
echo "</tr>";
}


echo "</table>";

echo ">>>END SCRIPT>>><br>";
echo "</HTML>";
//////////////////////////
?>

Congratulations to ATAG_Deacon (19.67) and Adj_Pierrot (26.67) :stunned:


One question, where can I add this within my folders to see the information, or can it be added to the ATAG stats pages?

SG1_Gunkan
Jul-09-2012, 10:08
Thank you Gunkan :D

From my personal perspective, I get in the most trouble when I go low to help someone that is already in trouble themselves.

As a Red pilot, I would prefer to stay high and fast...:idea: I tend to live more that way.

One question, where can I add this within my folders to see the information, or can it be added to the ATAG stats pages?

With the time, the combat will get higher and higher. Actually there are some good pilots flying at altitude.

You need an apache web server to run PHP script, but i think it's mucho more easy to add this to your server stats if you are interested.

Ohms
Jul-09-2012, 13:52
I think this would be a great addition, don't like my kill/death ratio but like the stat's.This will stop me flying low over France,oh wait no it won't.:)

ATAG_Deacon
Jul-09-2012, 14:11
I think this would be a great addition, don't like my kill/death ratio but like the stat's.This will stop me flying low over France,oh wait no it won't.:)

~S~ Ohmie,

Stats are currently kill/entry. So if you spawn in, forget to turn on your trackir, & exit it will count against your ratio.

However kill/death ratio would be different...as it only affects your kill per death which is a much more realistic measurement. :salute:

Fried
Jul-09-2012, 14:37
I agree, kill/death is better than kill/entry, when I try to spawn at Hawkidge and get one of those stupid hangers i will respawn 5 or 6 times trying to get out before giving up and going to manston.

Would love to see kills etc only being scored if you finished a sortie by landing at a friendly base instead of just ditching and respawning like we see from some.

SG1_Gunkan
Jul-09-2012, 14:52
Would love to see kills etc only being scored if you finished a sortie by landing at a friendly base instead of just ditching and respawning like we see from some.

+1

ATAG_Snapper
Jul-09-2012, 14:57
~S~ Ohmie,

Stats are currently kill/entry. So if you spawn in, forget to turn on your trackir, & exit it will count against your ratio.

However kill/death ratio would be different...as it only affects your kill per death which is a much more realistic measurement. :salute:

+1

Also like Fried's comment re having to "land" your kill for the score to count.

ATAG_Deacon
Jul-09-2012, 15:54
Would love to see kills etc only being scored if you finished a sortie by landing at a friendly base instead of just ditching and respawning like we see from some.

+1

I am not a programmer and the only thing I know about coding is that I have no knowledge of how to write it. (I used to know Morse Code but that doesn't count :) )

What would be cool is having your stats reset to ZERO upon your death or bailing over enemy territory. Just my opinion...

ATAG_Colander
Jul-09-2012, 16:14
Ok.....
The current stats where made over a week I was on vacations. They where done because, back then, there where no stats at all on any server.
I always thought of them as a temporary solution. I still want to work on them and make them a lot more informative, all part of a very complex server/missions commander, however:
1.- Currently I don't have the time to work on it and, the small time I have, I fly or work in other (quick) utilities like the external views in tracks.
2.- I will not continue working on it (I started some time back) until the game is fixed.

Reason #2 has the more weight as any work done, might end being tossed out the window if something related to how the stats are gathered is changed in the game.

I think I can easily add the kills/deaths ratio. When I did the kills/sorties my intention was to show the lethality of each pilot as opposed to having, for example, only 2 kills in a full year with no deaths.

In short, let's wait for the game to get fixed before focusing on less important things like stats.

ATAG_Colander.

Doc
Jul-10-2012, 19:32
Back in the day we use to keep our stats using a wax pencil on the side window of our 109's...I recall this like it was yesterday. Yes...

Remember them days Colander? We couldn't see each other when we formed up because we had so many marks all over both windows. lol

:PP

ATAG_Colander
Jul-10-2012, 20:00
Yeah, and when you died, your stats where reset to 0 as the plane disintegrated :D