MV erro plugin de gamepad virtual!

This is my plugin!
JavaScript:
//=============================================================================
// my_plugin.js
//=============================================================================

var Imported = Imported || {};
Imported.Galv_NoMouse = true;

/*:
 *@plugindesc  Adcionar Virtualpad!.
 *@author Saikai
 *@help
 *
 * Adcionar Virtualpad
 * Version 1.01
 * saokai
 *
 *
 *==========================================================================
 *    Pré-requisitos
 *==========================================================================
 *Reservar uma switch para verifica quando o evento foi ou n ativado!
 *primeiro criar uma imagem do seu virtualpad e colocar na pasta pictures/,
 *depois use algum edito de imagem para ver as coordernadas X e Y de cada
 *botão, seguer links de imagens como exemplo abaixo!
 *
 *Exemplo de imagem virtualpad: https://prnt.sc/128xwy7
 *Exemplo de coordernadas usando a tecla up como ex:https://prnt.sc/128yoqf
 *   Na imagem acima X1 é o x inicial e X2 é o X final, o mesmo pra Y.
 *   lembrando que tudo deve ser calculado em pixel!
 *
 *==========================================================================
 *    Comandos por eventos (script)
 *==========================================================================
 *
 *
 *Para ativa e desativa o virtualpad basta chama um script atravez de algum
 *evento
 *mouseon = desativa o virtualpad se ativo e permitir cliques do mouse no mapa.
 *mouseoff = desativa o mouse se ativo e bloquear cliques do mouse no mapa.
 *
 *
 *==========================================================================
 *    Creditos finais
 *==========================================================================
 *N é necessario dar nenhum mais se der seria de bom grato, pode fazer
 *qualquer mudança que achar necessario no plugin!
 *contatos: Doscird: Saikai#8826
 *    Facebook: https://www.facebook.com/alexsandroxagra/
 *    Whatsapp: 8299228371
 *==========================================================================
 *
 *@param Ativado
 *@text Carregar switch
 *
 *     @param Switch
 *     @text Switch de ativação
 *     @type switch
 *    @parent Ativado
 *
 *
 *@param virtualpad
 *@text Carregar imagem
 *
 *    @param image
 *    @type file
 *    @dir img/pictures/
 *    @parent virtualpad
 *
 *
 *    ============ MAPEAMENTO DOS BOTÔES ============
 *@param Botoes
 *
 * 
 *     @param coodernadas
 *     @parent Botoes
 *
 *
 *
 *         @param A200
 *        @text A
 *         @parent coodernadas
 *
 *             @param A201
 *            @text A x
 *             @parent A200
 *
 *                @param A202
 *                @text x inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição x do botão A,
 *                @parent A201
 *
 *                 @param A203
 *                @text x final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição x do botão A,
 *                 @parent A201
 *
 *             @param A211
 *            @text A y
 *             @parent A200
 *
 *                 @param A212
 *                @text y inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição y do botão A,
 *                @parent A211
 *
 *                 @param A213
 *                @text y final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição y do botão A,
 *                @parent A211
 *
 *
 *        @param B200
 *        @text B
 *         @parent coodernadas
 *
 *             @param B201
 *            @text B x
 *             @parent B200
 *
 *                @param B202
 *                @text x inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição x do botão B,
 *                @parent B201
 *
 *                 @param B203
 *                @text x final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição x do botão B,
 *                 @parent B201
 *
 *             @param B211
 *            @text B y
 *             @parent B200
 *
 *                 @param B212
 *                @text y inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição y do botão B,
 *                @parent B211
 *
 *                 @param B213
 *                @text y final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição y do botão B,
 *                @parent B211
 *
 *
 *        @param up200
 *        @text up
 *         @parent coodernadas
 *
 *             @param up201
 *            @text up x
 *             @parent up200
 *
 *                @param up202
 *                @text x inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição x do botão UP,
 *                @parent up201
 *
 *                 @param up203
 *                @text x final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição x do botão UP,
 *                 @parent up201
 *
 *             @param up211
 *            @text up y
 *             @parent up200
 *
 *                 @param up212
 *                @text y inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição y do botão UP,
 *                @parent up211
 *
 *                 @param up213
 *                @text y final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição y do botão UP,
 *                @parent up211
 *
 *
 *
 *        @param down200
 *        @text down
 *         @parent coodernadas
 *
 *             @param down201
 *            @text down x
 *             @parent down200
 *
 *                @param down202
 *                @text x inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição x do botão down,
 *                @parent down201
 *
 *                 @param down203
 *                @text x final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição x do botão down,
 *                 @parent down201
 *
 *             @param down211
 *            @text down y
 *             @parent down200
 *
 *                 @param down212
 *                @text y inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição y do botão down,
 *                @parent down211
 *
 *                 @param down213
 *                @text y final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição y do botão down,
 *                @parent down211
 *
 *        @param left200
 *        @text left
 *         @parent coodernadas
 *
 *             @param left201
 *            @text left x
 *             @parent left200
 *
 *                @param left202
 *                @text x inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição x do botão left,
 *                @parent left201
 *
 *                 @param left203
 *                @text x final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição x do botão left,
 *                 @parent left201
 *
 *             @param left211
 *            @text left y
 *             @parent left200
 *
 *                 @param left212
 *                @text y inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição y do botão left,
 *                @parent left211
 *
 *                 @param left213
 *                @text y final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição y do botão left,
 *                @parent left211
 *
 *
 *        @param right200
 *        @text right
 *         @parent coodernadas
 *
 *             @param right201
 *            @text right x
 *             @parent right200
 *
 *                @param right202
 *                @text x inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição x do botão right,
 *                @parent right201
 *
 *                 @param right203
 *                @text x final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição x do botão right,
 *                 @parent right201
 *
 *             @param right211
 *            @text right y
 *             @parent right200
 *
 *                 @param right212
 *                @text y inicio
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor inicial da posição y do botão right,
 *                @parent right211
 *
 *                 @param right213
 *                @text y final
 *                 @type number
 *                 @min 0
 *                 @max 3666
 *                 @desc valor final da posição y do botão right,
 *                @parent right211
 */
 
 
 var parameters = PluginManager.parameters('my_plugin');
 //exemplo 1        var movimento_mouse = Number(parameters['DesativaMouse'] || 1);
 var movimento_mouse = String(parameters['DesativaMouse']).toLowerCase();
 var Switcha = parameters['Switch'];
// salva o nome da imagem em uma variavel
 var imagem = parameters['image'];
// salva as coordernadas dos botões em variaveis
  var b_a = [Number(parameters['A202']), Number(parameters['A203']), Number(parameters['A212']), Number(parameters['A213'])];
  var b_b = [Number(parameters['B202']), Number(parameters['B203']), Number(parameters['B212']), Number(parameters['B213'])];
  var b_up = [Number(parameters['up202']), Number(parameters['up203']), Number(parameters['up212']), Number(parameters['up213'])];
  var b_down = [Number(parameters['down202']), Number(parameters['down203']), Number(parameters['down212']), Number(parameters['down213'])];
  var b_left = [Number(parameters['left202']), Number(parameters['left203']), Number(parameters['left212']), Number(parameters['left213'])];
  var b_right = [Number(parameters['right202']), Number(parameters['right203']), Number(parameters['right212']), Number(parameters['right213'])];
(function () {

    //ON/OFF cliques do mouse para andar!
    var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;

    
    
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
       aliasPluginCommand.call(this, command, args);
       if (command === 'mouseon') {
          movimento_mouse = 'true';
          
          $gameScreen.erasePicture(20);
       }
      
      
       if (command === 'mouseoff') {
          movimento_mouse = 'false';
            
            
            $gameScreen.showPicture(20, imagem, 0, 0, 0, 100, 100, 255, 0);
            $Game_Switches.setValue(0001, true);
            
            

            Game_Map.prototype.refresh = function() {

            //if (TouchInput.isTriggered() && TouchInput.x >= 1035 && TouchInput.x <= 1115 && TouchInput.y >= 593 && TouchInput.y <= 667) {
            if (TouchInput.isTriggered() && TouchInput.x >= b_a[0] && TouchInput.x <= b_a[1] && TouchInput.y >= b_a[2] && TouchInput.y <= b_a[3]) {
                //console.log("A");
                Input._currentState['ok'] = true;
            } else {
                Input._currentState['ok'] = false;
            }

            //if (TouchInput.isTriggered() && TouchInput.x >= 1152 && TouchInput.x <= 1229 && TouchInput.y >= 516 && TouchInput.y <= 593) {
            if (TouchInput.isTriggered() && TouchInput.x >= b_b[0] && TouchInput.x <= b_b[1] && TouchInput.y >= b_b[2] && TouchInput.y <= b_b[3]) {
                //console.log("B");
                Input._currentState['escape'] = true;
            } else {
                Input._currentState['escape'] = false;
            }
            
            //if (TouchInput.isPressed() && TouchInput.x >= 123 && TouchInput.x <= 183 && TouchInput.y >= 503 && TouchInput.y <= 564) {
            if (TouchInput.isPressed() && TouchInput.x >= b_up[0] && TouchInput.x <= b_up[1] && TouchInput.y >= b_up[2] && TouchInput.y <= b_up[3]) {
                //console.log("Cima");
                Input._currentState['up'] = true;
            } else {
                Input._currentState['up'] = false;
            }
            
            //if (TouchInput.isPressed() && TouchInput.x >= 123 && TouchInput.x <= 183 && TouchInput.y >= 617 && TouchInput.y <= 677) {
            if (TouchInput.isPressed() && TouchInput.x >= b_down[0] && TouchInput.x <= b_down[1] && TouchInput.y >= b_down[2] && TouchInput.y <= b_down[3]) {
                //console.log("Baixo");
                Input._currentState['down'] = true;
            } else {
                Input._currentState['down'] = false;
            }
            
            //if (TouchInput.isPressed() && TouchInput.x >= 53 && TouchInput.x <= 123 && TouchInput.y >= 564 && TouchInput.y <= 616) {
            if (TouchInput.isPressed() && TouchInput.x >= b_left[0] && TouchInput.x <= b_left[1] && TouchInput.y >= b_left[2] && TouchInput.y <= b_left[3]) {
                //console.log("Direita");
                Input._currentState['left'] = true;
            } else {
                Input._currentState['left'] = false;
            }
            
            //if (TouchInput.isPressed() && TouchInput.x >= 183 && TouchInput.x <= 252 && TouchInput.y >= 564 && TouchInput.y <= 616) {
            if (TouchInput.isPressed() && TouchInput.x >= b_right[0] && TouchInput.x <= b_right[1] && TouchInput.y >= b_right[2] && TouchInput.y <= b_right[3]) {
                //console.log("Esquerda");
                Input._currentState['right'] = true;
            } else {
                Input._currentState['right'] = false;
            }

        };
       }
    };
    

    Game_Temp.prototype.setDestination = function(x, y) {
        if (movimento_mouse == 'true') {
                this._destinationX = x;
                this._destinationY = y;
        } else {
                        
        }
    };

})();

It works 100% but the line 384 $ Game_Switches.setValue (0001, true); it's no use! because this Switch is not being used by anything or anyone. but if I remove this line, the virtualpad will not start! more if it has been activated or deactivated, it does not matter, because in the game I will not be able to activate or deactivate any other Switch. I can't understand why!
Moved to: Plugin Support

Is this YOUR plugin, or someone else's?

There is no such thing in MV as $Game_Switches, so whether that line is in or not should make no difference ... unless you have another plugin that goes with this one that defines it and uses it.

Have you edited it? Can you give a link to the original unedited version?

What other plugins do you have?
1619876029816.png

these are the plugins that are at the moment, and this plugin was made by me just used the concepts of other plugins so that I could understand how it starts!

Original thread: https://forums.rpgmakerweb.com/threads/erro-plugin-de-gamepad-virtual.136002/