Difference between revisions of "Mod:Script Index"
From Roll20 Wiki
m |
m |
||
Line 1: | Line 1: | ||
+ | {{supporters only}} | ||
{{Tocright}} | {{Tocright}} | ||
Revision as of 23:50, 17 December 2014
Contents |
This page is a Work in Progress |
See the Talk page for how you can help!
Scripts By Category
General Purpose Scripts
Combat Scripts
- Auto Initiative -- Adds the players to the initiative tracker, rolls randomly for them and adds relevant modifiers.
- Initiative Highlighter -- Highlights a token whose turn it is with a flashing aura.
- Roll comparisons -- Comparing roll results.
- Random Turn Order -- Randomly assigns a turn to selected tokens.
- Round Tracker -- Adds a marker in the initiative which increments automatically.
- Highlight Token at Top of Initiative -- Highlights the token at the top of initiative.
- Range Finder -- Determines the distance between two named tokens
- Automatic Initiative Roller and Round Counter --
- Cone and Circle Templates --
Tokens - Conditions / Status / Health
- Conditions and Status Tracker -- Tracks the status of tokens and announces them as the duration passes.
- Automatic Status Markers -- Automatically adjust status markers on tokens
- HP Change Announcement -- Announces when tokens’ hit points changes.
- Heal Chat Command -- Use commands to heal characters
- Updated Heal Chat Command --
- Automatic Temp HP Management -- Uses temporary hit points and sets it to automatically remove them first.
- Target Marking -- System for marking tokens with status markerAuto create a token
Tokens - Movement
- Auto Teleporting and Chat Based Teleporting -- Teleporting based on text commands or token locations.
- Marching Order -- Tracking marching order of characters
- Carrying Tokens -- Tokens carrying other tokens such as torches.
- Movement Tracker and Aura Highlighter -- Uses auras to track character movement based on speeds.
- Character Token Locator -- Creates an aura and shrinks it slowly to help you find your token.
- Time/Torch Tracker -- Shrinking light auras of torches.
- Units Moved -- Tracks units moved.
- Disable Rotation via Chat Window Command -- Disable the rotation of tokens in the chat window.
- Hourglass, Stopwatch, etc. -- Visual UI interface. Uses for asking players to wait.
- Patrolling Tokens -- Script for patrolling tokens.
- Trap script (like in vid) -- Script for using traps.
- Interpolated trap detection --
Lighting and Revealing
- Light Switch -- Script for turning on and off lights with chat commands.
- !reveal command -- Automatically moves tokens from the GM layer to objects layer, making them reveal to players.
- Light is Closing In... -- A light reduction script for token movement.
Characters - Equipment
- Set Weapon Values Using the API -- Tracks weapons equipped by characters.
- Trader Joes -- Inventory Management
Generators
- It's the Monster Mash! -- It's the Monster Mash! An adventure in Encounters!
- Weather Generator Script --
System
- Graphic/Token snapshot saving/loading for building your own macros -- System for tracking a loading token set ups
- String Formatter -- Formats a string for printing.
- Detecting Nearest Token -- Script for detecting the nearest token after one is moved.
- Chat Command Script -- Script for standardizing and preventing duplication of chat commands.
- Scrolling Macro Bar --
- IsGM Auth Module -- Provides a function isGM() for determining if a player id refers to a gm. Intended for use alongside other scripts.
Roleplay
- Language Script -- A script for auto converting text to elven or dwarven.
- What Did He Say? -- Language based scripting
Misc
- API command process, standard model -- API command process, standard model.
Game Specific Scripts
Edge of the Empire
DnD 4th Edition
- Combat -- temporary hit points. Also prevents over healing.
- Tools -- 4th edition. Adds marking to the Combat script.
- 4e Helper -- 4th edition collection of scripts.
- 4e combat engine --
- 4e Monster generator based on MM3 math --
Zombie Dice
- Zombie Dice -- A Script for playing zombie dice
Basic Fantasy Role Playing Game
HERO System
AD&D (Dungeons and Dragons 2e)
Pathfinder
- All In One --
- Pathfinder Character Sheet Generator v3 --
- Character Sheet Generator --
- Inspired Collection --
Star Wars Saga
Fantasy Craft 2nd Printing
- Fantasy Craft (2nd printing) - Standard character token management --
- Fantasy Craft - Standard character damage save --
API Docs
API Cookbook
API Best Practices
Main Page: API:Best Practices
Include namespaces for your functions and variables, to avoid potential name collisions with other authors.
var myNamespace = myNamespace || {}; myNamesapce.MY_CONSTANT = 5; myNamespace.myFunction = function() { /* ... */ }
Use easy, short, readable function and variable names. Names like x1
, fe2
, and xbqne
are practically meaningless. Names like incrementorForMainLoopWhichSpansFromTenToTwenty
are overly verbose, and the highly descriptive name may end up wrong as you change your code over time.
Keep your code legible, especially if you need to ask for help on the forums. Indent code blocks as appropriate, include spaces, etc. Compare the following:
do if(node.name.toLowerCase()==='foo')break;while(parent=node.parent);
do { if (node.name.toLowerCase() === 'foo') { break; } } while (parent = node.parent);
Comments! Commenting can be something of a holy war among programmers. Some say you need more, some say your code should be enough, and so on. However, understand that for a Roll20 API script, the person reading your code may not be a programmer at all, and is completely bewildered by your black magic... but they still need to make modifications in order to suit their game. At the very least, comments describing your configuration variables are helpful to everyone who installs your script, and comments describing generally what's going on in each section of code can help the layperson trying to struggle his or her way through making the tabletop experience better.
Please write your code in English. JavaScript keywords are all in English. The majority of JavaScript tutorials on the web are written in English. The majority of threads in the Roll20 forums are in English, and many of the users contributing to those threads may have a tenuous grasp of one other language at best. If you name your variables and functions with another language, you may find it difficult to get assistance debugging your code.
Learn to love _. You have access to Underscore.js, a library with many useful utility functions. While you can certainly accomplish anything in Underscore yourself, you may find that Underscore can drasticaly reduce the size of your code. Compare:
for (var i = 0; i < jossWhedon.shows.length; i++) { if (jossWhedon.shows[i].title === 'Firefly') { var show = jossWhedon.shows[i]; } } // show = {title: "Firefly", characters: Array[2]} var characterDistribution = jossWhedon.shows.reduce(function(memo, show) { show.characters.forEach(function(character) { (!memo[character.role]) ? memo[character.role] = 1 : memo[character.role]++; }); return memo; }, {}); // characterDistribution = {doll: 1, mad scientist: 2, love interest: 2, slayer: 1, captain: 1, mechanic: 1}
var show = _.findWhere(jossWhedon.shows, {title: 'Firefly'}); // show = {title: "Firefly", characters: Array[2]} var characterDistribution = _.countBy(_.flatten(_.pluck(jossWhedon.shows, 'characters')), 'role'); // characterDistribution = {doll: 1, mad scientist: 2, love interest: 2, slayer: 1, captain: 1, mechanic: 1}
Underscore examples courtesy of Singlebrook.com