Skip to content

Instantly share code, notes, and snippets.

@sturtus
sturtus / setAttribute
Last active June 4, 2023 16:38
Roll20 API script to change an attribute's value to the defined string.
function getAttributeObjects(characterObj,attributeArray) {
// can pass array of attribute strings or a single attribute string along with an associated character
// returns those attributes as an object array or returns false if they do not exist on the passed character.
// get the passed attribute name array from the character object and test if they are defined
if (characterObj != undefined ) {
var attributeObjArray = new Array();
if (!(attributeArray instanceof Array)) {
@sturtus
sturtus / gist:8352577
Last active September 14, 2018 08:38
Roll20 Library
/*
This is my collection of useful functions to use in other commands/functions. I will keep this top post updated with the list of included functions as I add more.
Library includes:
- removePlus. Takes string or array of strings and returns the integer after the symbol "+". Useful for getting an integer from a string that represents a bonus like +2. Will also convert any numbers in the string/array of strings to integers.
- getAttributeObjects: takes a character object and an array of attribute names, checks the names against the character for existing attributes, error checks them for empty values or existence at all, and returns an array of the attributes' objects.
- getCharacterObj: takes a graphic, attribute, ability, or character object and returns the associated character object.
@sturtus
sturtus / gist:8353030
Last active January 2, 2016 19:49
Cleric spell script for Dungeon Crawl Classics in Roll20.
/*
Cleric spell script for Dungeon Crawl Classics in Roll20. Calculates the target for the spell check, checks for disapproval, and increments the disapproval attribute by 1 if failure. If disapproval happens, it rolls the disapproval.
Requires my Roll20 Library script. https://gist.github.com/sturtus/8352577
To use, the character must have the attributes defined in the config portion of the script.
- ActionDie: the die to roll for the spell check, as a d20 or d16 or whatever.
- Disapproval: the attribute that tracks the cleric's current disapproval, starts at 1.
- List of attributes to possibly affect the roll, expressed as bonuses such as +1 or -1 or 0. In my campaign we use 3 letter abbreviations for these like STR, AGI, PER, LCK, and INT. Change the array to match your campaign.
@sturtus
sturtus / gist:8353433
Last active January 2, 2016 19:58
Deed script for Dungeon Crawl Classics
/*
Deed script for Dungeon Crawl Classics in Roll20. Calculates a Mighty Deed or Deed die style attack by rolling the deed die and adding to both attack and damage. Optionally does Smite for the Crawl! magazine paladin and a deed attack for the ranger or other custom class that uses a deed die without a Mighty Deed of Arms.
Requires my Roll20 Library script. https://gist.github.com/sturtus/8352577
To use, the character must have the attributes defined in the config portion of the script.
- ActionDie: the die to roll for the spell check, as a d20 or d16 or whatever.
- DeedDie: the die to roll for the deed, as a d4, d7 or whatever.
- List of attributes to possibly affect the roll, expressed as bonuses such as +1 or -1 or 0. In my campaign we use 3 letter abbreviations for these like STR, AGI, PER, LCK, and INT. Change the array to match your campaign.
- Threat: Expressed as the lowest number necessary to crit for the character. If a warrior crits on 18-20, this attribute should be 18. Defaults to 20 if it is
@sturtus
sturtus / gist:8355602
Last active January 2, 2016 20:18
Roll20 DCC Dice chain script
/*
function to change an attribute with a d20 value and move it up or down the
DCC dice chain by x number of dice.
REQUIRES MY PERSONAL ROLL20 LIBRARY SCRIPT TO BE IN ROLL20 CAMPAIGN
https://gist.github.com/sturtus/8352577
!diceChain attributeName|newValue
!diceChain ActionDie|+1
@sturtus
sturtus / gist:8363191
Last active January 2, 2016 21:28
Roll20 DCC Wizard Spell script
/*
Wizard spell script for Dungeon Crawl Classics in Roll20. Calculates the target for the spell check, checks for spell loss.
Requires my Roll20 Library script. https://gist.github.com/sturtus/8352577
To use, the character must have the attributes defined in the config portion of the script.
- ActionDie: the die to roll for the spell check, as a d20 or d16 or whatever.
- CasterLevel: level of the spellcaster
- List of attributes to possibly affect the roll, expressed as bonuses such as +1 or -1 or 0. In my campaign we use 3 letter abbreviations for these like STR, AGI, PER, LCK, and INT. Change the array to match your campaign.
@sturtus
sturtus / DCC Helper
Last active October 7, 2021 02:18
DCC Helper for Roll20.net
/*
==========================================
Roll20 Character Sheet Attribute Utilities
==========================================
!stats
!stats Atribute1, Attribute2, ...
!attrib attribute|newValue
!attrib
~~~~~~~
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"version="2.0"xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>ADAM'S AWESOME PODCAST</title>
<link>http://www.ADAMSAWESOMEWEBSITE.com</link>
<description>This is a breif description of our podcast</description>
<language>en-us</language>
<copyright>ADAM'S AWESOME copyright 2014</copyright>
<atom:linkhref="http://fullurltothisfile.googledive.yaddayadda.com/podcast.rss"rel="self"type="application/rss+xml" />
<lastBuildDate>Wed, 13 Aug 2014 15:47:00 GMT</lastBuildDate>