Skip to content

Instantly share code, notes, and snippets.

@BaldarSilveraxe
BaldarSilveraxe / Process_Critical
Created November 27, 2013 10:48
Roll20 API code for critical hits and misses. Creates two handouts for the GM and updates them when called.
//API:Events:ChatMessage:processAPIswitch:common:critical**********************************************
roll20API.processAPIcritical = function() {
var MeleeArmed = new Array();
MeleeArmed[0] = {Code: "FGM", Text: "Lost Footing"};
MeleeArmed[1] = {Code: "DPM", Text: "Drop Weapon"};
MeleeArmed[2] = {Code: "SIM", Text: "Self Injury"};
MeleeArmed[3] = {Code: "EGA", Text: "Entangle With Foe"};
MeleeArmed[4] = {Code: "TWM", Text: "Twist Muscle"};
MeleeArmed[5] = {Code: "SDM", Text: "Scenery Disadvantage"};
MeleeArmed[6] = {Code: "WMM", Text: "Wardrobe Malfunction"};
@BaldarSilveraxe
BaldarSilveraxe / Critical_Fumble_Tables
Created November 27, 2013 10:57
Roll20 API fumble and crit tables
//FumbleTables
roll20API.processAPI_FGM = function() {
var fumble = new Array();
fumble[0] = "Fumbler’s movements put them off balance. They take a -1 penalty to \
their armor class for the next round.";
fumble[1] = "Fumbler’s movements put them severely off balance. They lose Dexterity \
and Shield bonuses to AC for the next round. If losing these bonuses does not \
reduce the fumbler’s AC by -2 (or more), then they still must take a -2 penalty.";
fumble[2] = "Fumbler trips, and falls prone. They lose Dexterity and Shield bonuses \
to AC for the current round and the next round. If losing these bonuses does not \
var roll20API = roll20API || {};
//NOTES:
//
//***Display Names***
//Display Names should be one word, nospaces or special characters and distinct.
//
//***roll20API.Owner = "135636"***
//Campaign Owner. You can find your own personal user id by visiting the wiki and clicking on your name in the
//left-hand sidebar. On your wiki page you will see "Home » User:#" below your name on your userpage, where #
//is your user id.
@BaldarSilveraxe
BaldarSilveraxe / Chronos_Tables
Last active December 30, 2015 05:09
Roll20 Calendar and weather script tables...
//Chronos Record Sheet Attributes Array
roll20API.attribs = [];
roll20API.attribs["Year"] = {name: "Year", current: "00000", max: null};
roll20API.attribs["Month"] = {name: "Month", current: "08", max: null};
roll20API.attribs["Day"] = {name: "Day", current: "01", max: null};
roll20API.attribs["Hour"] = {name: "Hour", current: "00", max: null};
roll20API.attribs["Minute"] = {name: "Minute", current: "00", max: null};
roll20API.attribs["Region"] = {name: "Region", current: "Temperate", max: null};
roll20API.attribs["Terrain"] = {name: "Terrain", current: "Forest", max: null};
roll20API.attribs["Temp High"] = {name: "TempHigh", current: "+085", max: null};
@BaldarSilveraxe
BaldarSilveraxe / Process_Chronos_Main
Last active December 30, 2015 05:09
Roll20 Calendar and weather scpits
//API:Events:ChatMessage:processAPIswitch:Chronos:add**********************************************
roll20API.processAPIaddChronos = function() {
//Add Chronos sheet if needed
if(findObjs({ _type: "character", name: "GM_Chronos" }).length == 0){
createObj("character", {
name: "GM_Chronos",
bio: "Text Here"
});
GM_ChronosObject = findObjs({ _type: "character", name: "GM_Chronos" })
@BaldarSilveraxe
BaldarSilveraxe / Chonos_calculations
Last active December 30, 2015 05:09
Roll 20 Calendar and Weather
//API:Events:ChatMessage:processAPIswitch:Chronos:minutes**********************************************
roll20API.processAPIminuteChronos = function() {
var addNumMins = parseInt(roll20API.valueGiven) + roll20API.currentMinute;
if(isNaN(addNumMins)){var addNumMins = 0};
roll20API.tempCarryHours = Math.floor(addNumMins/60);
var tempCurrentMinutes = Math.round(((addNumMins/60) % 1) * 60);
var newCurrentMinutes = tempCurrentMinutes.toString();
if(newCurrentMinutes.length == 1){newCurrentMinutes = "0" + newCurrentMinutes};
findObjs({ _type: "attribute", name: "Minute", _characterid: GM_Chronosid})[0].set({current: newCurrentMinutes});
};
@BaldarSilveraxe
BaldarSilveraxe / Process_Report
Created December 4, 2013 20:40
Roll20 Calendar and weather report
//API:Events:ChatMessage:processAPIswitch:Chronos:report**********************************************
roll20API.processAPIreportChronos = function() {
//Check for GM_Chronos report
var GM_Chronoslength = findObjs({ _type: "handout", name: "GM_Chronos_Report" }).length
var GM_ChronosExist = false;
if(GM_Chronoslength !== 0){
GM_ChronosExist = true;
}else{
GM_ChronosExist = false;
};
@BaldarSilveraxe
BaldarSilveraxe / Joe Y Round Tracker
Last active December 30, 2015 10:09
Roll20API Joe Y Round Tracker
//Roll20 UserIDs that can use this command (replace "999999" another player allowed and as more as needed.)
var allowedUser = ["999999","999999"];
var GM_CombatMarkerDefaultTokenExist = false;
//dice used for combat
var rollValue = 10;
on('chat:message', function(msg) {
//Return if its not an API command
if(msg.type !== "api"){return};
@BaldarSilveraxe
BaldarSilveraxe / Trader Joe
Last active December 30, 2015 16:18
Roll20 API
on('chat:message', function(msg) {
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();
if(roll20API.contentGiven.indexOf(' ') == -1){
roll20API.contentMessage = null;
roll20API.contentCommand = roll20API.contentGiven.substr(1, roll20API.contentGiven.length);
}else{
@BaldarSilveraxe
BaldarSilveraxe / Trader Joe Hand Out
Created December 9, 2013 14:15
Roll20 Trader Joe Hand Out interface
on('chat:message', function(msg) {
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();
if(roll20API.contentGiven.indexOf(' ') == -1){
roll20API.contentMessage = null;
roll20API.contentCommand = roll20API.contentGiven.substr(1, roll20API.contentGiven.length);
}else{