Register

Requestor

An Add-on Module for Foundry Virtual Tabletop

Author: Zhell Project Source: Project URL Versions 12 - 12 (Verified 12) Last Updated 6 months ago

This is a system-agnostic module that a GM can use with the built-in methods to create chat cards with buttons for players (or the GM) to click.

The main method is Requestor.request(), whose inner object requires at least an array of objects buttonData. Example (for dnd5e):

await Requestor.request({
  description: "This is a request.",
  buttonData: [{
    label: "Nature Skill Check",
    command: async function(){
      return actor.rollSkill("nat", {event});
    }
  }]
});

which will display a message with a button that anyone can click and be prompted to roll Nature. The buttonData array can take an arbitrary number of objects.

How to use:

Create the following constants, all of which are optional, then run the main method with the given keys and values:

buttonData array

The buttonData array is an array of objects detailing the buttons that go on the card. Each object should have command (a function) and label (a string). Any special parameters that should be used in the function can be added under a third parameter scope (an object); these will be directly accessible in the command. Example:

await Requestor.request({
  description: "This is a request.",
  buttonData: [{
    label: "A Skill Check",
    command: async function(){
      return actor.rollSkill(skill, {event});
    },
    scope: {skill: "nat"}
  }]
});

The full list of keys (other than label and command) to pass to a button include limit and permission with these options:

Helper functions

Some helper functions are pre-defined:

Methods specific to dnd5e:

Supplied Variables

These variables are declared in any executed command:

Categories

Available Versions

  1. Version 12.0.0

    6 months ago
    Foundry Version 12 - 12 (Verified 12) Manifest URL Read Notes
  2. Version 11.0.3

    12 months ago
    Foundry Version 11 - 11 (Verified 11) Manifest URL Read Notes
  3. Version 11.0.2

    1 year, 2 months ago
    Foundry Version 11 - 11 (Verified 11) Manifest URL Read Notes
  4. Version 11.0.1

    Foundry Version 11 - 11 (Verified 11) Manifest URL Read Notes
  5. Version 11.0.0

    Foundry Version 11 - 11 (Verified 11) Manifest URL Read Notes
  6. Version 10.0.5.2

    Foundry Version 10 - 10 (Verified 10.290) Manifest URL Read Notes
  7. Version 1.1.1

    Foundry Version 9 - 9 (Verified 9) Manifest URL Read Notes