Skip to content

Instantly share code, notes, and snippets.

@Bastlifa
Bastlifa / MakeCDTable.js
Created October 30, 2017 20:40
Silly script to make a table for STA in roll20
//Just type !MakeChallengeDiceTable into chat and hit enter. Then go ahead and delete this script.
on("ready", function() {
"use strict";
on("chat:message", function (msg) {
if (msg.type === "api" && msg.content === "!MakeChallengeDiceTable")
{
var CDtable = findObjs({type: 'rollabletable', name: "Challenge-Dice"})[0];
if (!CDtable)
{
@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){
@Bastlifa
Bastlifa / NoWhisper
Created November 4, 2017 21:26
Removes GM Whispers From Characters in Roll20
on("ready", function() {
on("chat:message", function (msg) {
if (msg.type === "api" && msg.content === "!NoWhisper")
{
var characters = findObjs({type: 'character'});
for (var i=0; i<characters.length; i++)
{
if (getAttrByName(characters[i].id, 'wtype'))
{
@Bastlifa
Bastlifa / Rooftops.js
Last active July 26, 2023 14:34
Rooftops Refactored (and laden with commented sections) for roll20
/*
A script to remove and restore rooftops when a player gets within range of the building.
To use this:
1: After first loading, use !RooftopCommands to make the use macros
2: Use the polygon tool to make your dynamic lighting lines on the building.
3: Move the player flag to the page you want to use this on.
4: Use a roof token, best if it's rotation is an integer multiple of 90 degrees (0, 90, 180, 270)
5: Name the roof token "roof", without the quotes.
6: Drag in player tokens. That is, tokens either assigned to players, or representing characters assigned to player
7: Type !RoofReady into chat, or better yet, use it from the macro.
@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 &#63;{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 / 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 / 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 / TemplateGenMacro
Last active September 15, 2020 20:51
Roll20 API Script to create aoe templates at tokens.
&{template:npcaction} {{name=Size and Shape}} {{rname=Shape Maker}} {{description=**Circle Radius**
[5 ft](!TemplateGenerator Circle 5) | [10 ft](!TemplateGenerator Circle 10) | [20 ft](!TemplateGenerator Circle 20) | [30 ft](!TemplateGenerator Circle 30) | [40 ft](!TemplateGenerator Circle 40)
________________________
**Square Side**
[10 ft](!TemplateGenerator Square 10) | [15 ft](!TemplateGenerator Square 15) | [20 ft](!TemplateGenerator Square 20) | [40 ft](!TemplateGenerator Square 40)
________________________
**Cones**
[60](!TemplateGenerator Cone 60 135) -------- [60](!TemplateGenerator Cone 60 90) -------- [60](!TemplateGenerator Cone 60 45)
----[30](!TemplateGenerator Cone 30 135) ---- [30](!TemplateGenerator Cone 30 90) ---- [30](!TemplateGenerator Cone 30 45)----
--------[15](!TemplateGenerator Cone 15 135) [15](!TemplateGenerator Cone 15 90) [15](!TemplateGenerator Cone 15 45)---------
@Bastlifa
Bastlifa / ShapeMakerSFHud
Last active July 26, 2023 14:10
ShapeMaker for Roll20 Starfinder HUD Sheet
//TemplateGenerator
//Fill in the table TemplateShapes that the script makes using the images from the imgur link
//imgur link: https://imgur.com/a/vekJIAg
//Also make a macro called ShapeMaker or something, body should read: !ShapemakerMacro
//Share that macro with all players.
//Warning! This only works on the page that the player tab is on. Make sure to select a token before clicking the shape
on("ready", function() {
@Bastlifa
Bastlifa / DiceSetup.js
Last active April 8, 2021 08:45
Dice Macro Setup for roll20: buttons make for faster rolling.
on("ready", function()
{
on("chat:message", function (msg)
{
if (msg.type === "api" && msg.content === "!DiceMacroSetup")
{
if (playerIsGM(msg.playerid))
{
if (!findObjs({_type: 'macro', _playerid: msg.playerid, name: 'd2'})[0])
{