Sheet Workers – Automating The Sheet

This is a guide to reading, using, and creating Sheet Workers on Roll20. If you don’t know, sheet workers are the method you use to build complex automation in a sheet (calculate stat modifiers when stat changes, and so on).

Sheet workers are written in JavaScript. There are plenty of guides for JS on the web, but this guide is focused on the specific needs and gotchas related to Roll20 character sheets.

I haven’t been able to do much work on the guide the last couple of months, but I’ll try to keep up at least one post a week on Thursdays till this series is finished (with an additional post on Mondays when I can). Here’s a list of articles in the series. The series is still being written, so this list may be refined a bit.

  1. Using Sheet Workers instead of AutoCalcs: A quick introduction to the various parts of a sheet worker, and how to use sheet workers without knowing what you are doing. Every post after this is either an expansion of concepts introduced here, or deep dive into JavaScript.
  2. Variables in JavaScript and Grabbing Attributes: What is a string, an int, and a float? Why do you need to coerce variables into numbers? How do you get attributes from a character sheet?
  3. Back To School – Arithmetic in Sheet Workers: This post covers doing arithmetic, the math object, and calculating final values.
  4. How to Use If in Sheet Workers: After performing arithmetic, the next most important thing to understand is how to figure out values under special conditions.
  5. Finding Errors in Sheet Workers and Fixing Them: Errors are a fact of life with sheet workers and knowing how to log values and fix errors is an essential skill.
  6. Getting Loopy With JavaScript: How to go round and round in circles. Different ways to loop code and ways to exploit that – like building one sheet worker that does the work of a bunch of others. Understanding how to use arrays.
  7. Collecting Attributes: More on how to grab attributes, understanding the object variable and nifty things you can do with it.
  8. Events and Strings: How to monitor a sheet for changes, what you can do with strings of words and letters and things you need to be aware of.
  9. Saving Attributes: Understanding the setAttrs function, and things you should be wary of. What does it mean when a function is asynchronous?
  10. On Sheet-opened: How to use sheet:opened, and when you shouldn’t use it. This will also cover single-use changes like version updates.
  11. Function Library: Over these articles, a bunch of reusable functions have been created. They are collected and explained here, with guidance on building your own.
  12. Castle Falkenstein – Sheet Workers: the sheet being developed over this series is now updated to use sheet workers.

There are often different ways to do the same thing in JavaScript – this series will focus on one approach for simplicity and ease of teaching. The Function Library post will describe more general approaches (or maybe there’ll be a separate post added to illustrate the possible variety here).

Other Sheet Worker Posts

In time, I’ll add more sheet worker posts that aren’t part of the series. They’ll be indexed here.

    Series Navigation<< Guide to CSS – Styling a Character Sheet

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.