OrangeNoteTagtoSwitch

Hi Guys,


What this enables you to do is turn on switch(es) by notetags in a map.


I have put the notetag on the test map, the switch doesn't turn on when the notetag is present, even though it's supposed to turn on...?


the .js

Spoiler
Skip to content
Personal Open source Business Explore
Sign upSign inPricingBlogSupport
This repository
Search
 Watch 12  Star 23  Fork 5 Hudell/mv-plugins
 Code  Issues 4  Pull requests 0  Pulse  Graphs
Branch: master Find file Copy pathmv-plugins/OrangeNoteTagToSwitch.js
5fedb97  on Nov 20, 2015
@Hudell Hudell NoteTag - update when event ends
1 contributor
RawBlameHistory     139 lines (122 sloc)  4.7 KB
/*=============================================================================
 * Orange - Notetag to Switch
 * By Hudell - www.hudell.com
 * OrangeNoteTagToSwitch.js
 * Version: 1.2
 * Free for commercial and non commercial use.
 *=============================================================================*/
 /*:
 * @plugindesc Allow you to automatically turn on a switch everytime a notetag is found on a map - OrangeNoteTagToSwitch
 * @author Hudell
 *
 * @param switchId
 * @desc The number of the switch to activate when the notetag is found
 * @default 0
 *
 * @param notetag
 * @desc The name of the notetag to look for on the maps notes
 * @default 0
 *
 * @param noteList
 * @desc Configure several notes with a single plugin using this param
 * @default 
 *
 * @help
 * Add the <notetag> on the notes of the maps that you want to tag.
 *
 * This plugin can be added multiple times to the same project
 * (just make a copy of the file and add it)
 *
 * ============================================================================
 * Latest Version
 * ============================================================================
 * 
 * Get the latest version of this script on
 * http://hudell.com
 * 
 *=============================================================================*/
var Imported = Imported || {};
if (Imported["OrangeNoteTagToSwitch"] === undefined) {
  (function() {
    "use strict";


    var getProp = undefined;
    if (Imported["MVCommons"] !== undefined) {
      getProp = MVC.getProp;
    } else {
      getProp = function (meta, propName){ if (meta === undefined) return undefined; if (meta[propName] !== undefined) return meta[propName]; for (var key in meta) { if (key.toLowerCase() == propName.toLowerCase()) { return meta[key]; } } return undefined; };
    }


    var paramList = [];


    function updateParamList(){
      for (var i = 0; i < $plugins.length; i++) {
        if ($plugins.description.indexOf('OrangeNoteTagToSwitch') >= 0) {

          var switchId = Number($plugins
.parameters['switchId'] || 0);

          var notetagName = $plugins
.parameters['notetag'] || '';





          if (switchId > 0 && notetagName.trim().length > 0) {


            paramList.push({


              switchId : switchId,


              notetagName : notetagName


            });


          }





          var list = $plugins
.parameters['noteList'];

          if (list !== undefined) {


            var re = /<([^<>:]+)🙁[^>]*)>/g;





            while(true) {


              var match = re.exec(list);


              if (match) {


                notetagName = match[1];


                switchId = Number(match[2] || 0);





                if (switchId > 0 && notetagName.trim().length > 0) {


                  paramList.push({


                    switchId : switchId,


                    notetagName : notetagName


                  });


                }


              } else {


                break;


              }


            }


          }          


        }


      }


    }





    updateParamList();





    if (paramList.length > 0) {


      var updateSwitchList = function() {


        if (SceneManager._scene instanceof Scene_Map) {


          for (var i = 0; i < paramList.length; i++) {


            var value = undefined;





            if ($gameMap._interpreter.isRunning() && $gameMap._interpreter._eventId > 0) {


              var eventData = $dataMap.events[$gameMap._interpreter._eventId];


              if (eventData) {


                value = getProp(eventData.meta, paramList
.notetagName);

              }


            }





            if (value === undefined) {


              value = getProp($dataMap.meta, paramList
.notetagName) === true;

            }





            $gameSwitches.setValue(paramList
.switchId, value);

          }


        }


      };





      var oldGameInterpreter_setup = Game_Interpreter.prototype.setup;


      Game_Interpreter.prototype.setup = function(list, eventId) {


        oldGameInterpreter_setup.call(this, list, eventId);


        updateSwitchList();


      };





      var oldGameInterpreter_terminate = Game_Interpreter.prototype.terminate;


      Game_Interpreter.prototype.terminate = function(list, eventId) {


        oldGameInterpreter_terminate.call(this, list, eventId);


        updateSwitchList();


      };





      var oldGamePlayer_performTransfer = Game_Player.prototype.performTransfer;


      Game_Player.prototype.performTransfer = function() {


        var shouldUpdateSwitchList = this.isTransferring();





        oldGamePlayer_performTransfer.call(this);


        if (shouldUpdateSwitchList) {


          updateSwitchList();


        }


      };


    }


  })();





  Imported["OrangeNoteTagToSwitch"] = 1.2;


}


Contact GitHub API Training Shop Blog About


© 2016 GitHub, Inc. Terms Privacy Security Status Help






I'm going to assume with the fact that there's github's website content in there that your plugin isn't working. You didn't download the file correctly. You need to click the "Raw" button on github's to get just the code, or download just the file, not the web page. 


You can confirm this by pressing F8 with the game open to see the console, which will probably have an error in that plugin that prevents it from loading. 

Original thread: https://forums.rpgmakerweb.com/threads/orangenotetagtoswitch.67293/