Skip to content

Helper functions for sending InSim messages #54

@mkapal

Description

@mkapal

Problem

  • If you want to send a message with up to 63 characters, you must send an IS_MST packet.
  • If you want to send a message with more than 63 characters, you must send an IS_MSX packet.
  • If you want to send a command you must send an IS_MST packet.
  • If you want to send a message to a player, you must send an IS_MTC packet with PLID property.
  • If you want to send a message to a connection, you must send an IS_MTC packet with UCID property.
  • If you want to send local message, you must send an IS_MSL packet.

Proposed API

const inSim = new InSim();

// Send a message which will appear on the local computer only
inSim.sendLocalMessage('Local message');

// Starts with a slash - send an IS_MST packet
inSim.sendMessage('/end');

//  Up to 63 characters - send an IS_MST packet
inSim.sendMessage(
  'This is a message that is shorter than 64 characters exactly 63',
);

// 64 characters or more - send an IS_MSX packet
inSim.sendMessage(
  'This is another long message that is exactly 64 characters long!',
);

// Send a message to a specific connection by their UCID
inSim.sendMessageToConnection(4, 'This is a message targeting UCID 4');

// Send a message to a specific player by their PLID
inSim.sendMessageToPlayer(4, 'This is a message targeting PLID 4');

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions