A
ag07
Guest
I have the following code:
Create:
// array called 'point', to store numbers.
point[0] = 3;
point[1] = 2;
point[2] = 1;
point[3] = -1;
point[4] = 6;
point[5] = 7;
point[6] = -1;
point[7] = -1;
clicked = 0;
Global mouse Left released:
// track if left mouse clicked
if (clicked = 0) {
clicked = 1;
}
alarm[0] = 15;
Alarm[0]:
// -1 indicates empty slot in array
// if only one empty array slot next, skip to next empty slot, if two consecutive slots found, put mouse_x and mouse_y coordinates in these slots:
if (clicked = 1) {
for (i = 0; i < array_length_1d(point); i ++) {
if (point = -1) and (point[i + 1] != -1) {
continue;
}
else if (point = -1) and (point[i + 1] = -1)
point = mouse_x;
point[i + 1] = mouse_y;
}
}
This results in an endless column of the mouse_x coordinate, for example:
150
150
150
150
150
150
150
150
endlessly
The result I want is, for example:
point[0] = 3;
point[1] = 2;
point[2] = 1;
point[3] = -1;
point[4] = 6;
point[5] = 7;
point[6] = 150; // two empty slots in a row found, put in mouse x and y coordinates
point[7] = 320;
Sorry for the huge post, but why don't I have the above example result? What do I have wrong for that?
Thanks for the help
Create:
// array called 'point', to store numbers.
point[0] = 3;
point[1] = 2;
point[2] = 1;
point[3] = -1;
point[4] = 6;
point[5] = 7;
point[6] = -1;
point[7] = -1;
clicked = 0;
Global mouse Left released:
// track if left mouse clicked
if (clicked = 0) {
clicked = 1;
}
alarm[0] = 15;
Alarm[0]:
// -1 indicates empty slot in array
// if only one empty array slot next, skip to next empty slot, if two consecutive slots found, put mouse_x and mouse_y coordinates in these slots:
if (clicked = 1) {
for (i = 0; i < array_length_1d(point); i ++) {
if (point = -1) and (point[i + 1] != -1) {
continue;
}
else if (point = -1) and (point[i + 1] = -1)
point = mouse_x;
point[i + 1] = mouse_y;
}
}
This results in an endless column of the mouse_x coordinate, for example:
150
150
150
150
150
150
150
150
endlessly
The result I want is, for example:
point[0] = 3;
point[1] = 2;
point[2] = 1;
point[3] = -1;
point[4] = 6;
point[5] = 7;
point[6] = 150; // two empty slots in a row found, put in mouse x and y coordinates
point[7] = 320;
Sorry for the huge post, but why don't I have the above example result? What do I have wrong for that?
Thanks for the help