The online racing simulator
Commentary on the "getstat" LFS World script
(358 posts, started )
Quote from Victor :
<u>18:52 08-01-2006</u> <b>vishnou7022</b> had uploaded a new hotlap to 126th place: <b>1:25.030</b> on <b>BL gp</b> with the <b>XRT</b></a>


edit - maybe you meant the laptime was missing in format 1, in the case of a WR. I can't see anything wrong otherwise.

Doh! My bad. In my defence I was running purely on caffiene yesterday :doh:
Firstly, the position error isn't an error at all, but when log_filter=1 the position always becomes '1' because obviously a WR is always number 1

Second thing (format 1 missing data) seems to have been fixed. Yesterday I was getting stuff like;

<u>14:58 08-01-2006</u> <b>RTOG Papafant</b> had uploaded a new WR to place: <b></b> on <a href="http://www.lfsworld.net/?win=hotlaps&whichTab=trackcharts&track=&config=&car=MRT&racer=RTOG Papafant" target="_blank"> <b></b> with the <b>MRT</b></a>
<u>13:34 08-01-2006</u> <b>Vince</b> had uploaded a new WR to place: <b></b> on <a href="http://www.lfsworld.net/?win=hotlaps&whichTab=trackcharts&track=&config=&car=XRR&racer=Vince" target="_blank"> <b></b> with the <b>XRR</b></a>

Today it seems ok though.
I'll keep checking to see if it was a particular param combo that did it, but IIRC it was doing it all of the time so it's probably fixed.

Good stuff

*plug*

I'll be releasing PPF version 2 sometime shortly, as soon as I get PHPDoc to cooperate and finish up the usage docs.
In short, it is easier to install, easier to use, more robust, has more features & is more powerful.
Heres a sneak peek at the minimum code required to get a full hosts list.


<?php 
require_once('lfsworld/lfsworldinterface.php');
$lfsw = new LFSWorldInterface();
$hosts $lfsw->getHostsList();
?>

However, the old API is there. It is just in a slightly different form. It will be backwards compatible through a wrapper.

In addition, an optional 'fallback' has been coded in so that if LFSWorld is unreachable, or givs you errors it will try to use old data instead of simply failing, and there are providers for all data sources, including highlights, which has a parsing option.

I don't think I could have made it more straight forward. In addtition, installation will be easier because I'll be distributing the required PEAR libs with it now. You can override that though.

There are lots of other things to mention, but I don't want to hijack the thread so I'll leave it there
Well done that man!
Has the data refresh limit changed recently Victor? I'm doing some testing for libLFSW and I'm pretty sure it used to be 60 seconds, but I seem to beable to do it roughly every 5-10 seconds.
yeah since s2 it's 5 seconds
Awesome. Its worryingly tempting to do away with a cache-ing facility.
Hi,

is it possible to add a timestamp to the highlights script? that way, i think that caching of the highlights is possible.

I'm asking this because I'm working on a stats page for my team, and i wish to get the highlights from the past week or month to be displayed on that website.

***edit:
I've uploaded an example of what i want to achieve to my webspace (http://josbelgium.mybesthost.com ).

If a timestamp is added, and the highlights can be qeuried with a starting timestamp, this script can be qeuried and the results can be written to a file or db on the host.
Ive read through this whole thread as a php noob so I probably wasn't able to catch all of it, in other words; don't hit me if I ask something stupid now...

Would it be possible in some way to get/calculate the amount of kilometers driven in the last week by a certain racer? I think it's only possible via the online race results (of which I know they won't be available publicly) but I might be underestimating the possibilities with the existing pubstats. Anyone got a trick for that?

Would appreciate any help,

TraXX
Yeah!

I'd like to thank both D34N0 and TristanCliffe for their online/offline script template, Ive combined the two and it's running perfectly on our website now!
Quote from traxxion :Would it be possible in some way to get/calculate the amount of kilometers driven in the last week by a certain racer?

You could do this by writing a script to parse the PST output of a racer. You then only update this once a week (or have a set of rolling results per team member). Once you have enough data you can just take last weeks value away from the current value and voila.

i.e. This weeks total miles driven for X - Last weeks total miles driven for X.

As the format for PST is fairly easy, you only need to do something like this to get that data (I've roughly written this, so I apologise if its not quite right):
if (strpos($pstoutput, '\n') !== false)[B][/B]
{
$distancedriven = substr($pstoutput, 0, strpos($pstoutput, '\n')-1);
}

Ok, thanks for the reply Angel. I have to conclude that (however simple it might be for you) my level of php programming is too basic to understand your post. No offense, not your fault at all, just my noobness for now I will for sure get back on this once I get more familiar with this stuff.. it's addictive . Our website's now also got a hotlap competition
traxxion:
Ah, sorry if I wasnt clear As soon as Anarchi-H's finished LFSW-PPF v2, I'll write a little example using it, and I'll do one without shortly

Victor:
I presume that all integers in the hotlap log output are not allowed to be negative, and that they are checked before output? Specifically the timestamp, and splits?
Quote from the_angry_angel :traxxion:
Ah, sorry if I wasnt clear

Again, not your fault Just me being too enthusiastic while not having the right skills yet

Quote from the_angry_angel :
As soon as Anarchi-H's finished LFSW-PPF v2, I'll write a little example using it, and I'll do one without shortly

That'd be awesome! I find the best way to learn is to look at other people's work. Ive also got LFW-PPF but Im not sure how to use it...
Hi again,

I see Victor hasn't responded (yet) to my previous question, so i'll wait on that one..

in post 52in this thread ( http://www.lfsforum.net/showthread.php?p=35947#post35947 ) there is a terrific working script to find who is online. I'm using this script and i love it. But there is one little problem with it i think. What about lfs users that have a space in their name? (e.g. like myself "Jos Belgium"). Is there a way to fix this? I've tried some things i could come up with (in the function trim_c_string in the if statement add something like " || $string[$x] == '(just a space here)'"
but i wasn't able to correct this...
Any help?
Whats bug do you have with racer names and spaces? I cant seem to see one from glancing at the code quickly.
As far as I remember (it's been a while since I used those scripts when building a site) it shouldn't have any problems with spaces.

You have two arrays that deal with display name and username.

$TeamMembers = array("tristancliffe","d34n0","Jos Belgium","lfs name","lfs name");
$InGameName = array("Tristan Cliffe","T7R|D34N0","Jos Belgium"....

Because of the "" it should work, and iirc it did with the few people that had spaces in their names that I tried it with (ages back).
Quote from the_angry_angel :Victor:
I presume that all integers in the hotlap log output are not allowed to be negative, and that they are checked before output? Specifically the timestamp, and splits?

yep, they're all always positive. Not checked at output, but rather at input and all is stored as unsigned int's, so negative values can't be there.
Quote from Jos Belgium :Hi,

is it possible to add a timestamp to the highlights script? that way, i think that caching of the highlights is possible.

I'm asking this because I'm working on a stats page for my team, and i wish to get the highlights from the past week or month to be displayed on that website.

***edit:
I've uploaded an example of what i want to achieve to my webspace (http://josbelgium.mybesthost.com ).

If a timestamp is added, and the highlights can be qeuried with a starting timestamp, this script can be qeuried and the results can be written to a file or db on the host.

I can't just add a timestamp; I fear it could disrupt other people's scripts.

The querying you're refering to would have to be made for the pubstats script then, but tbh that's not a high priority for me. In other words, don't expect the highlights to change any time soon
Hello,

Just a little function in PHP for Trimming zero in string:
function strip_zero( $chaine )
{
list($chaine,$rien) = explode(chr(0),$chaine);
return $chaine;
}
To remove color
function strip_color( $chaine )
{
return ereg_replace( "\^[0-9]","",$chaine);
}

Bye
Is there a workaraound for the timeout?

I have a little teampage and want to have pb and pst infos for 5 players.
That means 10 requests to the server.
I found out, that my script has to do a 5 seconds brake in between the requests, not to get the error "can't reload this page that quickly after another".
(Or do I something wrong with the file_get_contents - function? I wonder, why nobody is complainig the same...)

So my php-Script loads 50 secs! That's much time...

Can't we get multible infos at one request (e.g. action=pst)?

Greetz from cold Germany!
Cache your results. Thats the only way around it. Then each time the page is loaded theres a roundrobin system on who gets updated. If thats not good enough, consider running a cron every X minutes to do the update.
Hi angry angel!
Caching would not ueseful, I expect, that our team-members only once a week would call my site - almost no traffic.

It just would be a nice-to-have for the pst-action a multiuser-call like:

...&action=pst&racer=racername1,racername2,racername3...

let's say limited to 20 racers.
The server-resonse shouldn't be much, because it's about ~70 bytes per racer. But would save much time for people, who wants to have data for a nuber of racers, like me.

pb-action - ok this can cause more traffic. I would be satisfied with the pst-multiuserupgrade
I'll look into that soon. It seems to be a useful feature to request multiple racerstats in one go.
Quote from Victor :I'll look into that soon. It seems to be a useful feature to request multiple racerstats in one go.

OMG, YAY!
Quote from Victor :I'll look into that soon. It seems to be a useful feature to request multiple racerstats in one go.

YESSS!
That's what I call a junkie of a programmer - like me!
Quote from Victor :I'll look into that soon. It seems to be a useful feature to request multiple racerstats in one go.

Great, will help a great deal

Commentary on the "getstat" LFS World script
(358 posts, started )
FGED GREDG RDFGDR GSFDG