Skip to content

Instantly share code, notes, and snippets.

View Cazra's full-sized avatar

Ada Lindberg Cazra

View GitHub Profile
var MarchingOrder = (() => {
'use strict';
/**
* A line segment consisting of 2 vec3s defining its endpoints.
* @typedef {vec3[]} Segment
*/
/**
* A wrapper around a follower token. This includes positioning information
/**
* PathMath script
*
* This is a library that provides mathematical operations involving Paths.
* It intended to be used by other scripts and has no stand-alone
* functionality of its own. All the library's operations are exposed by the
* PathMath object created by this script.
*/
var PathMath = (() => {
'use strict';
/**
* A small library for testing collisions between moving tokens in Roll20.
*/
var TokenCollisions = (() => {
'use strict';
/**
* An object encapsulating a collision between two tokens and the point
* of collision.
* @typedef {object} Collision
@Cazra
Cazra / pipbuck.css
Created February 21, 2015 00:14
Roll20 charSheet - Fallout Equestria Pipbuck
.charsheet {
background-image: url("http://i336.photobucket.com/albums/n346/Hymnodi/Useful%20stuff/FALLOUT2.png");
}
.charsheet * {
border-color: #22ff88;
color: #22ff88;
}
.charsheet input, select, textarea {
@Cazra
Cazra / DanceParty.js
Created February 20, 2015 03:08
Roll20 Dance party
on("chat:message", function(msg) {
var cmdName = "!dance";
var msgTxt = msg.content;
// This provides a chat command to heal a character by name.
// Alternatively, you can heal all named tokens using "all" as the target.
if(msg.type == "api" && msgTxt.indexOf(cmdName) !== -1) {
var danceCounter = 0;
var curPageID = findObjs({_type: "campaign"})[0].get("playerpageid");
@Cazra
Cazra / gist:cdc8784a009a26b53dda
Created February 16, 2015 15:44
Roll20 API: MLP:RiM s4 skill roller
/**
* Provides a dice rolling command specialized for MLP: RiM season 4 edition.
* The syntax for the command is
* !r [{Character name}:]{skill name} [+/- Advantages/Drawbacks]
*
* e.g.
* !r Spectrum Square:Energy Weapons +4 -2
*
* The character name and skill name are case-insensitive. You should only
* need to enter the character name if you control more than one character,
@Cazra
Cazra / VectorMath.js
Created January 18, 2015 03:29
A small library of vector math functions used by some of my Roll20 scripts
/** Returns an array representing a 2D vector from pt1 to pt2. */
var vec = function(pt1, pt2) {
return [pt2[0]-pt1[0], pt2[1]-pt1[1]];
}
/** Returns the length of an array representing a vector. */
var vecLength = function(vector) {
var length = 0;
for(var i=0; i < vector.length; i++) {
@Cazra
Cazra / TokenCollisions.js
Last active August 29, 2015 14:13
Roll20 Token Collisions
/**
* A small library for testing collisions between moving tokens in Roll20.
*
* Requires:
* Vector Math https://gist.github.com/Cazra/348653571dffc16e87b9
*/
var TokenCollisions = (function() {
/**
* Returns the first token, from some list of tokens, that a token has
* collided with during its last movement.
@Cazra
Cazra / gist:b9451719989526f5f6df
Last active August 29, 2015 14:05
roll 20 Carry script v2
/**
* A set of chat commands used to set tokens to carry other tokens.
* When a token moves, the any tokens it is carrying move to its new location.
*
* The following commands are available:
* !carry When this command is entered, all selected tokens become
* carried by the bottommost selected token.
* !drop [name of carried token]
* When this command is entered, the selected token drops the
* token with the specified name.
@Cazra
Cazra / gist:2378ab5a8a0ec3c208bf
Last active August 29, 2015 14:05
roll20 follow v2
/**
* A script with a command for specifying tokens to follow other tokens.
* Simply select the tokens in the marching order and enter the "!follow"
* commandwith either a direction for the marching order of the selected tokens
* or the name of a token for the selected tokens to follow behind.
*
* E.G. "!follow west" will make the selected tokens follow each other in order
* from east to west, with the westmost token being the leader and the eastmost
* token being the caboose.
* Alternatively if we want the selected tokens to follow a character named