Skip to content

Instantly share code, notes, and snippets.

on('chat:message', function(msg) {
//state.inventoryOfItems = undefined;
//state.inventoryOfItems = [];
if(msg.type !== "api"){return};
roll20API.contentPlayerid = getObj("player", msg.playerid);
roll20API.contentUserid = roll20API.contentPlayerid.get("d20userid");
if(allowedUser.indexOf(roll20API.contentUserid) == -1){return};
roll20API.contentGiven = msg.content.toLowerCase();
roll20API.contentGivenProper = msg.content;
if(roll20API.contentGiven.indexOf(' ') == -1){
@BaldarSilveraxe
BaldarSilveraxe / processMessageSwitch
Created December 11, 2013 01:11
Roll20 API AD&D 2E (DRAFT)
//API:Events:processMessage
processMessage = function(msg) {
if(msg.type !== "api"){return};
roll20API.contentPlayer = getObj("player", msg.playerid);
roll20API.contentUserid = roll20API.contentPlayer.get("d20userid");
roll20API.contentPlayerid = roll20API.contentPlayer.get("_id");
//Remove or move
if(roll20API.allowedUser.indexOf(roll20API.contentUserid) == -1){return};
@BaldarSilveraxe
BaldarSilveraxe / cssForRecordSheet
Last active December 31, 2015 03:29
Roll20API cssForRecordSheet
cssForRecordSheet = function(sheetId) {
for (var index in roll20API.currentAttribs) {
var key = roll20API.currentAttribs[index].name
var cur = roll20API.currentAttribs[index].cur
var max = roll20API.currentAttribs[index].max
var id = roll20API.currentAttribs[index].id
switch(key){
case "Player_Name": var Player_Name = cur; break;
@BaldarSilveraxe
BaldarSilveraxe / Geomorphic
Last active August 29, 2015 13:55
Roll20 API
//Standard API command detection...
on("ready", function() {
on("chat:message", function(msg) {
if(msg.type == "api"){processMessage(msg)};
});
});
//Your command processes prefrence
processMessage = function(msg) {
if(msg.type !== "api"){return};
@BaldarSilveraxe
BaldarSilveraxe / Geomorph
Last active August 29, 2015 13:56
Roll20 API Random Dungeon Generator with Dynamic Lighting
var mapName = "GeomorphicMap";
var geomorphicMapId;
var geomorphicMapWidth;
var geomorphicMapHeight;
var geomorphicTilesArray = new Array();
var mapTilesArray = [];
var isError = false;
var errorType = "None.";
var sideString = "";
var tilePicked = "Empty";
@BaldarSilveraxe
BaldarSilveraxe / gist:9056392
Last active August 29, 2015 13:56
Roll20 API Random Dungeon Generator with Dynamic Lighting
var mapName = "GeomorphicMap";
var geomorphicMapId;
var geomorphicMapWidth;
var geomorphicMapHeight;
var geomorphicTilesArray = new Array();
var mapTilesArray = [];
var isError = false;
var errorType = "None.";
var sideString = "";
var tilePicked = "Empty";
@BaldarSilveraxe
BaldarSilveraxe / Geomorph
Created February 17, 2014 21:25
ROLL20 Random Dungeon Generator with Dynamic Lighting (Big thanks to Alex L.)
/* -------------------
Big thanks to Alex L.
https://app.roll20.net/users/71687/alex-l
------------------- */
var mapName = "GeomorphicMap";
var geomorphicMapId;
var geomorphicMapWidth;
var geomorphicMapHeight;
@BaldarSilveraxe
BaldarSilveraxe / Geomorphic
Last active November 6, 2019 18:19
Roll 20 API Random Dungeon Generator with Dynamic Lighting
var mapName = "GeomorphicMap";
var lineColor = "#00ff00";
var lineSize = 5;
var geomorphicMapId;
var geomorphicMapWidth;
var geomorphicMapHeight;
var geomorphicTilesArray = new Array();
var mapTilesArray = [];
var isError = false;
var errorType = "None.";
@BaldarSilveraxe
BaldarSilveraxe / Faking
Created February 22, 2014 16:52
Faking
on("chat:message", function(msg) {
// This assumes that you type something like "!fudge 20:+3:7"
// which would pretend that a d20 rolled a 7 for a total of 10.
if(msg.type == "api" && msg.content.indexOf("!fudge ") !== -1) {
var parts = msg.content.replace("!fudge ", "").split(":");
var faces = parts[0];
var modifier = parts[1];
var value = parts[2];
var total = eval(value + modifier);
var color="black"
{
Call:"shillelagh",
Name:"Shillelagh",
Class:"Druid",
SubClass:"",
Ritual:"N",
Concentration:"N",
Level:"0",
School:"Transmutation",
Component:"V,S,M",