Slight modification (addition of a feature) of a plugin

Hello. I have a very specific request this time. Can someone please make variables work with this plugin: https://github.com/quxios/QMV-Master-Demo/blob/master/js/plugins/QPathfind.js
Currently, there are only plugin commands which do not support variables like $gameVariables.value(x) And it's not possible to make the event go to a place that's not predetermined.
The author of the plugin has left the RM community so I cannot ask them for help. This plugin is the only pathfinding plugin that works for my game (I use pixel movement so all other pathfinding plugins work but they're a bit laggy and not precise, sometimes characters jitter.)
Thanks you.
I have not tested this, so no idea if it works, will cause an error, or what ... but

see this, starting on line 768?

Code:
Game_Interpreter.prototype.qPathfindCommand = function(args) {
  // qPathfind CHARAID X Y
  // qPathfind CHARAID chase CHARAID2
  // qPathfind CHARAID clear
  var chara;

Insert the following:
Code:
  args = args.replace(/\\V\[(\d+)\]/gi, function() {
    return $gameVariables.value(parseInt(arguments[1]));
  }.bind(this));

so it looks like this:
Code:
Game_Interpreter.prototype.qPathfindCommand = function(args) {
  // qPathfind CHARAID X Y
  // qPathfind CHARAID chase CHARAID2
  // qPathfind CHARAID clear
  args = args.replace(/\\V\[(\d+)\]/gi, function() {
    return $gameVariables.value(parseInt(arguments[1]));
  }.bind(this));
  var chara;

then in your plugin command put \V[id] wherever you want a variable's value inserted (id = the variable id, without leading zeros).

If you get any errors, please add one more line above the newly-inserted line:
Code:
console.log(args);
then play to get the error again, then post a screenshot of what's in the console.


(it might not like it because it's an array, and in that case I'll have to make a slight change)
Thank you @Shaz I'll try this right now ^^

EDIT:
It works!
Looks like you have gone offline, so I will check back in the morning.

If it gives you an error saying something like 'function replace not valid for array', change it to this instead:

Code:
  args = args.join(" ").replace(/\\V\[(\d+)\]/gi, function() {
    return $gameVariables.value(parseInt(arguments[1]));
  }.bind(this)).split(" ");
@Shaz The second fix works ^^ But it actually worked for V[id] instead of \V[id]
Thanks a lot ^^
@Hyouryuu-Na sorry for entering the conversation after it is done, but...

This is not the only plugin with plugin commands like this. In fact, most plugins with them are like this too.
That is why SRD released a plugin that lets you use codes in plugin commands, and later Yanfly released a version a bit more simplified for the user with less coding knowledge (it is paid now, though... but I still used SRD's version even while it was free since I do have some coding knowledge anyway).

So, in the future, I suggest you use one of the two. No need to change every plugin you need this for.
I have Yanfly's plugin from the time it was still free. It didn't work for this particular plugin even though it worked for all the other plugins I have. I didn't know that SumRndmDde also has one. I have to check it out. Thanks @Waterguy

Original thread: https://forums.rpgmakerweb.com/threads/slight-modification-addition-of-a-feature-of-a-plugin.116585/