messageForm .show(player) .then((formData: MessageFormResponse) => { // player canceled the form, or another dialog was up and open. if (formData.canceled || formData.selection === undefined) { return; }
player.sendMessage(`You selected ${formData.selection===0?'Player 1':'Player 2'}`); }) .catch((error: Error) => { player.sendMessage('Failed to show form: ' + error); }); }
Builds a simple two-button modal dialog.
Example: messageFormSimple.ts