What's the snippet for checking if a certain skill is learned

$game_party.actors[@actor].skill_learn?(skillid) or skill_include?

I'm trying to write a script that checks to see if the first member of the party knows x skill (let's say the first skill in the database).

I'd also like to know the snippet for $game_actors[1] etc etc.
actor.skill_learn?(skill)
skill *object*, not ID
example?
$game_actors[1].skill_learn?($data_skills[9])
not working... absolutely frustrating.
@gstv87 Just checking - is that bit of code in RGSS? It looks like RGSS3, though of course I could be wrong.
It's was RGSS the solution was as simple as removing the
$data_skills[9]
@Kes
the syntax is what I posted first: actor.skill_learn?(skill)
actor and skill being both objects, regardless of language or data structure.
From the Game_Actor section in the script editor we can peruse the relevant code:
Code:
  #--------------------------------------------------------------------------
  # * Learn Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def learn_skill(skill_id)
    if skill_id > 0 and not skill_learn?(skill_id)
      @skills.push(skill_id)
      @skills.sort!
    end
  end
  (...)
  #--------------------------------------------------------------------------
  # * Determine if Finished Learning Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_learn?(skill_id)
    return @skills.include?(skill_id)
  end

From this we can determine that skill_id should be a number. For example you can do something like this.
Code:
# Let us check if the first party member has learned the skill with id 9 in the database
$game_party.actors[0].skill_learn?(9)

# If you are using this in a script call you may have to split it up over multiple lines
actor = $game_party.actors[0]
if actor.skill_learn?(9)
  p "Do stuff here"
end

# Remember not to include leading zeroes.
$game_party.actors[0].skill_learn?(09) # Wrong

Good luck with your script

*hugs*
- Zeriab
I figured it out a few hours prior, but thanks for the in depth explanation, Z'. I'm sure it'll help in similar problems in the future.

Original thread: https://forums.rpgmakerweb.com/threads/whats-the-snippet-for-checking-if-a-certain-skill-is-learned.99325/