Skip to content

Commit 2eca9c2

Browse files
committed
Add TokenGroups script v0.7.0
1 parent 28f9316 commit 2eca9c2

3 files changed

Lines changed: 1043 additions & 0 deletions

File tree

TokenGroups/README.md

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# TokenGroups — Roll20 API Script (v0.7.0)
2+
3+
Create and manage **named groups of tokens** per page, then act on the whole group at once (move between layers, show/ping, list, purge, stats). Enhanced with ScriptCards integration for superior formatting and menus. Designed for GMs with clear menus and minimal footprint.
4+
5+
6+
## Features
7+
8+
- **Page‑scoped groups**: a group name is tied to a single page.
9+
- **Bulk actions**: move a whole group to `objects`, `gmlayer`, or `map`; ping/show locations.
10+
- **Enhanced ScriptCards menus**: in‑chat buttons with superior formatting and styling.
11+
- **Dual render modes**: HTML (basic) or ScriptCards (enhanced) formatting.
12+
- **Stats & Purge**: see totals by page/group; remove missing token IDs from state.
13+
- **Quoted names & `Name@Page`**: handle spaces; disambiguate duplicates across pages.
14+
- **Startup whisper**: confirms load + enabled/disabled state to GM.
15+
- **Small footprint**: namespaced state, no polling, minimal object writes.
16+
- **Handout helper**: `!tgroup doc` creates/updates a GM handout with basics.
17+
18+
---
19+
20+
## Requirements
21+
22+
- **Roll20 Pro** (API access).
23+
- **ScriptCards** (optional but recommended for enhanced formatting).
24+
- Paste the TokenGroups v0.7.0 script into your game's **Settings → API Scripts → New Script**.
25+
26+
---
27+
28+
## Installation & First Run
29+
30+
1. Paste the script and **Save Script**. The API sandbox reloads.
31+
2. You'll get a GM whisper like:
32+
`TokenGroups v0.7.0 is loaded (currently disabled). Type !tgroup help.`
33+
3. **Enable** the script (disabled by default, per Roll20 best practices):
34+
```text
35+
!tgroup enable
36+
```
37+
4. (Optional) Configure render mode for ScriptCards integration:
38+
```text
39+
!tgroup config render sc
40+
```
41+
5. (Optional) Generate a GM handout with quick instructions:
42+
```text
43+
!tgroup doc
44+
```
45+
46+
---
47+
48+
## Core Concepts
49+
50+
- A **group** is just a named list of token IDs on **one** Roll20 page.
51+
- You can operate on a group from anywhere; the page doesn't need to be active.
52+
- If a name exists on multiple pages, target with **`GroupName@PageNameOrID`**.
53+
- Use **quotes** for names with spaces: `"Bandit Squad"`, and for pages: `"Dungeon L1"`.
54+
- **ScriptCards mode** provides enhanced formatting, better buttons, and improved menus.
55+
56+
---
57+
58+
## Commands
59+
60+
### Basic Operations
61+
| Command | Description |
62+
|---------|-------------|
63+
| `!tgroup help` | Show help and command list |
64+
| `!tgroup enable` | Enable the script |
65+
| `!tgroup disable` | Disable the script |
66+
| `!tgroup status` | Show current status |
67+
68+
### Configuration
69+
| Command | Description |
70+
|---------|-------------|
71+
| `!tgroup config render <html\|sc>` | Set render mode (HTML or ScriptCards) |
72+
| `!tgroup config whisper <on\|off>` | Toggle whisper notifications |
73+
74+
### Group Management
75+
| Command | Description |
76+
|---------|-------------|
77+
| `!tgroup create <name>` | Create group from selected tokens |
78+
| `!tgroup add <name>` | Add selected tokens to group |
79+
| `!tgroup remove <name[@page]>` | Remove selected tokens from group |
80+
| `!tgroup rename <old[@page]> <new>` | Rename a group |
81+
| `!tgroup delete <name[@page]>` | Delete a group |
82+
| `!tgroup clear <name[@page]>` | Clear all tokens from group |
83+
84+
### Group Actions
85+
| Command | Description |
86+
|---------|-------------|
87+
| `!tgroup move <name[@page]> <objects\|gmlayer\|map>` | Move group to specified layer |
88+
| `!tgroup show <name[@page]>` | Show/ping group tokens |
89+
| `!tgroup list` | List groups on current page |
90+
| `!tgroup list all` | List all groups across all pages |
91+
| `!tgroup list page <name\|id>` | List groups on specific page |
92+
93+
### Utilities
94+
| Command | Description |
95+
|---------|-------------|
96+
| `!tgroup where <name[@page]>` | Find which page contains a group |
97+
| `!tgroup purge [name\|all]` | Remove missing token IDs from state |
98+
| `!tgroup stats` | Show overall statistics |
99+
| `!tgroup stats group <name[@page]>` | Show group-specific stats |
100+
| `!tgroup stats page <name\|id>` | Show page-specific stats |
101+
| `!tgroup menu [<name[@page]>]` | Show interactive menu |
102+
| `!tgroup doc` | Create/update GM handout |
103+
104+
---
105+
106+
## ScriptCards Integration
107+
108+
### Enhanced Features
109+
- **Better formatting**: Rich text with `[b]`, `[i]`, `[c]`, `[color]`, etc.
110+
- **Improved buttons**: Custom styling with colors and sizes
111+
- **Enhanced menus**: ScriptCards-first design with better layout
112+
- **Inline styles**: Superior presentation and readability
113+
114+
### Render Modes
115+
- **HTML mode**: Basic HTML formatting (default)
116+
- **ScriptCards mode**: Enhanced formatting with ScriptCards syntax
117+
118+
### Configuration
119+
```text
120+
!tgroup config render sc # Enable ScriptCards mode
121+
!tgroup config render html # Use basic HTML mode
122+
```
123+
124+
---
125+
126+
## Examples
127+
128+
### Creating and Managing Groups
129+
```text
130+
# Select some tokens, then:
131+
!tgroup create "Goblin Squad"
132+
133+
# Add more tokens to the group:
134+
!tgroup add "Goblin Squad"
135+
136+
# Move the entire group to the GM layer:
137+
!tgroup move "Goblin Squad" gmlayer
138+
139+
# Show where the group is:
140+
!tgroup show "Goblin Squad"
141+
```
142+
143+
### Cross-Page Operations
144+
```text
145+
# Work with groups on different pages:
146+
!tgroup move "Bandits@Dungeon Level 1" objects
147+
!tgroup list page "Dungeon Level 1"
148+
!tgroup stats page "Dungeon Level 1"
149+
```
150+
151+
### Interactive Menus
152+
```text
153+
# Show main menu:
154+
!tgroup menu
155+
156+
# Show group-specific menu:
157+
!tgroup menu "Goblin Squad"
158+
```
159+
160+
---
161+
162+
## Configuration Options
163+
164+
The script supports several configuration options:
165+
166+
- **enabled_on_boot**: Start enabled when API sandbox boots (default: true)
167+
- **render_mode**: Choose between "html" or "sc" (ScriptCards) rendering
168+
- **auto_menu**: Automatically show menu when creating/updating groups
169+
170+
---
171+
172+
## Troubleshooting
173+
174+
### Common Issues
175+
176+
1. **Script not responding**:
177+
- Check if script is enabled: `!tgroup status`
178+
- Enable if needed: `!tgroup enable`
179+
180+
2. **Groups not found**:
181+
- Use `!tgroup list all` to see all groups
182+
- Check page names with `!tgroup list page <name>`
183+
- Use `Name@Page` syntax for cross-page operations
184+
185+
3. **ScriptCards formatting not working**:
186+
- Ensure ScriptCards is installed
187+
- Check render mode: `!tgroup config render sc`
188+
- Verify ScriptCards is working with other scripts
189+
190+
### Debug Commands
191+
```text
192+
!tgroup status # Check script status
193+
!tgroup stats # View overall statistics
194+
!tgroup purge all # Clean up missing tokens
195+
!tgroup where <name> # Find group location
196+
```
197+
198+
---
199+
200+
## Support
201+
202+
For issues or questions:
203+
1. Check the Roll20 API log for error messages
204+
2. Use `!tgroup help` for command reference
205+
3. Try `!tgroup status` to verify script state
206+
4. Use `!tgroup doc` to generate a reference handout
207+
208+
---
209+
210+
## License
211+
212+
This script is provided as-is for use in Roll20 games.

0 commit comments

Comments
 (0)