The online racing simulator
strange no space...is the forum.
http://www.lfsworld.net/pubstat/get_stat2.php?version=1.3&idk=<MY ID KEY>&action=pst&racer=jscorrea

dont work....quota Exceeded???

This the message:

Identification is required - http://www.lfsforum.net/showthread.php?t=14480
Have you left the < and > around the ID key by any chance? if so, remove them.
without <> dont work

This is a problem with my profile...i guess

Regards,

JS
Hmm, i tried replicating your error, and adding the < > around the idk resulted in the exact message that you got....

EDIT: Have you tried generating a new idk, then trying that?
Quote from GFresh :Hmm, i tried replicating your error, and adding the < > around the idk resulted in the exact message that you got....

EDIT: Have you tried generating a new idk, then trying that?

Strange works now without <>

Thanks

JS
Hi,

I have a small request, with patch Y, the hlvc times where resetted.
Nearly, the same for the online pbs as the olders are greyed.

Is there a possibility to get this info by extending the current pb action command?
----------
?action=pb
----------
(get all online pb's of a racer)

requires: &racer=<racer>
optional: -
returns: <track> <car> <time> <lapcount>

I would need if possible either the datetime or the version.

Thanks a lot,
Pulling Pubstat Data into a Site?
Hi folks

I am not a coder by any stretch of the imagination, but I do understand the principle of retrieving data by using the following URL format:
http://www.lfsworld.net/pubstat/get_stat2.php?version=1.3&idk=<Your_Ident_Key_Here>&action=...

I can sucessfully do this from the URL bar in a browser. However, I have no idea how to retrieve this data into a file for caching on my web server, or live within a page, for the display of stats.

Would someone mind taking a few minutes to paste a starter script to get me going?

Many thanks!
Quote from Blacklight :Hi folks

I am not a coder by any stretch of the imagination,

[ snip ]

Would someone mind taking a few minutes to paste a starter script to get me going?

Many thanks!

Why is it that self-confessed non-coders seem to think code appears in a matter of a "few minutes"?

Here's an example of obtaining the hosts list, but my guess is it'll mean all but nothing to you:

// Get data from LFSWorld
$lfswURL = LFSW_PUBSTATS_URL . 'hosts';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $lfswURL);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$hosts = curl_exec($ch);
curl_close($ch);

That just obtains the data, parsing that into something presentable is another story and not something that happens within a "few minutes".

No disrespect meant, but if you have no idea about coding, an _example_ script (ie: that may not even work in a live environment) isn't going to be of much use to you without you first learning how to program. Or, are you really saying:

'Can someone code me a page for my web site to display xyz statistics?'

I'd be more than happy to do this, but it'll cost you £30p/h.



Regards,

Ian
Quote :Or, are you really saying:
'Can someone code me a page for my web site to display xyz statistics?'

No I'm not, and no that's not what I asked for is it.

Quote :Why is it that self-confessed non-coders seem to think code appears in a matter of a "few minutes"?

Here's an example of obtaining the hosts list, but my guess is it'll mean all but nothing to you:

I said I wasn't a CODER, I didn't say I wasn't a web developer with over 12 years design and build experience.

I've done some reading this morning, cut and pasted a few functions, overcome a few errors and successfully got my stats displaying in my page now thank you... and all without a hint of 'elitism'. Thanks for the offer to code for a fee, however may I suggest that if you want to be somewhat more successful in generating business, you work at being a little less patronising to your potential clients .
Quote from Blacklight :No I'm not, and no that's not what I asked for is it.

It read that way.

Quote :I said I wasn't a CODER, I didn't say I wasn't a web developer with over 12 years design and build experience.

Oh.. programming in a scripting language (PHP / Perl etc) doesn't make you a programmer? (unless of course, you use ASP :scared: ). If you've been developing sites for that long, where was the need to point out you're "not a coder", surely that's immaterial, considering you're asking about integration into web sites

Quote :I've done some reading this morning, cut and pasted a few functions, overcome a few errors and successfully got my stats displaying in my page now thank you... and all without a hint of 'elitism'.

Cool! Then there was no need to post this thread really was there, since it seems you are capable of researching for yourself. Why people don't use this method _first_ beats the fsck outta me.


Quote :Thanks for the offer to code for a fee, however may I suggest that if you want to be somewhat more successful in generating business, you work at being a little less patronising to your potential clients .

Hah.. if you really think I post here to tout for business, you're very much mistaken, especially as back in the day, I wrote a PHP class released as open-source to do exactly what you're asking (is redundant now as it never got updated since S2 was released) and have either released or currently developing tools related to LFS for free (point being, I do far more for nothing than I do charging).

There just seems to be a lot of "do this for me"... "I want to create the world but too dense to read and learn" type posts or people who generally think that working code can be plucked from the average arsehole willy-nilly in these forums recently, your OP didn't sound / read much different to those. What would have helped is if you'd posted that "you've tried this and / or that, but the other failed.. does anyone have any suggestions as to why?" etc.

There was nothing elite about my reply.. maybe a hint of sarcasm, but no elitism.. the point was that if you don't (although we now know otherwise) know a web dev language, nothing code-related that anyone posted would have been of any use.. not "look.. hah, I know you don't".



Regards,

Ian
Quote :
where was the need to point out you're "not a coder", surely that's immaterial, considering you're asking about integration into web sites

No I'm not a coder, and would never claim to be. I leave that to those more proficient at it (like yourself) and those colleagues that I work with who produce all necessary coding for me. I would not want to insult those that are true coders by calling myself one. And before you ask, I haven't asked my colleagues for their assistance on this because it's a recreational project of my own and one I would like to tackle without just asking them to do it for me.

Quote :
Cool! Then there was no need to post this thread really was there, since it seems you are capable of researching for yourself. Why people don't use this method _first_ beats the fsck outta me.

If you stop and think about it for a moment, it was a sensible request. I was starting with a blank canvas, with a set of parameters I knew nothing about. By attacking it from two different angles, I was hoping to maximise the speed of a result by combining a basic script that someone might have been kind enough to supply me with here, with any knowledge I was picking up by reading elsewhere in parallel. I'm a fast learner and would have dissected what I needed from the basic script and in fact that is what I did... sadly, elsewhere. I simply and kindly asked for a 'starter script' to get me going is all, and you mis-read that as trying to blag the whole deal to get my site going.

I'm disappointed that my first post here has been met with immediate opposition and such obvious sarcasm. I'm putting it down to just a bad day as I'm sure from what I've read in other threads that there is a great deal of friendliness to be found here.
Quote from Blacklight :No I'm not a coder, and would never claim to be. I leave that to those more proficient at it (like yourself) and those colleagues that I work with who produce all necessary coding for me. I would not want to insult those that are true coders by calling myself one. And before you ask, I haven't asked my colleagues for their assistance on this because it's a recreational project of my own and one I would like to tackle without just asking them to do it for me.

To me, that would come under the 'elitism' element. Not you calling it, but I know coders who think scripting isn't programming and thus hate to be categorised as a communal group. To me, if you program, be it scripting or other languages (let's face it, Visual Basic is far easier than the likes of Perl, for example) then you're a programmer, often known as a coder


Quote :If you stop and think about it for a moment, it was a sensible request. I was starting with a blank canvas, with a set of parameters I knew nothing about. By attacking it from two different angles, I was hoping to maximise the speed of a result by combining a basic script that someone might have been kind enough to supply me with here, with any knowledge I was picking up by reading elsewhere in parallel. I'm a fast learner and would have dissected what I needed from the basic script and in fact that is what I did... sadly, elsewhere.

If you've been a web developer for 12 years, you'll have probably had plenty of dealing with parsing of data in various formats and either reading and / or writing it. Pubstats is nothing "special" in that degree.. it's just parsing and handling data.

If you really wanted to grab some code as reference, then a search would have shown up Dygear's LFSW SDK. I'm assuming PHP here as it's very common on 99% of hosts and you didn't specify a language.

Quote :I simply and kindly asked for a 'starter script' to get me going is all, and you mis-read that as trying to blag the whole deal to get my site going.

I didn't try to blag anything. Maybe I should have put £150p/h to push it well out of obvious acceptable rates. It was tongue in cheek. If I was seriously trying to blag anything, the moderators would be on my case in a flash (and rightly so).


Quote :I'm disappointed that my first post here has been met with immediate opposition and such obvious sarcasm. I'm putting it down to just a bad day as I'm sure from what I've read in other threads that there is a great deal of friendliness to be found here.

There is.. I can also be quite helpful.. but your OP didn't sound like you really wanted help, more like a solution.

So what have we learnt, perhaps your post could have been worded a little clearer and perhaps I shouldn't have jumped the gun so quick

Either way, good luck with your project.



Regards,

Ian
Quote :
I didn't try to blag anything. Maybe I should have put £150p/h to push it well out of obvious acceptable rates. It was tongue in cheek. If I was seriously trying to blag anything, the moderators would be on my case in a flash (and rightly so).

I'm sorry, I worded that badly... I actually meant that you may have read it that *I* was trying to blag a free solution to getting the stats on my site .

Quote :
If you've been a web developer for 12 years, you'll have probably had plenty of dealing with parsing of data in various formats and either reading and / or writing it. Pubstats is nothing "special" in that degree.. it's just parsing and handling data.

Hence why I managed to work it out in the end and as you rightly point out, Dygear's LFSW SDK was a great help to that end (i.e. I am using it).

Quote :So what have we learnt, perhaps your post could have been worded a little clearer and perhaps I shouldn't have jumped the gun so quick Either way, good luck with your project.

Point taken and duly noted And thanks, the project is definitely starting to take shape.
Maybe Ian thought that we have a new sun on the forum. One is already too much and the thought that there would be two perhaps made him a little edgy

But then what do I know
Quote from Blacklight :I'm sorry, I worded that badly... I actually meant that you may have read it that *I* was trying to blag a free solution to getting the stats on my site .

Actually this was my error. Re-reading it now, it's clear what you were saying


Quote :Point taken and duly noted And thanks, the project is definitely starting to take shape.

Good to hear it's working.

maczo's post above regarding 'sun' was exactly the person I was thinking of when I posted my first reply. If you check out some of the posts from him, it may help explain why I jumped the gun (wrongly in this case).

Anyways, the coders forum here is a great place of resource with a lot of knowledgeable, friendly fellas often willing to help



Regards,

Ian
Quote :
Maybe Ian thought that we have a new sun on the forum.

Sorry to disappoint... I can actually spell though

Quote :maczo's post above regarding 'sun' was exactly the person I was thinking of when I posted my first reply. If you check out some of the posts from him, it may help explain why I jumped the gun (wrongly in this case). Anyways, the coders forum here is a great place of resource with a lot of knowledgeable, friendly fellas often willing to help

All's well that ends well I actually need to populate my stats now by actually doing some online racing rather than designing/coding, but I'll post something up soon to let you folks know how it's coming along.
Hello,

is it possible to retrieve the country of each host, with "?action=hosts" ?
Sorry don't find the answer elsewhere

Thanks
Quote from Tungsten :Hello,

is it possible to retrieve the country of each host, with "?action=hosts" ?
Sorry don't find the answer elsewhere

Thanks

not yet. I'll soon update pubstats with that and some other data.
Quote from Victor :not yet. I'll soon update pubstats with that and some other data.

Could we get clued in as so to get a head start on the SDK.
from the top of my head :

hosts : add country
PB : add splits / pb date
teams : include team ID

new fuel stat
maybe include racer's country somewhere somehow

if there are any more requests, now's the time
So something like this then?

?action=pb
requires: &racer=<racer>
optional: -
returns: <track> <car> [b]<split1> <split2> <split3>[/b] <time> <lapcount>

?action=pst
requires: &racer=<racer>
optional: -
returns: distance in metres
fuel burnt in cl
laps
hosts joined
wins
second
third
finished
quals
pole
online credits
drags
drag wins
online status (0 = offline, 1 = spectating, 2 = pits, 3 = in-race)
current / last hostname (or blank line if not online or on hidden host)
last_activity_time(*) (Unix timestamp (UTC))
current / last track(*)
current / last car(*)
[b]country[/b]

?action=host
(get host list & information and online racers)

requires: -
optional: -
returns: HOST STRUCT:

HOSTNAME char[32]
TMLT byte[4]
TCRM byte[4] // Track, Config, Reversed, Max players allowed
CARS ulong (4 bytes)
RULES ulong (4 bytes)
LAPS byte [1]
QUALMINS byte [1]
[b]COUNTRY char [2] // US, UK, ect[/b]
NROFRACERS byte[1]
RACERNAMES char[24 * NROFRACERS]

?action=teams
(get the entire teams database stored on lfs world)

requires: -
optional: -
returns: TEAM STRUCT:

[b]TID unsigned int (4 bytes)[/b]
TEAM char [128]
TAG char [6]
COUNTRY char [32]
URL char [128]
BITS unsigned int (4 bytes)
INFO_LEN word (2 bytes)
INFO char [INFO_LEN] (Note : urlencoded)
NR_MEMBERS word (2 bytes)
MEMBERS char [24] * NR_MEMBERS

pretty much yep. And indeed the hosts country will be 2 chars.

About fuel stats btw, would you like to have that included in PB as well?
Or would be a separate fuel stat be better / more convenient?
Quote from Victor :About fuel stats btw, would you like to have that included in PB as well? Or would be a separate fuel stat be better / more convenient?

What is the intended function of the fuel meant to give the end user?
Why are we getting this information? Is it gathered on each lap, in each race / qual / prac session on all hosts. Fuel usage would be saved in the spr file when they upload hot laps and the like, correct?

If you want to give us an over view of all the tracks and then each cars avg on that track then why not make it it's own action? ?action=fuel But is that even needed? Do the fuel avg values change that much over the course of a patch life? You could also give us the min and max values for fuel usage (but if you do please give it to us in the most exact way, that would allow for a different kind of sport on here, who can make the most economical setup, who can make the trusty est? - However that might mess with the results of the ave alittle, what with the amount of people trying.)

You could also output JSON style, but there is really no point, what with JavaScript being unable to query LFSWorld directly, at least not on it's own, or it would have to be on the same domain as LFSWorld ... And at that point, you can just point to your own script on your own domain that will do the convert to JSON for you ...

You could also allow us to query cars (?action=cars), and tracks (?action=tracks) in the game, that could then be used as a finger print for the ?action=fuel array. Indeed you could also use that for alot more ... MSHT arrays for each tracks fastest time. Might save so transfer over all ... Don't really know, have not crunched the numbers.
FWIW I'm all for a new action, rather than it being integrated into anything else. As Dygear says, it's should be a long term cacheable set of data
Quote from the_angry_angel :FWIW I'm all for a new action, rather than it being integrated into anything else. As Dygear says, it's should be a long term cacheable set of data

Thanks for the support, did you also see the edit? The last paragraph (if you could call it that, it's only like two sentences) ... I myself am not quite as thrilled about the cars action, and the tracks action as really ... I don't think they are needed yet. However they might become useful when (and indeed if) we can add mods to the game (S3, I know, but I like to think ahead.).

FGED GREDG RDFGDR GSFDG