Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*:
- * JumpToLabel by Shaz
- * Ver 1.00 2018.01.14
- * Shaz_JumpToLabel.js
- *
- *
- * @plugindesc More flexible Jump to Label command.
- * @author Shaz
- *
- * @param Ignore Case
- * @desc Ignore case when searching for label.
- * @type boolean
- * @default true
- *
- * @help This plugin allows you to use dynamic Jump to Label commands, where
- * the 'destination' is a formula.
- *
- * Plugin Commands:
- * JumpToLabel dest
- *
- * Example:
- * JumpToLabel this._mapId
- * JumpToLabel $gameVariables.value(7)
- * JumpToLabel 'Talk to ' + $gameParty.leader().name()
- *
- *
- * NOTE:
- * If the label cannot be found in the current event, it will continue
- * processing following the JumpToLabel plugin command. It may be wise to
- * add an Exit Event Processing command afterwards.
- *
- */
- var Imported = Imported || {};
- Imported.Shaz_JumpToLabel = true;
- var Shaz = Shaz || {};
- Shaz.JL = Shaz.JL || {};
- Shaz.JL.Version = 1.00;
- Shaz.Parameters = PluginManager.parameters('Shaz_JumpToLabel');
- Shaz.Param = Shaz.Param || {};
- Shaz.Param.JL = Shaz.Param.JL || {};
- Shaz.Param.JL.IgnoreCase = eval(Shaz.Parameters['Ignore Case']);
- (function() {
- var _Shaz_JL_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
- Game_Interpreter.prototype.pluginCommand = function(command, args) {
- switch(command.toUpperCase()) {
- case 'JUMPTOLABEL':
- var labelName = eval(args.join(' '));
- for (var i = 0; i < this._list.length; i++) {
- var command = this._list[i];
- if (command.code === 118 && (command.parameters[0] === labelName || (Shaz.Param.JL.IgnoreCase && String(command.parameters[0]).toUpperCase() === String(labelName).toUpperCase()))) {
- this.jumpTo(i);
- return;
- }
- }
- break;
- default:
- _Shaz_JL_Game_Interpreter_pluginCommand.call(this, command, args);
- }
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement