Page 1 of 1

New base calculation for PilotStatistics

Posted: Mon 02 Dec 2013 12:06 am
by Riksen
Hi again Shades,

I have a question if you dont mind. I'm trying to adjust the base calculation for the Gross Combat Score value seen in the pilot statistics.

I would like the normal Air+Surface+Casualty value to be multiplied by the survival rate in order to give a more fair score (in my opnion players have to value their virtual lives more than the number of kills per se) so i tried to add to the following code into line 298 of the MP - PilotDetails.php:

$CasualtyValue = -$KIAValue - $MIAValue;
print '<span class="small" style="color: '.SSkinText().';" title="Total Production Cost of Kills">'.LL($L->screen->PilotDetails->grossscore).':<br>&nbsp;&nbsp;&nbsp;<b> '.$AV.' ('.LL($L->screen->PilotDetails->air).') + '.$SV.' ('.LL($L->screen->PilotDetails->surface).') - '.$CasualtyValue.' ('.LL($L->screen->PilotDetails->casualty).') * '.sprint(($AK + $MIA)/$NMissions).' ('.LL($L->screen->PilotDetails->sortiesurvival).') = '.($AV+$SV-$CasualtyValue*($AK+$MIA)/$Missions*).'</b></span><br>';

but I keep getting a syntax error. What am I doing wrong?

Thxs for ur patience ...

Riksen

Posted: Tue 03 Dec 2013 12:10 am
by Riksen
Someone?

Posted: Tue 03 Dec 2013 4:35 am
by II/JG77Hawk_5
As you noted in your OP it'll require some patience as this really is a very specific question that requires 4Shades analysis. Its out of my area of expertise thats for sure.

Posted: Tue 03 Dec 2013 5:42 am
by IV/JG7_4Shades
Hi Riksen,

Here are some quotes to help you:
In coding, as in space, no-one can hear you scream.
The loneliness of the long-distance coder
etc etc. :)

There is an essential rule in coding. If you start with something that works, make a change and it doesn't work any more, then your change added a bug and it is your responsibility to fix it (because you are alone in "code space" and any question you ask will not be answered by anyone else for hours/days, if ever). To fix it, roll back your change(s) one by one and examine the results in turn. Laborious, I know, but a great way of learning.

In your case, the problem is here. Can anyone see it?

Code: Select all

($AV+$SV-$CasualtyValue*($AK+$MIA)/$Missions*)
It is the second *. It shouldn't be there, a simple typo. There may be other bugs besides.

Another hint, if you have error reporting enabled in your php.ini file, then any syntax errors will be reported to your web server error log file. Very handy when all else is lost.

Cheers,
4S

PS: Welcome to the coders' club!

Maybe I shouldnt have....

Posted: Tue 03 Dec 2013 8:57 am
by Riksen
Perhaps Shades I shouldnt've gotten into it lol....

I fix the typo and check where it leads me. Anyway any chance u got the other code to work? The one related to the Pilot photos I sent u as a private message?

Regards