Is there a way to refer to all objects in an array?

If there is, how would I do that? For example, say I wanted to check if any of my variables in an array were equal to (blah blah blah variable placeholder).

Thanks, MakerMan

well… from what I understand of arrays… You could simply theoretically just… directly put them in a condition.

So arrays are data stored in groups of boxes that are numbered starting from 0:
box = [0, 1, 2, 3...]

And i have three arrays:

var damage = [5, 10, 15]
var jump = [6, 12, 18]
var health = [7, 14, 21]

And I have my very variable friend, Bob, who was given Bob.HP = health[1] //since we've gotten the data of the array health from index 1, his health is now 14

And I want to see if my friend bob can handle the damage I’ve givent to my pet bullDawg.ATK = damage[0] //bullDawg has 6 attack damage

if (Bob.HP <= bullDawg.ATK){
 He just dies
}

well since you just want to compare array index data to a variable you could just do this:

if (health[0] >jump[1]){
   do something
}

That’s just me guessing however, I’m not sure if it would work

Ok, but I want it to check all variables, like:

if (variable1 === array1[]) {

}

You can use the “forEach” function, here’s an example:

var Array1=[1,8,2,9,5]; // Make an array
Array1.forEach(function(value){ // forEach value...
    if(value<6) // If a value is less than six
    console.log(value); // Log the value in the console
});

Expected results:
image

1 Like

Ok, so I tried storing this in the update script of my Q clip, but for some reason it keeps saying “this.clone(); is not a function”

Here’s the file: QWAS4-27-2021_18-07-52.wick (165.7 KB)

(I want the clip to clone itself every time the timer is equal to one of the variables in an array)

weird, it works when i change this.clone(); to Q.clone();
It does starts to slow down when there are many buttons though

Yeah, It seems that every time it repeats, it clones more times than before.