Skip to content

Instantly share code, notes, and snippets.

View stephenhudson's full-sized avatar

stephenhudson

View GitHub Profile
@stephenhudson
stephenhudson / AOE test
Last active January 1, 2016 08:29
a roll20 script that is supposed to grab targets based on parameters then push the targets to a !attack script
// attacktarget = function() {
on("chat:message", function(msg) {
if(msg.type != 'api' || msg.content.toLowerCase().indexOf('!aoe') != 0) return;
var args1 = msg.content.toLowerCase().split(' ');
args1.shift();
@stephenhudson
stephenhudson / gist:8128074
Created December 25, 2013 23:59
4e Monster Creator api script for roll20 do !monster (level) (type) (name) example !monster 5 controller OrcShaman
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content.toLowerCase().indexOf('!monster') !== -1)
{
var slice = msg.content.split(" ");
var monsterlevel = parseInt(slice[1]);
var monstertype = slice[2];
var monstername = slice[3];
var ac = 14 + monsterlevel;
var will = 12 + monsterlevel;
var reflex = 12 + monsterlevel;
@stephenhudson
stephenhudson / gist:8144136
Last active January 1, 2016 12:19
Roll20 script for handling 4e combat
//attacktarget = function(msg) {
on("chat:message", function(msg) {
if(msg.type == "whisper" && msg.content.toLowerCase().indexOf('!attack') !== -1 || msg.type == "api" && msg.content.toLowerCase().indexOf('!attack') !== -1) {
var slice = msg.content.split(" ");
// slice 1 is target, slice 2 is source, slice 3 is defensetype, slice 4 is damage roll slice 5 is to hit value slice 6 is bonusdamage slice 7 is critdamage slice 8 is extra to hit from the attack(say it comes with +2 attack or something)
// definining the enemy stats based on the first person named after the !attack
var enemytokenid = slice[1];
var playertokenid = slice[2];
var targetdefensename = slice[3];
var rollname = slice[4];
@stephenhudson
stephenhudson / gist:8392771
Created January 13, 2014 00:37
Heal script for roll20 usage !heal @{selected|token_name} secondwind or !heal @{target|token_name} Valiant where Valiant is the name of the healer and does specific heal based on that it is easy enough to mod in whatever.
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content.toLowerCase().indexOf('!heal') !== -1) {
var slice = msg.content.split(" "); //Splits the message input based off spaces. slice[0] is !Attack.
var healtarget = slice[1];
var healsource = slice[2];
var curPageID = findObjs({_type: "campaign"})[0].get("playerpageid");
var toke = findObjs({_type: "character", name: healtarget})[0];
var token = findObjs({_type: "graphic", _subtype: "token", _pageid: curPageID, name: healtarget}, {caseInsensitive: true})[0];
var surgevalue = findObjs({ _type: 'attribute', name: 'surgevalue', _characterid: toke.id })[0];
var currenthpvalue = findObjs({ _type: 'attribute', name: 'HP', _characterid: toke.id })[0];
@stephenhudson
stephenhudson / gist:8392816
Created January 13, 2014 00:42
Direct Damage ​!damage @{target|token_id} 0 1d8 ​0 is just static damage, 1d8 is a dice you can set the dice to 0d0 if you don't want to roll anything and just want to do like say 4 damage.
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content.toLowerCase().indexOf('!damage') !== -1) {
var slice = msg.content.split(" "); //Splits the message input based off spaces. slice[0] is !Attack.
var rollname = slice[3];
var rollmsg = "/roll " + rollname;
sendChat("playername", rollmsg, function(ops) {
var damageresult = JSON.parse(ops[0].content)
var enemyid = slice[1];
var damage = slice[2];
@stephenhudson
stephenhudson / gist:8498305
Created January 18, 2014 23:38
Modification of Aaron's turn reminder script, will put in chat when a persons turn starts and remind people of whatever status effects they have.
on ("change:campaign:turnorder", function(obj) {
var c=Campaign()
var turn_order = JSON.parse(c.get('turnorder'));
var current = {}
current.turn=turn_order[0]
current.token = getObj( "graphic", current.turn.id);
current.character = getObj('character', current.token.get("_represents"));
current.markers = {
marked : current.token.get("status_yellow"),