(Custom script call) How can I check for an array in a script call?

So for start, I'm using this old script that change the battle system for cards:
Card Game Script

But I did several custom script calls (some with thanks of members of this awesome forum. Thanks guys)

And for some time I deal with creating more custom script calls by my own. But now I'm having a little of a hard time with this one.

I have a variable that store the ID of the actors based on an state with the Yanfly Lunatic State Script. And I want to create a custom script call for the card game script that check if in the array of my variable is the ID of the actors on the current party. So, how should I make this script call? This is the script call to check if a card is in the graveyard of any member of the party:

Ruby:
def has_x_cards_in_grave?(id, count)
   for actors in $game_party.members
    return actor.grave.count { |card| card.id == id } >= count
end
  end

I tried some things but doesn't seem to work:
Ruby:
def numinous_in_grave?(id, count)
    for actors in $game_variables[36]
    return actors.grave.count { |card| card.id == id } >= count
    end
  end

Ruby:
def numinous_in_grave?(id, count)
    for actors in $game_party.members[$game_variables[36]]
    return actors.grave.count { |card| card.id == id } >= count
    end
  end

And several other tries... Any kind of help is welcome!
From the code you've tried, it looks like you want to return the grave count if the card id is the actor id?
If so what you have would not work as you have tried.

So trying to restructure what you wrote I can guess part of it.
Ruby:
def numinous_in_grave?(id, count)
  $game_variables[36].each do |a|
    actor = $game_actors[a]
    return actor.grave.count if #-> ?? { |card| card.id == id } >= count
    # not sure where card is from. actor.grave.count sounds like a number
  end
end

That's based on the little I can see.
If you did p(actors.grave.count)
do you get something that has cards in it?
Once again you saved my life! So now I understand that the ".each do |a|" tell the codes for all arrays in a variable and I can check if the Id of an actor or even item/skills etc could be checked with [a] at the end of that item. Thanks a lot!


it looks like you want to return the grave count if the card id is the actor id?
The script call actually check if a card with the ID of a skill is in the grave. As with this script, skills turn to cards.
So now I understand that the ".each do |a|" tell the codes for all arrays in a variable and I can check if the Id of an actor
So to break it down...
"thing to check".each <- works if it is an array, not just a normal value.
do <- tells the rest what to do with the value getting extracted from the array
|a| <- can be any character or name ( actor, act, ujhhs, etc), it's just what you reference in the next lines.
in my example I got the actor by pulling in the $data_actors and specifying the id.
Since the array will be something like [4,8,1]
each number is the id of the actor.
So you can see how it follows, variable.each do |value| (what do you want to do with 4)

there are other ways to do this as well.
variable.size.times do |a|
num = variable.size -> for i in 0..num - 1 (usually -1 because the size method give you a value above 0, but array's start at 0 [4,8,1] = [0,1,2]

If you're interested in learning ruby, then there are plenty of courses. I took one at udemy site. Instructor was Boris Paskhaver. Learn to code with ruby. Currently on sale today for 17.99 CAN

Original thread: https://forums.rpgmakerweb.com/threads/custom-script-call-how-can-i-check-for-an-array-in-a-script-call.148553/