ST Reference Player Count - ironmonk88/monks-module-wiki GitHub Wiki

Reference Player Count

Runs a macro that counts the number of active players; this can then be referenced in other actions with the handlebar expression {{value.totalPlayers}}.

Macro version 01 includes the GM in the count, while version 02 does not.

The example below includes Jumping to various Landings for different action threads based on the player count, though you can use this macro before other actions that accepts handlebar expressions, such as Check Entity Count.

Not officially supported by MATT.

Setup Required

Actions

Click here to view Macro Version 01

// Macro is intended to be run by MATT to return the player count which can then be referenced using {{value.totalPlayers}}
// This version includes the GM in the count.

return { totalPlayers: game.users.filter(u => u.active).length };
Click here to view Macro Version 02

// Macro is intended to be run by MATT to return the player count which can then be referenced using {{value.totalPlayers}}
// This version does not include the GM in the count.

return { totalPlayers: game.users.filter(u => u.active && !u.isGM).length };
Click here to view Tile Template JSON Data

Copy & paste this into Notepad and save it as a .JSON file. Then import it using MATT's Tile Templates.

{
  "texture": {
    "src": null,
    "scaleX": 1,
    "scaleY": 1,
    "tint": null,
    "offsetX": 0,
    "offsetY": 0,
    "rotation": 0
  },
  "x": 1900,
  "y": 2200,
  "z": 100,
  "width": 100,
  "height": 100,
  "rotation": 0,
  "alpha": 1,
  "flags": {
    "tagger": {
      "tags": ""
    },
    "monks-active-tiles": {
      "active": true,
      "record": false,
      "restriction": "all",
      "controlled": "all",
      "trigger": [
        "enter"
      ],
      "allowpaused": false,
      "usealpha": false,
      "pointer": false,
      "pertoken": false,
      "minrequired": 0,
      "chance": 100,
      "fileindex": 0,
      "actions": [
        {
          "action": "runmacro",
          "data": {
            "entity": {
              "id": "Macro.CTR2xi7CKUsRWcPi",
              "name": "Count Players (MATT)"
            },
            "args": "",
            "runasgm": "unknown"
          },
          "id": "HANjEAucWqGGNNBg"
        },
        {
          "action": "goto",
          "data": {
            "tag": "{{value.totalPlayers}}",
            "limit": null,
            "resume": false
          },
          "id": "ZvXXldS9YWWakdxA"
        },
        {
          "action": "anchor",
          "data": {
            "tag": "1",
            "stop": true
          },
          "id": "MsMkXIUjfLE0cLY5"
        },
        {
          "action": "anchor",
          "data": {
            "tag": "2",
            "stop": true
          },
          "id": "TPEacunbEZEKE91B"
        },
        {
          "action": "anchor",
          "data": {
            "tag": "3",
            "stop": true
          },
          "id": "BdQ44nDiujfWNQnA"
        },
        {
          "action": "anchor",
          "data": {
            "tag": "4",
            "stop": true
          },
          "id": "R8RtCkG0VIeWYb2c"
        },
        {
          "action": "anchor",
          "data": {
            "tag": "5",
            "stop": true
          },
          "id": "i5mcGm1I1LuZwGyc"
        }
      ],
      "files": []
    },
    "exportSource": {
      "world": "matt-test",
      "system": "pf2e",
      "coreVersion": "10.291",
      "systemVersion": "4.9.1"
    }
  },
  "overhead": false,
  "roof": false,
  "occlusion": {
    "mode": 1,
    "alpha": 0,
    "radius": null
  },
  "video": {
    "loop": true,
    "autoplay": true,
    "volume": 0
  },
  "hidden": false,
  "locked": false,
  "id": "4iYVOSzLJVdG7vTR",
  "name": "Reference_Player_Count",
  "visible": true,
  "img": null,
  "thumbnail": "modules/monks-active-tiles/img/cube.svg"
}

Page Last Updated

MATT 10.14

⚠️ **GitHub.com Fallback** ⚠️