Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Form<"action">
    • ActionForm

Index

Constructors

  • new ActionForm(data: { buttons?: { button: Button; id: string }[]; text?: string; title?: string }): ActionForm
  • Creates a new action form with the provided data

    Parameters

    • data: { buttons?: { button: Button; id: string }[]; text?: string; title?: string }

      The data to build the action form with

      • Optional buttons?: { button: Button; id: string }[]

        The buttons displayed in the action form, listed from top to bottom

      • Optional text?: string

        The body text of this action form, this is displayed below the title

      • Optional title?: string

        The title of this action form, this is displayed at the top of the window

    Returns ActionForm

Properties

buttons: { button: Button; id: string }[]

The buttons displayed in the action form, listed from top to bottom

text: string

The body text of this action form, this is displayed below the title

title: string

The title of this action form, this is displayed at the top of the window

type: "action"

The type of Form

Methods

  • addButton(id: string, button: Button): void
  • complete(plr: MBCPlayer, response: ActionFormResponse, onCancel?: ((plr: MBCPlayer) => void)): void
  • createForm(): ActionFormData
  • removeButton(id: string): void
  • Sends this form to a player or array of players

    example
    new ActionForm({
    text: 'Example Body text',
    title: 'Example Action Form',
    buttons: [
    {
    id: 'button0',
    button: new Button({
    text: 'Button 0',
    onClick: (plr) => {
    plr.sendMessage('Clicked Button 0');
    },
    }),
    },
    {
    id: 'button1',
    button: new Button({
    text: 'Button 1',
    onClick: (plr) => {
    plr.sendMessage('Clicked Button 1');
    },
    }),
    },
    {
    id: 'button2',
    button: new Button({
    text: 'Button 2',
    onClick: (plr) => {
    plr.sendMessage('Clicked Button 2');
    },
    }),
    },
    ]
    }).send(player, (plr) => {
    plr.sendMessage('Closed modal form via cancelation');
    }, (plr) => {
    plr.sendMessage('Modal form timed out, likely due to having an existing ui open upon request');
    });

    Parameters

    • plr: MBCPlayer | MBCPlayer[]

      The player(s) to send this form to

    • Optional onCancel: ((plr: MBCPlayer) => void)

      A callback that is called when the form is cancelled

    • Optional onTimeout: ((plr: MBCPlayer) => void)

      A callback that is called when the form times out

    Returns void

  • setDef(curr: any, to: any): any

Generated using TypeDoc version 0.22.18, the 7/5/2022