Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper functions for sending InSim messages #54

Closed
mkapal opened this issue Nov 26, 2024 · 0 comments
Closed

Helper functions for sending InSim messages #54

mkapal opened this issue Nov 26, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request scope:insim InSim

Comments

@mkapal
Copy link
Member

mkapal commented Nov 26, 2024

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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scope:insim InSim
Projects
None yet
Development

No branches or pull requests

1 participant