The online racing simulator
Quote from joshdifabio :Well, the script is pretty simple but I have been unable to get the correct lap counts until now. Turns out there was a bug in the old LFSWorldSDK and I had to update .

http://www.spdoracing.org/lfsw ... _script.php?racer=danowat

Tell me if you are interested in getting the script. I might add the distances in a little while, however that requires an array with the length of every track config in LFS and I can't really be bothered to do that right now .

In the test script i sent, the array with the track names, has the track distance too, it's the last parameter.
Quote from fujiwara :In the test script i sent, the array with the track names, has the track distance too, it's the last parameter.

Ah great, thanks .

Edit: Updated it to include distance in miles.
Cool, can i see the script after completed?
Ps: Why the Autocross miles are 0, even if there's laps over there?
Just added the length of the autocross configs, forgot to add them at first.

It's a bit messy, but here is the script:

<?php 
php
$idk 
'IDENT KEY HERE';

$trackCodes = array(
    
=> 'Blackwood',
    
=> 'South City',
    
=> 'Fern Bay',
    
=> 'Autocross',
    
=> 'Kyoto Ring',
    
=> 'Westhill',
    
=> 'Aston'
);

$configCodes = array(
    
'00' => 'GP',
    
'01' => 'Rallycross',
    
'02' => 'Car Park',
    
'10' => 'Classic',
    
'11' => 'Sprint 1',
    
'12' => 'Sprint 2',
    
'13' => 'Long',
    
'14' => 'Town',
    
'20' => 'Club',
    
'21' => 'Green',
    
'22' => 'Gold',
    
'23' => 'Black',
    
'24' => 'Rallycross',
    
'25' => 'RallyX Green',
    
'30' => 'Autocross',
    
'31' => 'Skid Pad',
    
'32' => 'Drag Strip',
    
'33' => 'Eight Lane Drag',
    
'40' => 'Oval',
    
'41' => 'National',
    
'42' => 'GP Long',
    
'50' => 'International',
    
'60' => 'Cadet',
    
'61' => 'Club',
    
'62' => 'National',
    
'63' => 'Historic',
    
'64' => 'Grand Prix',
    
'65' => 'Grand Touring',
    
'66' => 'North'
);

$configLengths = array(
    
'00' => 2.1,
    
'01' => 1.2,
    
'02' => 0.2,
    
'10' => 1.3,
    
'11' => 1.3,
    
'12' => 0.8,
    
'13' => 2.5,
    
'14' => 2,
    
'20' => 1,
    
'21' => 1.9,
    
'22' => 2.2,
    
'23' => 4.1,
    
'24' => 1.3,
    
'25' => 0.5,
    
'30' => 0.3,
    
'31' => 0.1,
    
'32' => 0.7,
    
'33' => 0.7,
    
'40' => 1.9,
    
'41' => 3.2,
    
'42' => 4.6,
    
'50' => 3.2,
    
'60' => 1.2,
    
'61' => 1.9,
    
'62' => 3.5,
    
'63' => 5,
    
'64' => 5.5,
    
'65' => 5,
    
'66' => 3.2
);

include 
"LFSWorldSDK2.php";

$LFSWorld = new LFSWorldSDK($idk);
$pbArray $LFSWorld->get_pb($_GET['racer']);
$tracksArray = array();
$configsArray = array();
$carsArray = array();

foreach(
$pbArray as $key => $subArray)
{
    
$tracksArray[$subArray['track'][0]]['lapcount'] += $subArray['lapcount'];
    
$configsArray[$subArray['track']]['lapcount'] += $subArray['lapcount'];
    
$carsArray[$subArray['car']]['lapcount'] += $subArray['lapcount'];
    
    
$tracksArray[$subArray['track'][0]]['miles'] += $subArray['lapcount'] * $configLengths[substr($subArray['track'],0,2)];
    
$configsArray[$subArray['track']]['miles'] += $subArray['lapcount'] * $configLengths[substr($subArray['track'],0,2)];
    
$carsArray[$subArray['car']]['miles'] += $subArray['lapcount'] * $configLengths[substr($subArray['track'],0,2)];
}

$string "<table>\n\t<tr>\n\t\t<th align=\"center\" colspan=\"3\">Track Environments</th>\n\t</tr>";
arsort($tracksArray);

foreach(
$tracksArray as $key => $subArray)
{
    if(
$subArray['lapcount'] === 0)
    {
        continue;
    }
    
$subArray['miles'] = round($subArray['miles']);
    
$string .= "\n\t<tr>\n\t\t<td align=\"left\" width=\"200px\">{$trackCodes[$key]}</td>\n\t\t<td align=\"right\" width=\"100px\">{$subArray['lapcount']} laps</td>\n\t\t<td align=\"right\" width=\"100px\">{$subArray['miles']} miles</td>\n\t</tr>";
}

$string .= "\n\t<tr>\n\t\t<th colspan=\"3\">Track Configurations</th>\n\t</tr>";
arsort($configsArray);

foreach(
$configsArray as $key => $subArray)
{
    if(
$subArray['lapcount'] === 0)
    {
        continue;
    }
    
$configName $trackCodes[substr($key,0,1)] . ' ' $configCodes[substr($key,0,2)];
    
$subArray['miles'] = round($subArray['miles']);
    if(
substr($key,2) == 1)
    {
        
$configName .= ' Rev';
    }
    
$string .= "\n\t<tr>\n\t\t<td align=\"left\">$configName</td>\n\t\t<td align=\"right\">{$subArray['lapcount']} laps</td>\n\t\t<td align=\"right\" width=\"100px\">{$subArray['miles']} miles</td>\n\t</tr>";
}

$string .= "\n\t<tr>\n\t\t<th colspan=\"3\">Car Names</th>\n\t</tr>";
arsort($carsArray);

foreach(
$carsArray as $key => $subArray)
{
    if(
$subArray['lapcount'] === 0)
    {
        continue;
    }
    
$subArray['miles'] = round($subArray['miles']);
    
$string .= "\n\t<tr>\n\t\t<td align=\"left\">$key</td>\n\t\t<td align=\"right\">{$subArray['lapcount']} laps</td>\n\t\t<td align=\"right\" width=\"100px\">{$subArray['miles']} miles</td>\n\t</tr>";
}

$string .= "\n</table>";
echo 
$string;

?>

Thank you .
Quote from fujiwara :Hum...ok.
If you don't have a way to run php scripts:

Go to http://www.apachefriends.org/en/index.html
Install that bundle for windows or linux, see the readme for starting the server, you just need the php stuff, that bundle comes with a lot of stuff, but it's ready to roll, no need for extra configuration.

Place those two script i sent in "bundle installation dir"/htdocs/test, if you install the windows version the default dir is c:\xampp, just install it here, no need to extra configuration.

Go to http://www.lfsworld.net/, click on My LFSW settings, choose tab Pubstat access and generate an idkey, copy this idkey to test script,


<?php 
$SDK
->idkey ' place idkey here '
?>

Point you browser to http://localhost/test/testLFSSDK.php.

Hope this helps.

You don't have to install a web server to use PHP...
Quote from joshdifabio :Well, the script is pretty simple but I have been unable to get the correct lap counts until now. Turns out there was a bug in the old LFSWorldSDK and I had to update .

http://www.spdoracing.org/lfsw ... _script.php?racer=danowat

Tell me if you are interested in getting the script. I might add the distances in a little while, however that requires an array with the length of every track config in LFS and I can't really be bothered to do that right now .

That is ideal, how would I get this to work "offline" (i.e. outside of a browser)?

Would this type of thing be able to be made into a standalone exe type app?
Quote from danowat :That is ideal, how would I get this to work "offline" (i.e. outside of a browser)?

1. Download PHP from here: http://www.php.net/get/php-5.2.1-Win32.zip/from/a/mirror

2. Extract the zip file to a directory like: C:/PHP/

3. Rename C:/PHP/php.ini-dist to C:/PHP/php.ini

4. Go into notepad, and paste the PHP code. Save it as C:/PHP/test1.php

5. Start a command prompt (Press Start+R, and put in CMD)

6. Browse to the PHP directory:

C:\>cd php

7. Run test1.php:

C:\>cd php
C:\PHP>php test1.php
<PHP code would be outputted here>

But, in your browser you can get a tidy little chart!
, nope, still can't get it
What problems are you having?
Getting the php stuff to work
Can you host this test scripts at your team web site?
I have a webspace with my isp, will that work?

no, my isp webspace won't allow php
yes, if it suports php scrips.
Damn...well you could ask your T7 mates to provide you some special location where you could place this scrips...only you would know where to acess them.
Hmm, is the 5 second tarpit based on the ident key being used or the IP making the request?
Quote from joshdifabio :Hmm, is the 5 second tarpit based on the ident key being used or the IP making the request?

i think it's about the idkey, the premium idkey has this 5 second tarpit removed.
Quote from danowat :I have a webspace with my isp, will that work?

no, my isp webspace won't allow php

You do not need a webserver to use PHP anyway...
2

Application to provide stats from the pubstats function?
(42 posts, started )
FGED GREDG RDFGDR GSFDG