Set Variable to Skill ID?

Basically what the title says. Is there any way to set a variable to the ID of a skill that's being selected in battle? I say this with the intent of it changing every time the player's turn comes around and they select a different skill. Is there a script that allows skills to control variables, maybe? 

Alternately, where in the Scene_Battle script or something similar can I grab the ID from? I'm not averse to digging around in there, but I can't seem to find anything to make the variable equal to.
Hi there,

I'm sure there is any easier way to do this, but I achieved a similar result by putting "$game_variables[n]=S" no quotes in the skill formula. Where "n" is the variable number you want, and S is the skill number you want. Basically, when you cast a spell/skill it says "this variable equals whatever you want it to". In my case, I used the method to figure out whom was casting it. 

I'm no scripter, so as I said, I'm sure there is a better or different way to handle this.

Sindaine
I appreciate the idea, but I needed to know the variable during skill selection.

Fortunately I found a line of Scene_Battle that works. If you put "$game_variables[n] = @skill.id" at line 439 or thereabouts, it sets the variable 'n' to the ID of whatever skill you choose from the skill select menu. The only drawback is it doesn't work with Attack on the command list, but that can be remedied by putting it or a similar skill in the list instead and removing the Attack command.

I will keep that in mind if I need the ID as they attack, though! Thank you, I didn't know you could do that with custom damage formulas. 

Problem solved!

Original thread: https://forums.rpgmakerweb.com/threads/set-variable-to-skill-id.37827/