The online racing simulator
Changed my mind, here is 1.9.6 with support for LFS Pub stats version 1.5 and so all of the things that come with it. All showcase pages are present, some have been updated, some have not.
Attached files
LFSWorldSDK1.9.6.zip - 9.7 KB - 935 views
Dygear,

thanks, fuel column now appearing.

Excellent work.
Version 1.9.7 includes full support for what was added in Version 1.5 of Victor's LFS World Pub Stats. Even more show case pages where updated, but not all of them are done.
Attached files
LFSWorldSDK1.9.7.zip - 12 KB - 1161 views
split3 not returned.
Dygear,

just updated to 1.9.7, I'm afraid that PB retrieval isn't returning vales for split3. tried 1.9.6 and thats doing the same: just returns 0 for split 3 time.

cheers

G
scratch that...
its LFSW stats not returning split3 time.
Be sure to get stats from a config that has 4 sectors.
Pubstat will always return the last split as laptime. So for example on BL1 you will get split1, split2 and laptime while split3 will be 0.
Thus you'll get split3 > 0 only on FE4, AS6 and AS7 ...
Any 2-sector-config will have split2 as 0 too
Pretty much what avetere just said.
yeah, i'm having a retard moment.

had an error in the code i have been working on and was reading from the wrong bit of the array.

false alarm:chair:
Is it intentional that the first post links to 1.9.3 instead to the more current 1.9.7 of the SDK?
Quote from three_jump :Is it intentional that the first post links to 1.9.3 instead to the more current 1.9.7 of the SDK?

Nope, over sight on my part. Thanks, going to fix this now.
Hi Dygear!

I just found a little mistake in the SDK.

IMHO the lines 430-433

if (($result = $this->make_query("&action=wr&track={$track}&car={$car}")) !== FALSE) {
foreach ($result as $i => $data)
$result[$i]['flags_hlaps'] = $this->convert_flags_hlaps($data);
}

should be

if (($result = $this->make_query("&action=wr&track={$track}&car={$car}")) !== FALSE) {
foreach ($result as $i => $data)
$result[$i]['flags_hlaps'] = $this->convert_flags_hlaps($data[B]['flags_hlaps'][/B]);
}

Besides I would like to have the original flags_value stored somewhere like:

[flags_hlaps_raw] => 1537
[flags_hlaps] => Array
(
[1] => LEFTHANDDRIVE
[512] => AUTOCLUTCH
[1024] => MOUSESTEER
)

Otherwise I had to array_sum(array_keys(flags_hlaps)) to get it.

Keep up the good work.

Pascal aka paXton
I tend to shy away from adding a property that does not belong there, but I agree that the information should be more flexible. I think in the case you described, there will be a proper fix for it in 2.0.0 as you can say how you want the data given to you.
repeating requests on error without tarpit
Hi Dygear!

Another issue with the great LFSWorldSDK.

Shoudn't this code (line 56-60):

if ($this->ps === FALSE && $this->fpass === TRUE && (time() - $this->time) < 5) {
sleep(6 - (time() - $this->time));
$this->time = time();
$this->fpass = FALSE;
}

looks like this:

if ($this->ps === FALSE && $this->fpass === FALSE && (time() - $this->time) < 5) {
sleep(6 - (time() - $this->time));
}
$this->time = time();
$this->fpass = FALSE;


I'm not sure if i'm right, but it seems that this caused our server block on lfsworld pubstat access and some nice trouble with Victor.

Please take a look at the SDK.
If i'm wrong, please ignore, it's late tonight. 8)

Ciao... Pascal
Ever look at your old code and be like "Woah. I am awful." Normally this happens to me every few weeks, but going into this 13 years later, I try to remind myself that some of the features that we take for granted now days were not available 13 years ago.
Nice to see you're still updating this. Are people still using this? Because then it would be nice to make it into a package you can include with composer for example in your actual project. This way users can update this SDK if you've updated it. You can also ditch the (I assume they are) examples in the other .php files, which maybe are not the best of code, quality and safety-wise.

If you want I can give you a hand with it, I wouldn't mind. I work with PHP as profession so I see some nice areas to improve the code.
According to my pub-stats on LFSWorld, this kind of died out in 2019. Over its life it's been used more than 300 million times.

I wasn't sure how much I should break. For example, I didn't put it in a namespace. But that was because Namespaces were not an option when this project started. What namespace should I put this into?! Dygear/LFSWorldSDK?

As for the other files in there, yeah, they are examples. I added them after, perhaps it should just be yeeted from the repo or moved elsewhere. I'm open to ideas.

Lastly, the composer side of things. I never used composer, I find it a fairly annoying way to "compose" php applications. But I'm willing to publish it somewhere if that's what people want.
I think it depends on how people use your code. If it's done 'professionally' and especially with a framework like Laravel or Symfony, you're using Composer to install packages etc, and adding your code in that same manner would be epic.

Namespaces could be anything, depending on what you want to publish later. `Dygear\LfsWorldSdk` or something like `Dygear\LfsWorld` would sound good, so you can later publish `Dygear\MyOtherPackage`.

And if you want to separate things you could do something like `Dygear\LfsWorld\Helpers` and `Dygear\LfsWorld\Interfaces`, `Dygear\LfsWorld\Enums`, you name it.

FGED GREDG RDFGDR GSFDG