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?
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.
No I'm not, and no that's not what I asked for is it.
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 .
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
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.
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".
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.
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.
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
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.
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).
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
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 .
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).
Point taken and duly noted And thanks, the project is definitely starting to take shape.
Actually this was my error. Re-reading it now, it's clear what you were saying
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
Sorry to disappoint... I can actually spell though
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.
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]
(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
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.
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.).