Script for checking if character has SKILL ID (variable)

To make a certain routine in my game easier, I'd like to be able check if a character has a certain skill by looking it up based on a variable. For instance, I want to check if actor(5) has skill(variable50). In this case, variable 50 would be the universal skill checking variable. It being 50 is irrelevant.

Any help would be greatly appreciated. Thank you for your time.
TL; DR:

($gameActors.actor(/* actor id */).skills().indexOf($dataSkills[$gameVariables.value(/* variable id */)]) !== -1)In Pieces:

$gameActors.actor(/* actor id */)Gets an actor by ID.

actor.skills()Gets the actor's skills as an array.

array.indexOf( item )Gets the index of an item in an array, or -1 if not found.

$dataSkills[ id ]Gets an skill by id

$gameVariables.value( id )Gets the value of variable id.

index !== -1The returned index is not -1, so it's in the array

SO, for a plugin:

if ($gameActors.actor(/* actor id */).skills().indexOf($dataSkills[$gameVariables.value(/* variable id */)]) !== -1) { // has skill}For an event, you can use the "script call" command, and I don't remember if actually there is an:

"if actor has skill variable<id>" too in the conditional branch...
Awesome. Thanks so much. I'm just placing it in a Conditional Branch's script section.

I really appreciate you breaking it down, too. I don't know if I'll ever get full on scripting down, but I do like to understand basic syntax for simple operations like this.

Original thread: https://forums.rpgmakerweb.com/threads/script-for-checking-if-character-has-skill-id-variable.51032/