defineCommand
defineCommand<
Fields,Options>(fields,options?):CommandDeclaration<Fields,ReasonOf<Options> |FilterReasonOf<Fields>,ReturnsOf<Options>,ActsThroughIn<Options>,EndsWithLevelIn<Options>,PredictedIn<Options>>
Declares a command by its payload’s fields and one options object:
defineCommand({ tile: integer(0, 255) }, { refusals: ["occupied"] }).
Every option has a default, so defineCommand({}) is a whole command,
run on the room, accepted with no value, and refused only for the
engine’s own reasons. A plugin lists it under commands, one system
names it in its entry’s answers and reads it with readCommands, and
a page sends it with sendCommand, which resolves with one result. As
Roblox’s RemoteFunction, with a typed refusal and exactly-once
delivery that none of the engines gives.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Fields extends Readonly<Record<string, CommandField>> |
- |
Options extends CommandOptions<string, Readonly<Record<string, ReturnField>> | undefined, boolean, CommandLifetime, boolean> |
Record<never, never> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fields |
Fields |
options? |
Options & LifetimeCheck<Options> & PredictedCheck<Options> & BindingCheck<Fields> |
Returns
Section titled “Returns”CommandDeclaration<Fields, ReasonOf<Options> | FilterReasonOf<Fields>, ReturnsOf<Options>, ActsThroughIn<Options>, EndsWithLevelIn<Options>, PredictedIn<Options>>