So, I have this kind of thing:
<<piercingsRandom random(2, setup.pcPiercingCount())>>
Can I do something like this? Or do I need to pull it out, assign it to a variable and then use it in the widget call?
I'm expecting setup.pcPiercingCount() to come up with a value. piercingsRandom expects a simple integer argument.
Let me show this other thing I cobbled together:
/* Returns the number of parts that are pierced. */
setup.pcPiercingCount = function () {
var sv = State.variables;
var cnt = 0;
Object.keys(sv.pcPierced).some(function (part) {
if (sv.pcPierced[part].scale > 0)
cnt++;
});
return cnt;
};
It works, but I really don't understand if it's essential to have it like this. Maybe there's a simpler way?
With the piercing stuff, I decided to limit the print out. So, it'll present a randomized listing between this and that number, to give it variety. It works, except for this bit. So... what do?