Skip to content

Instantly share code, notes, and snippets.

@Bastlifa
Bastlifa / witcherLifeEvent.js
Created May 15, 2020 01:56
Witcher TTRPG Life Events Script for Roll20
on("ready", function()
{
on("chat:message", function (msg)
{
if (msg.type === "api" && msg.content === "!allyEnemy")
{
allyEnemy()
}
if (msg.type === "api" && msg.content === "!fortuneMisfortune")
{
@Bastlifa
Bastlifa / ScreenShaker.js
Last active May 13, 2020 00:08
Roll20 API script to shake the screen, maybe for earthquake
/* Screen Shake (really just maps, tokens, and paths)
make a macro with the folloing body
/w gm &{template:default} {{name=Screen Shaker}} {{[Start](!ScreenShake)}} {{[Shake With Time](!ScreenShake ?{time})}} {{[Stop](!ScreenShakeStop)}}
*/
on("ready", function() {
var ScreenShakeEnabled = true;
on("chat:message", function (msg) {
if (msg.type === "api" && msg.content.split(' ')[0] === "!ScreenShake" && playerIsGM(msg.playerid))
{
var shakeTime = 0;
@Bastlifa
Bastlifa / CombatManeuverBatch
Created September 4, 2019 01:48
Combat Maneuver Batch Adder for Roll20 PF1
// Add other maneuvers as desired.
// Select PC tokens tokens, hit !CombatManeuverBatch
var generateUUID = (function() {
"use strict";
var a = 0, b = [];
return function() {
var c = (new Date()).getTime() + 0, d = c === a;
a = c;
@Bastlifa
Bastlifa / TableMaker.js
Created December 17, 2018 03:00
Roll20 Table Maker via Blank Character Sheet
//TableMaker
//Make a character with no sheet.
//All attributes are table entries, all current values are weights.
//Drag token (can be default) to canvas. Select it. Type !TableMaker <table name> into chat and hit enter
//Table name must use dashes for spaces (probably)
//Transmog your table over to whatever game you need it for.
//This probably sucks, don't use it.
on("ready", function() {
@Bastlifa
Bastlifa / AddWep.js
Last active November 21, 2018 06:38
Add Weapon to FFG SW Sheets on Roll20
on("ready", function() {
on('chat:message', function(msg) {
if (msg.type === "api" && msg.content.split(' ')[0] === "!AddWep")
{
// strips the first bit off of the api command
let weaponName = msg.content.replace("!AddWep ", "");
AddWep(msg, weaponName);
}
});
});
@Bastlifa
Bastlifa / FamiliarSightSwap.js
Created September 28, 2018 23:17
Familiar Sight Swap for Roll20 D&D 5E
//Familiar Sight Swap
// make a macro with body:
// !SwapSight PlayerTokenName FamiliarTokenName
on("ready", function() {
on("chat:message", function (msg) {
if (msg.type === "api" && msg.content.split(' ')[0] === "!SwapSight") {
SwapSight(msg);
@Bastlifa
Bastlifa / Faces.js
Created November 24, 2017 23:31
Face Changing API Script for Roll20
/*
* A Simple face changing script.
* Make a rollable table with the character name (one word characer name) plus -Faces
* Example, character named John Smith
* Table name is John-Faces
* Fill table with face names, and pictures which you have uploaded. Can't be from purchase or search
* Must be uploaded to your library.
* Make macro with this body, as token action macro:
* !FaceChange John-?{Face|Normal|Soldier|Popper|Pirate|Noble|Elder|Cleric}
* Where those options (other than the title "Face") are the names of the items in your rollable table.
@Bastlifa
Bastlifa / ShowHealth.js
Created November 24, 2017 23:23
Roll20 API script to show the health of any tokens on the object layer on the current map the GM is looking at.
on("ready", function() {
on("chat:message", function (msg) {
if (msg.type === "api" && msg.content === "!ShowHealth")
{
var page = getObj('page', getObj('player',msg.playerid).get('lastpage')).id;
var tokens = findObjs({type: 'graphic', _pageid: page});
for (var i=0; i<tokens.length; i++)
{
if (tokens[i].get("bar1_value"))
@Bastlifa
Bastlifa / FireTrapScript
Last active November 7, 2017 01:43
Fire Trap Script for Roll20. Time update help from Aaron
//A little trap
on("ready", function() {
"use strict";
var i = 0;
const millisecondsPerSecond = 1000; // handy conversion
let timeForFullSpin = 15 * millisecondsPerSecond; // rotate fully in 15 seconds
@Bastlifa
Bastlifa / 10To5.js
Created November 4, 2017 13:45
Change ten foot squares maps in roll20 to 5 foot squares maps (path functions provided by Aaron)
on("ready", function() {
var graphics;
var paths;
const scalePathString = function(pathstring,scale){
return JSON.stringify(_.map(JSON.parse(pathstring),(n)=> _.map(n,(i)=> _.isNumber(i) ? scale*i : i )));
};
const simpleObject = function(o){