using a variable to set a skill in battle

I'm using the VE_CommandReplace plugin and was wondering if, instead of specifying a skill to replace my default attack, I could get the skill number from a variable.

The script works as follows:

<command replace: 'Attack', 'Limit', skill 66>
result = a.tp == 100;
</command replace>

But instead of writing "skill 66" could i write something like "$gameVariables.value(1)" so that the skill number was changed depending on the variable. So would look something like below but I'm no good at JavaScript so don't know how to write it if it is possible...

<command replace: 'Attack', 'Limit', skill $gameVariables.value(1)>
result = a.tp == 100;
</command replace>
Your syntax is correct, but it will only work if the plugin allows you to do that. Try it and see what happens. If it doesn't work, and you want to do it, a mod to the plugin will be required (in that case, post a link to the plugin)
the plugin requires a couple of plugins to run, the first being ve_basicmodule, the second being ve_directcommands, and the third being ve_commandreplace. links below. the notetag didn't work and I'm not sure what to change to get it to work. any help would be appreciated.


https://victorenginescripts.wordpress.com/rpg-maker-mv/basic-module/

https://victorenginescripts.wordpress.com/rpg-maker-mv/direct-commands/

https://victorenginescripts.wordpress.com/rpg-maker-mv/command-replace/
Please post LINKS to the plugin threads. Putting other people's entire plugins into your post is something that we ask people not to do, for a number of reasons.
Oops sorry. I have edited the post. Hopefully that's ok now. Any idea on what I should edit or how to set it up?
@Victor Sant - regular expressions and I do not like each other very much. Are you able to suggest a mod that would allow this? I'm guessing it would be a fairly simple change for someone who knows what's going on.
@Erebus
The ids are saved as the game is loaded, so it is not possible to have a variable as the value (well, thecnically it is, but it will check the variable as the game load, wich will be most likely 0, and save the value). The only option is to hard code any possible variation you want.

Code:
   Window_Command.prototype.setupNewCommand = function(command) {
       var result = {}
       result.replace = command.replace;
       result.name    = command.name;
       result.ext     = command.id || command.name || 0;
       result.symbol  = this.setupCommandSymbol(command);
       result.enabled = this.setupUsableCommand(command);
       result.prioity = command.replace === '' ? 2 : command.name === '' ? 0 : 1;
       return result;
   };

this is the line that set the ID
Code:
result.ext     = command.id || command.name || 0;

so you can make a conditional branch that checks specific IDs and change the behavior based on that.

for example:
Code:
if (command.id === 666) {
  result.ext     = $gameVariables.value(1);
} else {
  result.ext     = command.id || command.name || 0;
}

this way the tag
<command replace: 'Attack', 'Limit', skill 666>

will be replaced by the variable value. You will need another branch for each different value you want.
Thanks for this, I'm a total noob when it comes to JavaScript. This is what I have tried but it's not working...

Code:
Window_Command.prototype.setupNewCommand = function(command) {
        var result = {}
        result.replace = command.replace;
        result.name    = command.name;
        if (command.id === 666) {
              result.ext     = $gameVariables.value(1);
            } else {
              result.ext     = command.id || command.name || 0;
            }
        result.symbol  = this.setupCommandSymbol(command);
        result.enabled = this.setupUsableCommand(command);
        result.prioity = command.replace === '' ? 2 : command.name === '' ? 0 : 1;
        return result;
    };

I also tried it like this...

Code:
Window_Command.prototype.setupNewCommand = function(command) {
        var result = {}
        result.replace = command.replace;
        result.name    = command.name;
        result.ext = 
          if (command.id === 666) {
                        result.ext     = $gameVariables.value(1);
                      } else {
                        result.ext     = command.id || command.name || 0;
                      }
        result.symbol  = this.setupCommandSymbol(command);
        result.enabled = this.setupUsableCommand(command);
        result.prioity = command.replace === '' ? 2 : command.name === '' ? 0 : 1;
        return result;
    };

I don't really know how to enter the code and was hoping someone might be able to tell me?
I've managed to get it working now. Thanks very much for the help!

Original thread: https://forums.rpgmakerweb.com/threads/using-a-variable-to-set-a-skill-in-battle.85051/