Hi. Working with Sheet Workers I recommend you to think about what event your code should listen to. For example, if your Sheet Worker script should be activated if a certain attribute changes, you should specify this as the event: on("change:attackers-bs", function(eventInfo) {
}); In this function you can now write down the code that translates the attacker's BS into a certain value. Assuming that the Range in your table is another value that you want to read off of your sheet, you should use the getAttrs-function to get it (and save it in a variable): on("change:attackers-bs", function(eventInfo) {
getAttrs(["range", "attacker-bs"], function(values) {
var bs = values.attacker-bs;
var range = values.range;
});
}); Now you can approach the problem in several ways, from a three-dimensional array to a chain of select case-statements to some mix of math and exceptions (because some of the values are in fact calculatable). Personally I think I'd do something like this: select (true) {
case (range >37) {
if (bs <= 4) {
result = "Miss";
} else if (bs > 4 && bs < 12) {
let temp = 11;
result = temp - (bs - 5);
} else if (bs == 12) {
result = 6;
}
break;
}
} This is, of course, only a very rough sketched approach, untested and all. But my tip is: Calculate as much as possible. And of course make sure to have a look at the official documentation (available here ). Cheers, Loki