Eli Button Common Events - Assign/bind common events to your keyboard keys!

● ARCHIVED · READ-ONLY
Started by Eliaquim 63 posts Page 4 of 4 View original ↗
  1. HMM!! So, my guess is some plugin may be overwritting the Game_Interpreter.prototype.terminate
    OR Some is messing with the Input.GamepadMapper. The code 2: "x" is indeed X on the controller. Bu I can also see null: "x"
    I don't think this is a problem... so we can let this "null" thing for later.

    Now you have to find a way to see what plugin is using Game_Interpreter.prototype.terminate

    Social_Knight said:
    Which made check Eli.ButtonCommonEvents.regularCommonEvents[15] BEFORE running it, and it is indeed undefined there. So it starts undefined, becomes true, and stays true.
    - Yeah, starting undefined is normal. The problem is it staying true all the time.
  2. Looking for prototype.terminate with a NotePad ++ Mass search for that lands me at Gimmer's Core, where he creates a section that allows Common Event Callbacks. Since the only plugin of his I use is one that alters messages I figured I'd try to mass comment out that section, but that had no effect, so I re-engaged it (I load his Core before your Book anyways, so I didn't think it was that). Still here's that code anyways:
    Code:
    //Support for common events to have callbacks
    var Gimmer_Core_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        Gimmer_Core_Interpreter_pluginCommand.call(this, command, args)
        command = command.toUpperCase();
        args = Gimmer_Core.compressArgs(args);
        if(command in Gimmer_Core.pluginCommands){
            return Gimmer_Core.pluginCommands[command](args);
        }
    };
    
    Gimmer_Core.compressArgs = function(args){
        if(!args){
            args = [];
        }
    
        let returnArgs = [];
    
        let textArg = [];
        for(let i=0;i<args.length;i++){
            if(args[i][0] === '"'){
                if(args[i][args[i].length -1] === '"'){
                    returnArgs.push(args[i].replace('"',"").replace('"',""));
                }
                else{
                    textArg.push(args[i].replace('"',""));
                }
    
            }
            else if(args[i][args[i].length -1] === '"'){
                textArg.push(args[i].replace('"',""));
                returnArgs.push(textArg.join(" "));
                textArg = [];
            }
            else if(textArg.length > 0){
                textArg.push(args[i]);
            }
            else{
                returnArgs.push(args[i]);
            }
        }
        return returnArgs;
    }
    
    Gimmer_Core.pluginCommands['FADEINBGM'] = function(args){
        let bgm = {
            name: args[1],
            volume: parseInt(args[2]),
            pitch: parseInt(args[3]),
            pan: parseInt(args[4]),
            pos: parseInt(args[5]) || 0
        }
    
        AudioManager.playBgm(bgm, bgm.pos);
        AudioManager.fadeInBgm(parseInt(args[0]));
    }
    
    Gimmer_Core.reserveCommonEventWithCallback = function(commentEventId, callback){
        Gimmer_Core.pendingCallbacks[commentEventId.toString()] = callback;
        $gameTemp.reserveCommonEvent(commentEventId);
    }
    
    Gimmer_Core.Game_Interpreter_prototype_setupReservedCommonEvent = Game_Interpreter.prototype.setupReservedCommonEvent;
    Game_Interpreter.prototype.setupReservedCommonEvent = function() {
        if ($gameTemp.isCommonEventReserved()) {
            this._commonEventId = $gameTemp.reservedCommonEvent().id;
        }
        return Gimmer_Core.Game_Interpreter_prototype_setupReservedCommonEvent.call(this);
    };
    
    Game_Interpreter.prototype.initialize()
    Gimmer_Core.Game_Interpreter_prototype_initialize = Game_Interpreter.prototype.initialize;
    Game_Interpreter.prototype.initialize = function(depth) {
        Gimmer_Core.Game_Interpreter_prototype_initialize.call(this, depth);
        this._commonEventId = -1;
    }
    
    Gimmer_Core.Game_Interpreter_prototype_terminate = Game_Interpreter.prototype.terminate;
    Game_Interpreter.prototype.terminate = function() {
        if(this._commonEventId && this._commonEventId.toString() in Gimmer_Core.pendingCallbacks && typeof Gimmer_Core.pendingCallbacks[this._commonEventId.toString()] === 'function'){
            Gimmer_Core.pendingCallbacks[this._commonEventId.toString()]();
            delete Gimmer_Core.pendingCallbacks[this._commonEventId];
        }
        Gimmer_Core.Game_Interpreter_prototype_terminate.call(this);
    };
    There's of course also the original rpg.objects function, which is just
    Game_Interpreter.prototype.terminate = function () {
    this._list = null;
    this._comments = '';
    };



    As for Input.gamepadMapper, MV3D adds in the shoulder buttons as standard inputs for controllers and defaults them to Look Up/Look Down and the lower shoulders to Strafe Left/Right. I also add this to Yanfly's GamePadConfig (for the options menu).

    I do also have Yanfly's Common Button Events and WolfPad, but both are disabled at the moment. Obviously, YEP Common Events doesn't do controller. WolfPad makes the controller sensitivity better and increases compatibility with more controller types though not sure if I'm using it yet as it's not hugely important

    I don't think anything huge is causing aggro here as a result, but here is the Notepad ++ search:

    Code:
    Search "Input.gamepadMapper" (25 hits in 6 files of 250 searched)
      H:\Damocles Legacy\js\plugins\Eli_ButtonCommonEvents.js (10 hits)
        Line 191:             var inputObject = Input.gamepadMapper
        Line 227:                 Input.gamepadMapper[code] = keyName
        Line 307:                 const key = Input.gamepadMapper[i]
        Line 384:         if(Input.gamepadMapper.hasOwnProperty(keyCode) && !overwrite){
        Line 385:             oldName = Input.gamepadMapper[keyCode]
        Line 386:             keyName = Input.gamepadMapper[keyCode]
        Line 389:             oldName = Input.gamepadMapper[keyCode]
        Line 390:             Input.gamepadMapper[keyCode] = keyName
        Line 436:             Input.gamepadMapper[keyCode] = oldName
        Line 438:             delete Input.gamepadMapper[keyCode]
      H:\Damocles Legacy\js\plugins\GamepadConfig.js (3 hits)
        Line 250:         if (Input.gamepadMapper[i] === type) return i;
        Line 302:     Input.gamepadMapper = this.gamepadInput;
        Line 619:     var formerConfig = Input.gamepadMapper[buttonId];
      H:\Damocles Legacy\js\plugins\mv3d.js (1 hit)
        Line 429656:     Object.assign(Input.gamepadMapper, input_mv3d.GAMEPAD_TURN_BUTTON === 1 ? {
      H:\Damocles Legacy\js\plugins\WolfPadMVZ.js (2 hits)
        Line 218:     Input.gamepadMapper = {
        Line 482:     WolfPad.maps = Object.entries(Input.gamepadMapper).reduce((maps, entry)  => {
      H:\Damocles Legacy\js\plugins\YEP_ButtonCommonEvents.js (8 hits)
        Line 925: if (Yanfly.Param.BCEList['gamepad_a'] !== 0) Input.gamepadMapper[0] = 'gamepad_a';
        Line 926: if (Yanfly.Param.BCEList['gamepad_b'] !== 0) Input.gamepadMapper[1] = 'gamepad_b';
        Line 927: if (Yanfly.Param.BCEList['gamepad_x'] !== 0) Input.gamepadMapper[2] = 'gamepad_x';
        Line 928: if (Yanfly.Param.BCEList['gamepad_y'] !== 0) Input.gamepadMapper[3] = 'gamepad_y';
        Line 929: if (Yanfly.Param.BCEList['gamepad_up'] !== 0) Input.gamepadMapper[12] = 'gamepad_up';
        Line 930: if (Yanfly.Param.BCEList['gamepad_down'] !== 0) Input.gamepadMapper[13] = 'gamepad_down';
        Line 931: if (Yanfly.Param.BCEList['gamepad_left'] !== 0) Input.gamepadMapper[14] = 'gamepad_left';
        Line 932: if (Yanfly.Param.BCEList['gamepad_right'] !== 0) Input.gamepadMapper[15] = 'gamepad_right';
      H:\Damocles Legacy\js\rpg_core.js (1 hit)
        Line 3062: Input.gamepadMapper = {
  3. Social_Knight said:
    Looking for prototype.terminate with a NotePad ++ Mass search for that lands me at Gimmer's Core, where he creates a section that allows Common Event Callbacks. Since the only plugin of his I use is one that alters messages I figured I'd try to mass comment out that section, but that had no effect, so I re-engaged it (I load his Core before your Book anyways, so I didn't think it was that). Still here's that code anyways:
    Code:
    //Support for common events to have callbacks
    var Gimmer_Core_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        Gimmer_Core_Interpreter_pluginCommand.call(this, command, args)
        command = command.toUpperCase();
        args = Gimmer_Core.compressArgs(args);
        if(command in Gimmer_Core.pluginCommands){
            return Gimmer_Core.pluginCommands[command](args);
        }
    };
    
    Gimmer_Core.compressArgs = function(args){
        if(!args){
            args = [];
        }
    
        let returnArgs = [];
    
        let textArg = [];
        for(let i=0;i<args.length;i++){
            if(args[i][0] === '"'){
                if(args[i][args[i].length -1] === '"'){
                    returnArgs.push(args[i].replace('"',"").replace('"',""));
                }
                else{
                    textArg.push(args[i].replace('"',""));
                }
    
            }
            else if(args[i][args[i].length -1] === '"'){
                textArg.push(args[i].replace('"',""));
                returnArgs.push(textArg.join(" "));
                textArg = [];
            }
            else if(textArg.length > 0){
                textArg.push(args[i]);
            }
            else{
                returnArgs.push(args[i]);
            }
        }
        return returnArgs;
    }
    
    Gimmer_Core.pluginCommands['FADEINBGM'] = function(args){
        let bgm = {
            name: args[1],
            volume: parseInt(args[2]),
            pitch: parseInt(args[3]),
            pan: parseInt(args[4]),
            pos: parseInt(args[5]) || 0
        }
    
        AudioManager.playBgm(bgm, bgm.pos);
        AudioManager.fadeInBgm(parseInt(args[0]));
    }
    
    Gimmer_Core.reserveCommonEventWithCallback = function(commentEventId, callback){
        Gimmer_Core.pendingCallbacks[commentEventId.toString()] = callback;
        $gameTemp.reserveCommonEvent(commentEventId);
    }
    
    Gimmer_Core.Game_Interpreter_prototype_setupReservedCommonEvent = Game_Interpreter.prototype.setupReservedCommonEvent;
    Game_Interpreter.prototype.setupReservedCommonEvent = function() {
        if ($gameTemp.isCommonEventReserved()) {
            this._commonEventId = $gameTemp.reservedCommonEvent().id;
        }
        return Gimmer_Core.Game_Interpreter_prototype_setupReservedCommonEvent.call(this);
    };
    
    Game_Interpreter.prototype.initialize()
    Gimmer_Core.Game_Interpreter_prototype_initialize = Game_Interpreter.prototype.initialize;
    Game_Interpreter.prototype.initialize = function(depth) {
        Gimmer_Core.Game_Interpreter_prototype_initialize.call(this, depth);
        this._commonEventId = -1;
    }
    
    Gimmer_Core.Game_Interpreter_prototype_terminate = Game_Interpreter.prototype.terminate;
    Game_Interpreter.prototype.terminate = function() {
        if(this._commonEventId && this._commonEventId.toString() in Gimmer_Core.pendingCallbacks && typeof Gimmer_Core.pendingCallbacks[this._commonEventId.toString()] === 'function'){
            Gimmer_Core.pendingCallbacks[this._commonEventId.toString()]();
            delete Gimmer_Core.pendingCallbacks[this._commonEventId];
        }
        Gimmer_Core.Game_Interpreter_prototype_terminate.call(this);
    };
    There's of course also the original rpg.objects function, which is just
    Game_Interpreter.prototype.terminate = function () {
    this._list = null;
    this._comments = '';
    };



    As for Input.gamepadMapper, MV3D adds in the shoulder buttons as standard inputs for controllers and defaults them to Look Up/Look Down and the lower shoulders to Strafe Left/Right. I also add this to Yanfly's GamePadConfig (for the options menu).

    I do also have Yanfly's Common Button Events and WolfPad, but both are disabled at the moment. Obviously, YEP Common Events doesn't do controller. WolfPad makes the controller sensitivity better and increases compatibility with more controller types though not sure if I'm using it yet as it's not hugely important

    I don't think anything huge is causing aggro here as a result, but here is the Notepad ++ search:

    Code:
    Search "Input.gamepadMapper" (25 hits in 6 files of 250 searched)
      H:\Damocles Legacy\js\plugins\Eli_ButtonCommonEvents.js (10 hits)
        Line 191:             var inputObject = Input.gamepadMapper
        Line 227:                 Input.gamepadMapper[code] = keyName
        Line 307:                 const key = Input.gamepadMapper[i]
        Line 384:         if(Input.gamepadMapper.hasOwnProperty(keyCode) && !overwrite){
        Line 385:             oldName = Input.gamepadMapper[keyCode]
        Line 386:             keyName = Input.gamepadMapper[keyCode]
        Line 389:             oldName = Input.gamepadMapper[keyCode]
        Line 390:             Input.gamepadMapper[keyCode] = keyName
        Line 436:             Input.gamepadMapper[keyCode] = oldName
        Line 438:             delete Input.gamepadMapper[keyCode]
      H:\Damocles Legacy\js\plugins\GamepadConfig.js (3 hits)
        Line 250:         if (Input.gamepadMapper[i] === type) return i;
        Line 302:     Input.gamepadMapper = this.gamepadInput;
        Line 619:     var formerConfig = Input.gamepadMapper[buttonId];
      H:\Damocles Legacy\js\plugins\mv3d.js (1 hit)
        Line 429656:     Object.assign(Input.gamepadMapper, input_mv3d.GAMEPAD_TURN_BUTTON === 1 ? {
      H:\Damocles Legacy\js\plugins\WolfPadMVZ.js (2 hits)
        Line 218:     Input.gamepadMapper = {
        Line 482:     WolfPad.maps = Object.entries(Input.gamepadMapper).reduce((maps, entry)  => {
      H:\Damocles Legacy\js\plugins\YEP_ButtonCommonEvents.js (8 hits)
        Line 925: if (Yanfly.Param.BCEList['gamepad_a'] !== 0) Input.gamepadMapper[0] = 'gamepad_a';
        Line 926: if (Yanfly.Param.BCEList['gamepad_b'] !== 0) Input.gamepadMapper[1] = 'gamepad_b';
        Line 927: if (Yanfly.Param.BCEList['gamepad_x'] !== 0) Input.gamepadMapper[2] = 'gamepad_x';
        Line 928: if (Yanfly.Param.BCEList['gamepad_y'] !== 0) Input.gamepadMapper[3] = 'gamepad_y';
        Line 929: if (Yanfly.Param.BCEList['gamepad_up'] !== 0) Input.gamepadMapper[12] = 'gamepad_up';
        Line 930: if (Yanfly.Param.BCEList['gamepad_down'] !== 0) Input.gamepadMapper[13] = 'gamepad_down';
        Line 931: if (Yanfly.Param.BCEList['gamepad_left'] !== 0) Input.gamepadMapper[14] = 'gamepad_left';
        Line 932: if (Yanfly.Param.BCEList['gamepad_right'] !== 0) Input.gamepadMapper[15] = 'gamepad_right';
      H:\Damocles Legacy\js\rpg_core.js (1 hit)
        Line 3062: Input.gamepadMapper = {
    I appreciate the explanation. But on these cases you will need to try the boring way: Deactivate one plugin, test again and see if it is working, and keep repeating the process until my plugin work. The last one you deactivated, is the one causing the compatibility.
    You can upload a sample project for me replicating the issue so I can take a look too. But I don't know when I will have time.