
(Pretty new here so I don't know if this belongs in this category or even is allowed on the forums but I figured it was worth a shot if I can help some people out. If the thread gets deleted I won't bring it up again. This is posted with no ill-will towards anyone at Roll20. )
Roll20 Fixes and Improvements
or: How I Learned to Stop Worrying and Love the Bomb
I made a thing. It fixes things. It adds
things to roll20 that I needed in my game yesterday so I added them yesterday.
It's possible these things will be useful to someone else out there and so I'm
putting them in the wild. Be gentle; I make weird functions.
Anyways, the fixes!
- Displays tokenname on select
- When a token is clicked on, shows its name if you have permission to see it. When deselected, hides it again. Won’t hide it if it was shown to begin with.
- (Mouse position is strangely recorded incorrectly in this gif. On click shows, off click hides)
- Allow Macros to be hidden
- Adds a button to the edge of the macrobar that lets
you move the darn thing off the screen. Really useful if your screen is
tiny.
- Create a button to toggle fullscreen
- Mobile device users would probably get the most out of
this one.
- Fix Pings
- sendPing (API) didn’t move player's views to the location specified. Or care if you were on the same page as the ping. Both of those are fixed.
- Additionally, if you specify a playerid in sendPing, only that player will be moved and the circle won't appear on their page. Great for camera accounts or points of interest.
- Alternative configuration: sendPing can be set to "2" in the configuration menu, this will change the behavior of the fix in the following ways
- Global pings will be delayed by 1 second
- ALL players not running the script will receive pings.
- Player and page will only be respected if they're also running the script and have it set to "2"
- CSS Tweaks (Mostly tablet focused. Disabled by default)
- Remove player names/ avatars from macrobar region
- Remove the zoom slider (magnifier is more reliable)
- Remove sidebar show/hide button (why not?)
- Increase chat button sizes (for fat fingers)
- Permanently hide turn order (Combat is on a big screen already)
- Customize token actions
- Set gmnotes to “blank” on a token to hide Macros for that token. If the token is a character, abilities will still show up. You can use this to have two different tokens have two different token action menus. Be careful about filling up your game with a ton of pseudo-characters though, you’ll probably start lagging.
- Pathfinder Community Sheet Custom Attribute Name Fix
- Buffs on the community sheet didn’t display the custom
name of the custom attribute.
- Token Names Auto-split onto newlines
- Get hype. Splits the name by spaces, combines them into chunks that aren’t bigger than the width of the token.
- \n forces new line, _ forces a space that won't go to a new line.
- This also fixes a bug in roll20 where token names are drawn twice if not a GM and advanced fog of war has been enabled before for a page. To use the bug fix without any auto-splitting, just set this option to "1".
- Toolbar Quick Button
- Put a bunch of abilities/ macros into a toolbar button. All are pulled from a macro named "ToolBar".
- First line is the button icon. (emojis or pictos font characters supported)
- Each line after that is of the format icon||displayName||command.
- Command syntax should be the same as API command buttons.
- Will pull the ToolBar template from individual player's macro list first, and if not found check the first visible macro to that player.
- Toggle settings as you'd like
Some things that may be useful (API only)
Sets all selected token’s gmnotes to ‘blank’
//Usage: !blankTokenActions on("chat:message", function(msg) { if(msg.type == "api" && msg.content.indexOf('!blankTokenActions') == 0) { if (_.isUndefined(msg.selected)) { sendChat('Reality', '/w ' + msg.who + " You didn't select any token(s). How did you even get here?", null, {noarchive: true}); return; } _.each(msg.selected, function(tok) { let token = getObj('graphic', tok._id); token.set('gmnotes', 'blank'); }); } });
Deletes every attribute off a specified character sheet.
If you want to keep some attributes from being deleted, put ‘keep’ in the max value of it. Don’t open the sheet or they’ll all be regenerated again.
//Usage: !flushAttr Exact Name of Character with no Quotes or anything like that around it
on("chat:message", function(msg) {
if (msg.type == "api" && msg.content.indexOf('!flushAttr ') == 0) {
msg.content = msg.content.replace('!flushAttr ', '');
var charId = findObjs({_type: 'character', name: msg.content})[0].get('id');
_.each(findObjs({_type: 'attribute', _characterid: charId}), ob => {if (ob.get('max') != 'keep') ob.remove()});
}
});
Disclaimer: I don’t know what you’re doing, my scripts wouldn’t hurt a fly unless you tell them to. Use with caution.
The script is here.
Installation instructions are here.
I’ll post updates in this thread. Suggestions are welcome, requests are frowned upon.
Changelog:
V.0.3.3 (9/30/18)
- Fixed Toolbar quick button not showing up for players not specifically given permission to view it
V.0.3.2 (9/26/18)
- Fixed token actions not displaying if more than 1 token was selected while custom actions was enabled.
V.0.3.1 (9/23/18)
- Fixed token names being drawn twice (I'll submit a bug report to roll20 when I do more research)
- Toolbar quickbuttons can now contain javascript. just prepend your code with "j:" and it will run onclick.
V.0.3.0 (9/20/18)
- Added a quick macro button on the toolbar with customization. See above for setup details.
V.0.2.10 (9/19/18)
- Fixed text that isn't a token name from displaying correctly
- Fixed items disappearing/ jumping around (visually) when shift-selected
V.0.2.8 (9/17/18)
- Timeout and error checking for connections that don't load in time. Let me know if I need to increase this.
V.0.2.6 (9/15/18)
- fixPings can now be enabled globally. See bullet above for more info.
- fixPings now respect player if sent through API. sendPing (API) with a playerid of null will treat it as a global ping, otherwise it will respect the playerid and pageid sent through sendPing
V.0.2.2 (9/12/18)
- Added menu to save/ change preferences.
- Quicker render update on select
- Selected token now temporarily jumps to top while selected
- Fixed 'display token name on select' and 'customize token actions' not being mutually exclusive.
- All gmnotes are wrapped by <p> tags since Text Editor Update leaving Non-API GMs unable to use 'customize token actions'. A temporary/ permanent fix has been added.
- Multi-line token names now is a value instead of true/false indicating max number of lines.
- "\n" can be used to guarantee a line break
- "_ " can be used to insert space without risking it breaking
- Set splitTokName to 0 to never break (disable the feature completely)
V.0.1.2 (9/11/18)
- Initial Release
Known Bugs:
- Custom attributes don't always update on second time opening auto-popout character sheets
- Macrobar 'show/hide' button probably doesn't look good on multi-line macrobars
Token actions are only hidden if "display token name on select" is also enabledMultiline token name draws twice sometimes