The online racing simulator
v1.3 changes preview - did I get all suggestions?
Hi all

I'm posting here the new text document for Pubstat v1.3 so that you can have a look and see if I didn't forget anything.

Pubstats v1.3 is not yet available - it will be very soon.

If you spot anything missing in this version please let me know asap, so I can think about adding it before everyone jumps to v1.3

Live for Speed Pubstats S2 v1.3 (5 Nov 2006)

!!! Identification is now obligatory for everyone - see notes below !!!

CHANGELOG :

v1.2 => v1.3
------------
?action=teams - changed teamname length from 64 bytes to 128
?action=hl - added split times
?action=ch - added split times
?action=wr - added split times
?action=pst - added details about current or last online activity

-------------------------------------------------------------------------------------
Legend: (all output is in plain text, unless specified otherwise)
-------------------------------------------------------------------------------------

<track> 3 digit representation.
000 (BL_gp), 001 (BL_gp_rev), 410 (KY_national, etc (game order)

<car> 3 character representation.
XFG, XRG, XRT, RB4, FXO, LX4, LX6, MRT, UF1, RAC, FZ5, FOX, XFR, UFR, FO8, FXR, XRR, FZR

<racer> a valid LFS username

<time> a laptime represented in milliseconds

<splitX> a splittime represented in milliseconds

<lapcount> number of laps

<steering> w, m, ks, kn

<flags_hlaps> 1 LEFTHANDDRIVE
2 GEARCHANGECUT
4 GEARCHANGEBLIP
8 AUTOGEAR
16 -
32 -
64 BRAKEHELP
128 THROTTLEHELP
256 -
512 -
1024 MOUSESTEER *
2048 KN *
4096 KS *
(*) if not 1024, 2048 or 4096, steering is wheel.

<id_hl> ID used for hotlaps download : http://www.lfsworld.net/get_spr.php?file=<id_hl>

<id_wr> ID used for wr-hotlaps download : http://www.lfsworld.net/get_spr.php?file=<id_wr>&w=1

<log_filter> 1=WR's - 2=top10 - 3=top50 - 4=ALL

<starttime> Unix timestamp - used for hotlaps upload log; only display entries newer than <starttime>

<format> used for hotlaps upload log. Can be 1, 2 or 3.
See the hl_log explanation for all possible formats

-----------------------------------------------------------------
-----------------------------------------------------------------


Version numbers
---------------------
Since v1.1, Version numbers have been introduced, to make future updates easier while not having to disrupt your existing scripts. If you were already running a script, you don't have to change anything, unless you want to make use of the new features that come with the latest versions.
The current version is v1.3
Version numbers should be indicated in the url, via the "version" variable.

User-identification (login / Ident-Key)
--------------------------------------------
The option to identify yourself has been introduced in v1.2. From then on identification has been voluntary, but since v1.3, identification is obligatory for all. You cannot use Pubstat without identification. This is not so that we can play big brother - it is so that we get a clearer picture on the usage of Pubstat, since this is a large portion of LFS World traffic.
Identification is also meant to make the Premium Pubstat service possible.

There are two ways to identify yourself:
1) Using an Ident-Key which you can generate on behalf of your account on the LFS World settings pages
You can feed an Ident-Key to the pubstat script via the following variable:
&idk=<Ident-Key>

If you bind an IP address to an Ident-Key, then pubstat will make sure that only that IP address can use that Ident-Key.

or

2) Using your normal login (the same as your LFS account), via the following two url-variables :
&user=<username>
&pass=<password>

== Password Notice ==
<password> may be your password in plain text, or you can md5 it before sending (strongly recommended).
== Password Notice ==


SCRIPT LOCATION and ACTIONS (requests):
---------------------------------------

script url: http://www.lfsworld.net/pubstat/get_stat2.php?version=1.3&action=...


?action=hl
----------
(get all hotlaps of a racer)

requires: &racer=<racer>
optional: -
returns: <id_hl> <track> <car> <split1> <split2> <split3> <time> <flags_hlaps>


----------
?action=pb
----------
(get all online pb's of a racer)

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


----------
?action=ch
----------
(get all entries of a specific hotlap chart)

requires: &track=<track>&car=<car>
optional: &control=<steering>
returns: <split1> <split2> <split3> <time> <flags_hlaps> <racername>


----------
?action=wr
----------
(all available wr's)

requires: -
optional: -
returns: <id_wr> <track> <car> <split1> <split2> <split3> <time> <flags_hlaps> <racername>


-----------
?action=pst
-----------
(online statistics of one racer)

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)
current / last track(*)
current / last car(*)

(*) At time of writing this document, these values are not yet available for everybody - they will be collected over time (someone has to race online at least once).


-------------
?action=hosts
-------------
(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]
spare byte [1]
spare byte [1]
NROFRACERS byte[1]
RACERNAMES char[24 * NROFRACERS]

LAPS work like this:
L is the given Laps value
0=practice
1-100=laps
101-190=110-1000 laps... 100+(L-100)*10
191-238=1-48 hours... L-190

TMLT means:
Type 0 : old S1 / 1 : new S1 / 2 : S2
Main version times 10 (e.g. 3 means version 0.3)
Letter e.g. 'H' in 0.3H
TestId zero : official / non-zero : test patch id

(*) TRC is in numbers:
000 = bl1
001 = bl1r
010 = bl2
..
220 = fe3
221 = fe3r
etc.

cars bits:
XFG 1
XRG 2
XRT 4
RB4 8
FXO 16
LX4 32
LX6 64
MRT 128
etc etc

rules bits :
CAN_VOTE 1
CAN_SELECT 2
QUALIFY 4
PRIVATE 8
MODIFIED 16
MIDRACEJOIN 32
MUSTPIT 64

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

requires: -
optional: -
returns: TEAM STRUCT:

TEAM char [128]
TAG char [6]
COUNTRY char [32]
URL char [64]
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

BITS :
// 1 : race
// 2 : drift
// 4 : drag
// 8 : can apply
// 16 : has host
// 32 : Demo
// 64 : S1
// 128 : S2
// 256 : S3


--------------
?action=hl_log
--------------
(get latest entries from the hotlap upload log)

requires: &version=1.2 (or higher)
optional: &log_filter=<log_filter>&lines=[1-150]&control=<steering>&starttime=<starttime>
special: &format=<format>
returns: <format = 1> (default) preformatted text, "<u>18:36/05-01-2006</u> <b>sanxav</b> has uploaded a new hotlap to 4th place: <b>1:56.240</b> on <a href="http://www.lfsworld.net/?win=hotlaps&whichTab=trackcharts&track=as&config=national_rev&car=XFR&racer=sanxav" target="_blank"><b>AS national rev</b> with the <b>xf gtr</b></a>\n"

<format = 2> XML formatted, all values separated via XML.
See output for self-explanatory values.

<format = 3> binary, using struct:
time int; // upload-time (unix timestamp, GMT+1 (UK))
racer char[24]; // username
country char[32]; // racer's country
tcrc char[4]; // track config reversed car
split1 int; // split 1 in ms
split2 int; // split 2 in ms
split3 int; // split 3 in ms
split4 int; // split 4 in ms
pos word; // position in chart when uploaded
flags word; // see hotlap flags
id_hl int; // <id_hl>


-------------------
Output compression
-------------------
(The output this script generates can be gzip compressed in 3 ways)

&c=1 gzencode
&c=2 gzcompress
&c=3 gzdeflate

Will ID be obligatory across all versions, or from 1.3 onwards?
Quote from Dygear :Yes.

There was an option there. You can't just say "Yes".

Whilst I believe I know the correct answer, my problem is that the following isn't 100% clear for new-comers, or people modding others code:
Quote :since v1.3, identification is obligatory for all. You cannot use Pubstat without identification.

no and races will probably never make it into pubstat because it can get really elaborate. There was a post about this topic somewhere, but i can't find it atm - if you really want to have complete race-info you should parse replays.
Quote from the_angry_angel :There was an option there. You can't just say "Yes".

Whilst I believe I know the correct answer, my problem is that the following isn't 100% clear for new-comers, or people modding others code:

obligatory for all versions and everyone. If one doesn't make use of identification just yet, they will find out their script has stopped working when v1.3 goes live.

This may sound harsh, but it's been announced months ago and a week ago in the main forum section, as a sticky, so imo people who use pubstat should know about it.
Some tracks have just 2 sectors, and others have up to 4. So why do we only have 3 sector areas?
there are maximum 3 split times - the 4'th would be the actual laptime (that's why you won't see split4)

There are always 3 split times displayed, so you always know what to expect in the output.

did that answer your question?
-----------
?action=pst
-----------
(online statistics of one racer)

requires: &racer=<racer>
optional: -
returns: distance in metres
...
last_activity_time(*) (Unix timestamp)
current / last track(*)
current / last car(*)

(*) At time of writing this document, these values are not yet available for everybody - they will be collected over time (someone has to race online at least once).

What are the values for racers that have not yet had data collected?
then it'll be blank. The 0 of the 'online status' in the pst list will be the last value
In the Teams-Struct, the url should be increased (as this was the one that failed some time ago...).

Thanks
Jens (Red Runner)
yeah just updated that

v1.3 is out now btw

FGED GREDG RDFGDR GSFDG