the block is supposed to return a list that has other lists in it each list is supposed to contain 2 things X and Y of each finger and if there isn’t a finger then no list
well the list is given by world.hands and to create a list like the ones you see in snap you need to use new List(js array goes here or a variable that references one)
Could we get all of the worlds hands positions? Somehow (me brainstorming) if world.hands returns a list we can get each hand like if we did for each item in world.hands we would get the item/HandMorph and then get its position and add that to a list and then we return the list when done? Is my idea good?
Process.prototype.reportMousePosition = function () {
var world, pos;
if (this.homeContext.receiver) {
world = this.homeContext.receiver.world();
if (world) {
if (world.hands.length === 1) {
pos = this.homeContext.receiver.snapPoint(world.hand.position());
return new List([pos.x, pos.y]);
} else {
var result = ;
for (let i = 0; i < world.hands.length; i++) {
const hand = world.hands[i];
let point = this.homeContext.receiver.snapPoint(hand.position());
result.push(new List([point.x, point.y]));
}
return new List(result);
}
}
}
return '';
};
No I meant by getmouseposiiton was the function you gave me it wasn’t working the function I gave you was returning nothing and the other ones were returning zero
So when a hand is created for that finger alone just report the position of that hand and store it in a list and if there is another add another list. Could you make a function for that?
Process.prototype.reportMousePosition = function () {
var world, pos;
if (this.homeContext.receiver) {
world = this.homeContext.receiver.world();
if (world) {
if (world.hands.length < 2) {
pos = this.homeContext.receiver.snapPoint(world.hand.position());
return new List([pos.x, pos.y]);
} else {
var result = [];
for (let i = 0; i < world.hands.length; i++) {
const hand = world.hands[i];
let point = this.homeContext.receiver.snapPoint(hand.position());
result.push(new List([point.x, point.y]));
}
return new List(result);
}
}
}
return '';
};
Process.prototype.reportMouseX = function () {
var world;
if (this.homeContext.receiver) {
world = this.homeContext.receiver.world();
if (world) {
if (world.hands.length < 2) {
return this.homeContext.receiver.snapPoint(world.hand.position()).x;
} else {
return new List(world.hands.map((hand) => this.homeContext.receiver.snapPoint(hand.position()).x));
}
}
}
return 0;
};
Process.prototype.reportMouseY = function () {
var world;
if (this.homeContext.receiver) {
world = this.homeContext.receiver.world();
if (world) {
if (world.hands.length < 2) {
return this.homeContext.receiver.snapPoint(world.hand.position()).y;
} else {
return new List(world.hands.map((hand) => this.homeContext.receiver.snapPoint(hand.position()).y));
}
}
}
return 0;
};
i think you're using regular Snap! source, the "Source Code" button on the site isn't the one you want this is.