The ESSENTIAL Sheet Worker RULE

This is not a guideline. It is not a suggestion. It is a rule that you must ALWAYS carry out.

This is one piece of advice I have given that a surprising number of people are ignorant about, and that I sometimes get pushback on because of the way roll20 works. But it’s not a frivolous suggestion, it’s a requirement. If you don’t do this, you will regret it. Maybe not immediately, and that’s the worst part.

Attributes on the Event Line MUST be in Lower-case

Let’s say you create an attribute called StReNgTh. In HTML that might look like:

<input type="number" name="attr_StReNgTh" value="10">Code language: HTML, XML (xml)

When you watch that attribute for changes, always, always start the sheet worker like this:

on('change:strength',Code language: JavaScript (javascript)

Notice the attribute name in the HTML has upper case letters, but in the sheet worker it does not.

Roll20 has a funny relationship with attribute case, which could be discussed in another post, but for this post this is something you must do, always.

What Happens If You Ignore This RULE?

Roll20 has a weird glitch. Sometimes sheet workers will work if you use upper case letters. It’s true a lot of the time. But it is not reliable. One day, the sheet worker just stops recognising upper case letters.

So you might have this and everything seems to be working fine:

on('change:StReNgTh',Code language: JavaScript (javascript)

And then one day, that sheet worker just stops working, and there is no indication why. A sheet worker that has been working for days, months, even years suddenly stop working. And you have no idea why.

If you put some kind of check in the sheet worker (console.log is handy here), you’ll find that the sheet worker is not being triggered, and may scratch your head wondering why.

This can be very frustrating. The fact that it can work for some time then suddenly stop encourages people to think or to argue that the problem must be something else. Don’t fall into that trap – just make sure that attributes on the event line are always in lower case. Then you will never have this issue.

Why Do People Not Do This?

The rule is not being invented by me. It’s in the official documentation, but it is not really given the importance it deserves. The documentation says this:

Note: All attribute names are lowercased in events. So even if you normally refer to an attribute as “Strength”, use “change:strength” in the event listener.

And that’s it. No explanation. No help for people who use upper case letters and everything seems to be working (for now). So people skip over it and don’t really pay attention, because it’s something they read that just isn’t rue. Their sheet workers work, after all.

I’ve seen this error occur many times, and a lot of people are just unaware of it, and when told about it, they often don’t appreciate just how important it is. After all, they use upper case letters and their workers are still working, so it can’t really be a problem. Can it?

Yes. yes, it can. Every time you use upper case letters in the event line it is a ticking time bomb. You won’t know when it will go off, and when it finally does, you have probably forgotten that this might be an issue so you don’t immediately think about it. You waste hours or days trying to find the issue, when the solution is simple – if you know it.

Final Comment

I really can’t over-emphasise the importance of this:

Attributes on the Event Line MUST be in Lower-case

Just do it. It’s very simple, and you never need think about it again.

Leave a Reply

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