Difference between revisions of "IS STA"

From LFS Manual
Jump to navigationJump to search
m
 
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
  
The IS_STA or STAte packet contains various information about the current game state and is sent any time the information included in the packet changes. To request for an IS_STA packet to be sent, send a [[IS_TINY]] with a SubT of TINY_STA.  
+
The '''STA'''te packet contains information about the current game state and is sent any time the information included in the packet changes. To request for an IS_STA packet to be sent, send an [[IS_TINY]] with a SubT of TINY_STA.
  
<big><pre>struct IS_STA // STAte
+
{| class="wikitable"
{
+
|+ IS_STA packet properties
byte Size; // 28
+
|-
byte Type; // ISP_STA
+
! Type !! Name !! Description
byte ReqI; // ReqI if replying to a request packet
+
|-
byte Zero;
+
| byte
 +
| Size
 +
| 28
 +
|-
 +
| byte
 +
| Type
 +
| ISP_STA
 +
|-
 +
| byte
 +
| ReqI
 +
| ReqI if replying to a request packet
 +
|-
 +
| byte
 +
| Zero
 +
|
 +
|-
 +
| float
 +
| ReplaySpeed
 +
| 4-byte float - 1.0 is normal speed
 +
|-
 +
| word
 +
| Flags
 +
| ISS state flags (see below)
 +
|-
 +
| byte
 +
| InGameCam
 +
| Which type of camera is selected (see below)
 +
|-
 +
| byte
 +
| ViewPLID
 +
| Unique ID of viewed player (0 = none)
 +
|-
 +
| byte
 +
| NumP
 +
| Number of players in race
 +
|-
 +
| byte
 +
| NumConns
 +
| Number of connections including host
 +
|-
 +
| byte
 +
| NumFinished
 +
| Number finished or qualified
 +
|-
 +
| byte
 +
| RaceInProg
 +
| 0 - no race / 1 - race / 2 - qualifying
 +
|-
 +
| byte
 +
| QualMins
 +
|
 +
|-
 +
| byte
 +
| RaceLaps
 +
| see "RaceLaps" near the top of this document
 +
|-
 +
| byte
 +
| Spare2
 +
|
 +
|-
 +
| byte
 +
| Spare3
 +
|
 +
|-
 +
| char
 +
| Track[6]
 +
| short name for track e.g. FE2R
 +
|-
 +
| byte
 +
| Weather
 +
| 0,1,2...
 +
|-
 +
| byte
 +
| Wind
 +
| 0=off 1=weak 2=strong
 +
|}
  
float ReplaySpeed; // 4-byte float - 1.0 is normal speed
+
== Packet Details ==
 
 
word Flags; // ISS state flags (see below)
 
byte InGameCam; // Which type of camera is selected (see below)
 
byte ViewPLID; // Unique ID of viewed player (0 = none)
 
 
 
byte NumP; // Number of players in race
 
byte NumConns; // Number of connections including host
 
byte NumFinished; // Number finished or qualified
 
byte RaceInProg; // 0 - no race / 1 - race / 2 - qualifying
 
 
 
byte QualMins;
 
byte RaceLaps; // see "RaceLaps" near the top of this document
 
byte Spare2;
 
byte Spare3;
 
 
 
char Track[6]; // short name for track e.g. FE2R
 
byte Weather; // 0,1,2...
 
byte Wind; // 0=off 1=weak 2=strong
 
};</pre></big>
 
 
 
== Packet Detail ==
 
  
 
=== Size ===
 
=== Size ===
Line 39: Line 93:
 
=== Type ===
 
=== Type ===
  
The packet type from the ISP_ enumeration, always ISP_STA.
+
The packet type from the [[InSim_enumerations#ISP|ISP_]] enumeration, always ISP_STA.
  
 
=== ReqI ===
 
=== ReqI ===
  
The ReqI as set in the request for an IS_STA to be sent.
+
Zero if sent directly by LFS, otherwise equal to the ReqI provided in the request for the IS_STA packet.
  
 
=== Replay Speed ===
 
=== Replay Speed ===
Line 57: Line 111:
 
* ISS_PAUSED: Game is paused
 
* ISS_PAUSED: Game is paused
 
* ISS_SHIFTU: In SHIFT+U mode
 
* ISS_SHIFTU: In SHIFT+U mode
* ISS_SHIFTU_HIGH: In high view
+
* ISS_DIALOG: In a dialog
* ISS_SHIFTU_FOLLOW: Following car
+
* ISS_SHIFTU_FOLLOW: Following a car
 
* ISS_SHIFTU_NO_OPT: In SHIFT+U mode but buttons hidden
 
* ISS_SHIFTU_NO_OPT: In SHIFT+U mode but buttons hidden
 
* ISS_SHOW_2D: 2D on-screen display visible
 
* ISS_SHOW_2D: 2D on-screen display visible
Line 64: Line 118:
 
* ISS_MULTI: In multiplayer mode
 
* ISS_MULTI: In multiplayer mode
 
* ISS_MPSPEEDUP: Multiplayer speedup option active
 
* ISS_MPSPEEDUP: Multiplayer speedup option active
* ISS_WINDOWED: LFS running in windows mode (SHIFT+F4)
+
* ISS_WINDOWED: LFS running in windowed mode (SHIFT+F4)
 
* ISS_SOUND_MUTE: Sound is turned off
 
* ISS_SOUND_MUTE: Sound is turned off
 
* ISS_VIEW_OVERRIDE: Override user view
 
* ISS_VIEW_OVERRIDE: Override user view
 
* ISS_VISIBLE: InSim buttons are currently visible
 
* ISS_VISIBLE: InSim buttons are currently visible
 +
* ISS_TEXT_ENTRY: In a text entry dialog
  
 
=== InGameCam ===
 
=== InGameCam ===
  
Which type of in-game camera is being used, from the VIEW_ enumeration.
+
Which type of in-game camera is being used, from the [[InSim_enumerations#VIEW|VIEW_]] enumeration.
  
 
* VIEW_FOLLOW: Chase camera (arcade) view
 
* VIEW_FOLLOW: Chase camera (arcade) view
Line 78: Line 133:
 
* VIEW_DRIVER: Cockpit view
 
* VIEW_DRIVER: Cockpit view
 
* VIEW_CUSTOM: Custom view
 
* VIEW_CUSTOM: Custom view
* VIEW_MAX: Undocumented
 
 
* VIEW_ANOTHER: Viewing another car
 
* VIEW_ANOTHER: Viewing another car
  
 
=== ViewPLID ===
 
=== ViewPLID ===
  
Unique player ID (PLID) of the car current being viewed (0 = none).
+
Unique player ID (PLID) of the car currently being viewed (0 = none).
  
 
=== NumP ===
 
=== NumP ===
  
Number of players current in the race.
+
Number of players currently in the race.
  
 
=== NumConns ===
 
=== NumConns ===
Line 142: Line 196:
 
}
 
}
 
</pre></big>
 
</pre></big>
 +
 +
=== ServerStatus ===
 +
 +
The status of the connection to the server.
 +
 +
* 0: Unknown
 +
* 1: Success
 +
* > 1: Fail
  
 
=== Track ===
 
=== Track ===
  
The short name for the track, E.G. BL1R or FE3.
+
The short name for the track, e.g. BL1R or FE3.
  
 
=== Weather ===
 
=== Weather ===

Latest revision as of 20:09, 9 February 2026

Introduction

The STAte packet contains information about the current game state and is sent any time the information included in the packet changes. To request for an IS_STA packet to be sent, send an IS_TINY with a SubT of TINY_STA.

IS_STA packet properties
Type Name Description
byte Size 28
byte Type ISP_STA
byte ReqI ReqI if replying to a request packet
byte Zero
float ReplaySpeed 4-byte float - 1.0 is normal speed
word Flags ISS state flags (see below)
byte InGameCam Which type of camera is selected (see below)
byte ViewPLID Unique ID of viewed player (0 = none)
byte NumP Number of players in race
byte NumConns Number of connections including host
byte NumFinished Number finished or qualified
byte RaceInProg 0 - no race / 1 - race / 2 - qualifying
byte QualMins
byte RaceLaps see "RaceLaps" near the top of this document
byte Spare2
byte Spare3
char Track[6] short name for track e.g. FE2R
byte Weather 0,1,2...
byte Wind 0=off 1=weak 2=strong

Packet Details

Size

The size of the packet, always 28.

Type

The packet type from the ISP_ enumeration, always ISP_STA.

ReqI

Zero if sent directly by LFS, otherwise equal to the ReqI provided in the request for the IS_STA packet.

Replay Speed

The current replay speed as a floating point number, with 1.0 as normal speed. Only set when playing back a replay.

Flags

The ISS_ bit flags.

  • ISS_GAME: In game or playing MPR (multiplayer replay)
  • ISS_REPLAY: In SPR (singleplayer replay)
  • ISS_PAUSED: Game is paused
  • ISS_SHIFTU: In SHIFT+U mode
  • ISS_DIALOG: In a dialog
  • ISS_SHIFTU_FOLLOW: Following a car
  • ISS_SHIFTU_NO_OPT: In SHIFT+U mode but buttons hidden
  • ISS_SHOW_2D: 2D on-screen display visible
  • ISS_FRONT_END: On game entry screen
  • ISS_MULTI: In multiplayer mode
  • ISS_MPSPEEDUP: Multiplayer speedup option active
  • ISS_WINDOWED: LFS running in windowed mode (SHIFT+F4)
  • ISS_SOUND_MUTE: Sound is turned off
  • ISS_VIEW_OVERRIDE: Override user view
  • ISS_VISIBLE: InSim buttons are currently visible
  • ISS_TEXT_ENTRY: In a text entry dialog

InGameCam

Which type of in-game camera is being used, from the VIEW_ enumeration.

  • VIEW_FOLLOW: Chase camera (arcade) view
  • VIEW_HELI: Helicopter view
  • VIEW_CAM: Track-side (TV) camera view
  • VIEW_DRIVER: Cockpit view
  • VIEW_CUSTOM: Custom view
  • VIEW_ANOTHER: Viewing another car

ViewPLID

Unique player ID (PLID) of the car currently being viewed (0 = none).

NumP

Number of players currently in the race.

NumConns

Number of players currently connected to the server, including the host.

NumFinished

Number of players currently finished the race or qualifying session.

RaceInProg

Whether the race is currently in progress.

  • 0: No race
  • 1: Race
  • 2: Qualifying

QualMins

Number of minutes for the qualifying session, if set.

RaceLaps

The number of laps in the race. This value has various meanings depending on its range.

  • 0: Practice session
  • 1-99: Number of laps
  • 100-190: 100 to 1000 laps (laps = (rl - 100) * 10 + 100)
  • 191-238: 1 to 48 hours (hours = rl - 190)

Here is an example of determining the laps and/or hours:

int getLaps(int raceLaps)
{
    if (raceLaps >= 1 && raceLaps <= 99)
    {
        return raceLaps;
    }
    else if (raceLaps >= 100 && raceLaps <= 190)
    {
        return (raceLaps - 100) * 10 + 100;
    }
    return 0;
}

int getHours(int raceLaps)
{
    if (raceLaps >= 191 && raceLaps <= 238)
    {
        return raceLaps - 190;
    }
    return 0;
}

ServerStatus

The status of the connection to the server.

  • 0: Unknown
  • 1: Success
  • > 1: Fail

Track

The short name for the track, e.g. BL1R or FE3.

Weather

The weather settings in game.

  • 0: Bright or clear
  • 1: Overcast
  • 2: Cloudy, sunset or dusk

Wind

The wind settings in game.

  • 0: None
  • 1: Low
  • 2: High