Skip to content

Commit

Permalink
docs(insim): update docs about InSim message helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mkapal committed Nov 26, 2024
1 parent 717aa1d commit 6eda499
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,43 @@ pingPacket.SubT = TinyType.TINY_PING;
inSim.send(pingPacket);
```

### Sending messages

The `InSim` class has helper methods useful for sending messages to LFS.

#### Send a message which will appear on the local computer only

```ts
inSim.sendLocalMessage('Local message');
```

#### Send a command

```ts
inSim.sendMessage('/end');
```

#### Send a message

- up to 63 characters - send an `IS_MST` packet
- 64 characters or more - send an `IS_MSX` packet

```ts
inSim.sendMessage('This is a message');
```

#### Send a message to a specific connection by their UCID

```ts
inSim.sendMessageToConnection(4, 'This is a message targeting UCID 4');
```

#### Send a message to a specific player by their PLID

```ts
inSim.sendMessageToPlayer(4, 'This is a message targeting PLID 4');
```

### Receiving packets

The `InSim` class exposes an `on()` method, which is used to listen for incoming
Expand Down

0 comments on commit 6eda499

Please sign in to comment.