I was trying to do a fairly straightforward "table map" conversion to map one set of values to another rather than trying to write a messy math function to do it. I've gotten as far as this: <script type="text/worker">
on("change:fate_1", function() {
getAttrs(["fate_1"], function(v) {
switch (v.fate_1) {
case 0:
setAttrs({"fate_1_level":2});
break;
case 10:
setAttrs({"fate_1_level":3});
break;
case 30:
setAttrs({"fate_1_level":4});
break;
case 70:
setAttrs({"fate_1_level":5});
break;
};
});
});
</script> But it ALWAYS returns 5; Originally I had a "default" clause at the end to return 2 as a "default" and under those circumstances, it ALWAYS returned 2. It seems like somehow it is always returning the last value in the list. I've tried a lot of different tests, and I don't really understand where I'm going wrong. Can anyone assist?