Skip to content

Instantly share code, notes, and snippets.

View shdwjk's full-sized avatar
🐉
Coding, coding, coding...

Aaron C. Meadows shdwjk

🐉
Coding, coding, coding...
  • Springfield, MO
View GitHub Profile
@shdwjk
shdwjk / Escalation.js
Last active August 29, 2015 14:08
Roll20API: Escalation -- Simple Escalation Die handling script, using the new custom entries with formulae.
// GIST: https://gist.github.com/shdwjk/a48ae61e6b338c906900
var Escalation = Escalation || (function() {
'use strict';
var version = 0.2,
dieName = 'Escalation Die',
dieMax = 6,
handleEscalationDieReset = function(obj, prev) {
@shdwjk
shdwjk / MonsterHitDice5e
Last active August 29, 2015 14:08
Roll20API: MonsterHitDice5e -- Monster Hit Dice script setup to work with Actoba's 5th Edition character sheet for NPCs
// GIST: https://gist.github.com/shdwjk/941cee5942ac4275d9ea
on('ready', function() {
on('add:graphic',function(obj) {
if(
'graphic' === obj.get('type')
&& 'token' === obj.get('subtype')
) {
setTimeout(_.bind(function(id){
var obj=getObj('graphic',id)
@shdwjk
shdwjk / TokenNameNumber.js
Last active October 17, 2015 14:30
Roll20 API: TokenNameNumber - Automatic Numbering of select tokens
// GIST: https://gist.github.com/shdwjk/6968e757c2bf9a7371fb
var TokenNameNumber = TokenNameNumber || (function() {
'use strict';
var version = 0.21,
schemaVersion = 0.1,
escapeRegExp = function(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
@shdwjk
shdwjk / TokenMod.js
Last active October 17, 2015 14:30
Roll20 API: TokenMod -- An interface to adjusting properties of a token from a macro or the chat area.
// GIST: https://gist.github.com/shdwjk/357e0632a1096375de58
var TokenMod = TokenMod || (function() {
'use strict';
var version = 0.53,
schemaVersion = 0.1,
fields = {
// booleans
@shdwjk
shdwjk / TableTokenSizer.js
Last active October 17, 2015 14:31
Roll20 API: Table Token Sizer -- Simple script to scale rollable tokens added to the tabletop to a given size (defaults to 3x3) an set them as not drawings.
GIST: https://gist.github.com/shdwjk/075beec63a1e0ff085c7
var TableTokenSizer = TableTokenSizer || (function() {
'use strict';
var version = 0.15,
gridSize = 70,
scaleSize = 3,
sizeTableToken = function(obj, prev) {
@shdwjk
shdwjk / emas.js
Last active August 29, 2015 14:06
Roll20 API: Emas -- It's just /emas, but useable by everyone as !emas
// GIST: https://gist.github.com/shdwjk/42f34ecfd167ec56c9f7
var Emas = Emas || (function() {
'use strict';
var version = 0.31,
ch = function (c) {
var entities = {
'<' : 'lt',
@shdwjk
shdwjk / Base64.js
Last active August 29, 2015 14:06
Roll20 API: Base64 - Base 64 encoding for Roll20 Scripts. (Adapted from http://www.webtoolkit.info/ )
// GIST:
// modified from: http://www.webtoolkit.info/
var Base64 = Base64 || (function () {
'use strict';
var version = 0.2,
keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// private method for UTF-8 encoding
@shdwjk
shdwjk / IsGreater.js
Last active August 29, 2015 14:06
Roll20 API: IsGreater - trivial little script to check if the first value is greater than the second and report it to chat.
// GIST: https://gist.github.com/shdwjk/a7968b474c7fa56a89f5
var IsGreater = IsGreater || (function() {
'use strict';
var version = 0.2,
HandleInput = function(msg_orig) {
var args,msg=_.clone(msg_orig);
@shdwjk
shdwjk / Measure.js
Created September 9, 2014 00:52
Roll20 API: Measure - Measure distances between multiple tokens, both from the corners and the center.
// GIST: https://gist.github.com/shdwjk/aa0bd12b6829fe8a657e
on('ready',function(){
'use strict';
log('measure: ready');
on('chat:message',function(msg){
var args;
if (msg.type !== "api") {
@shdwjk
shdwjk / LokiTrapMan.js
Created September 5, 2014 14:49
Roll20 API: LokiTrapMan -- reoganization of Loki's trap script.
// GIST: https://gist.github.com/shdwjk/054574d39c166d50865c
var LokiTrapMan = LokiTrapMan || ( function() {
'use strict';
// Here is the bulk of where you define a trap and cusomize the events. This is an array of all traps on your campaign (I only have 1 defined).
// Trap coordinates are defined in squares, not pixals. A trap location is defined as a rectange having two points (x1,y1 to x2,y2)
// Set the pageID and region of the trap and when a token enters this area the defined callback in the array will be triggered.
var traps = [
// In this example when a charater lands next to (or on) a placed npc he (and his campfire) disappears in a firey explosion.