DoubleX RMMV Skill Hotkeys

0 Members and 1 Guest are viewing this topic.

***
Scripter
Rep:
Level 33
Changelog
Code: [Select]
*      v1.00a(GMT 0900 8-9-2017):                                           
 *      1. 1st version of this plugin finished                               

Authors
DoubleX

Credits
DoubleX(Optional)

Purpose
Lets you bind hotkeys to skills for actors outside battles, and use them to select usable skills for actors inside battles

Introduction
Code: [Select]
*    1. When the party's out of battles, an actor can bind hotkeys to his/her
 *       currently usable/unusable skills in the skill menu, unless the result
 *       of the relevant notetags indicates otherwise                         
 *       All these bindings will be saved                                     
 *    2. When the party's inside battles, an actor having nonempty hotkey slot
 *       can use hotkeys to use their corresponding usable skills directly,   
 *       unless the result of the relevant notetags indicates otherwise       

Videos
DoubleX RMMV Skill Hotkeys

Games using this plugin
None so far

Parameters
Code: [Select]
* @param isEnabled
 * @desc Sets whether this plugin will be enabled
 * It'll be the contents of a function returning a Boolean
 * @default return true;
 *
 * @param bindNotePriority
 * @desc Sets the data type priority of <bind skill hotkey: BSHX>
 * It'll be the contents of a function returning an Array of Strings
 * @default return ["states", "armors", "weapons", "classes", "actors"];
 *
 * @param useNotePriority
 * @desc Sets the data type priority of <use skill hotkey: USHX>
 * It'll be the contents of a function returning an Array of Strings
 * @default return ["states", "armors", "weapons", "classes", "actors"];
 *
 * @param bindNoteChainingRule
 * @desc Sets how to use multiple <bind skill hotkey: BSHX> notetags
 * It'll be the contents of a function returning a String
 * @default return "first";
 *
 * @param useNoteChainingRule
 * @desc Sets how to use multiple <use skill hotkey: USHX> notetags
 * It'll be the contents of a function returning a String
 * @default return "first";
 *
 * @param bindHotkeyText
 * @desc Sets the bind hotkey text for skills without hotkeys
 * It'll be the contents of a function returning a String
 * @default return "Bind Hotkey";
 *
 * @param useSkillText
 * @desc Sets the use skill text when showing the bind hotkey texts
 * It'll be the contents of a function returning a String
 * @default return "Use";
 *
 * @param unusableSkillCoverIconPath
 * @desc Sets the path of the icon masking that of unusable skills
 * It'll be the contents of a function returning a String
 * @default return "img/pictures/";
 *
 * @param unusableSkillCoverIconName
 * @desc Sets the name of the icon masking that of unusable skills
 * It'll be the contents of a function returning a String
 * @default return "UnusableSkill";
 *
 * @param unusableSkillCoverIconHue
 * @desc Sets the hue of the icon masking that of unusable skills
 * It'll be the contents of a function returning a Number
 * @default return 0;
 *
 * @param unusableSkillCoverIconSmooth
 * @desc Sets the smooth of the icon masking that of unusable skills
 * It'll be the contents of a function returning a Boolean
 * @default return true;
 *
 * @param hotkeyCmdWindowW
 * @desc Sets the width of the window for binding hotkeys to skills
 * It'll be the contents of a function returning a Number
 * @default return Window_SkillHotkeyBase.prototype.windowWidth.call(this);
 *
 * @param hotkeyCmdWindowH
 * @desc Sets the height of the window for binding hotkeys to skills
 * It'll be the contents of a function returning a Number
 * @default return Window_SkillHotkeyBase.prototype.windowHeight.call(this);
 *
 * @param hotkeyCmdWindowX
 * @desc Sets the x position of the window for binding hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 0;
 *
 * @param hotkeyCmdWindowY
 * @desc Sets the y position of the window for binding hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 0;
 *
 * @param hotkeyCmdLineH
 * @desc Sets the line height of the window for binding hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 36;
 *
 * @param hotkeyCmdFontSize
 * @desc Sets the font size of the window for binding hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 28;
 *
 * @param hotkeyCmdPadding
 * @desc Sets the standard padding of the window for binding hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 18;
 *
 * @param hotkeyCmdTextPadding
 * @desc Sets the text padding of the window for binding hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 6;
 *
 * @param hotkeyCmdBackOpacity
 * @desc Sets the back opacity of the window for binding hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 192;
 *
 * @param hotkeyCmdTranslucentOpacity
 * @desc Sets the translucent opacity of the hotkey binding window
 * It'll be the contents of a function returning a Number
 * @default return 160;
 *
 * @param hotkeyCmdSpacing
 * @desc Sets the spacing of the window for binding hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 12;
 *
 * @param hotkeyListWindowW
 * @desc Sets the width of the window listing the actor hotkey slots
 * It'll be the contents of a function returning a Number
 * @default return Graphics.boxWidth;
 *
 * @param hotkeyListWindowH
 * @desc Sets the height of the window listing the actor hotkey slots
 * It'll be the contents of a function returning a Number
 * @default return this.fittingHeight(2);
 *
 * @param hotkeyListWindowX
 * @desc Sets the x position of the window listing actor hotkey slots
 * It'll be the contents of a function returning a Number
 * @default return 0;
 *
 * @param hotkeyListWindowY
 * @desc Sets the y position of the window listing actor hotkey slots
 * It'll be the contents of a function returning a Number
 * @default return 0;
 *
 * @param hotkeyListLineH
 * @desc Sets the line height of the window listing actor hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 36;
 *
 * @param hotkeyListFontSize
 * @desc Sets the font size of the window listing actor hotkey slots
 * It'll be the contents of a function returning a Number
 * @default return 28;
 *
 * @param hotkeyListPadding
 * @desc Sets the padding of the window listing actor hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 18;
 *
 * @param hotkeyListTextPadding
 * @desc Sets the text padding of the window listing actor hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 6;
 *
 * @param hotkeyListBackOpacity
 * @desc Sets the back opacity of the window listing actor hotkeys
 * It'll be the contents of a function returning a Number
 * @default return 192;
 *
 * @param hotkeyListTranslucentOpacity
 * @desc Sets the translucent opacity of the actor hotkey list window
 * It'll be the contents of a function returning a Number
 * @default return 160;
 *
 * @param hotkeyListSpacing
 * @desc Sets the spacing of the window listing actor hotkey slots
 * It'll be the contents of a function returning a Number
 * @default return 12;
 *
 * @param hotkeyCmdListWindowW
 * @desc Sets the width of the window listing the hotkeys in battle
 * It'll be the contents of a function returning a Number
 * @default return Graphics.boxWidth;
 *
 * @param hotkeyCmdListWindowH
 * @desc Sets the height of the window listing the hotkeys in battle
 * It'll be the contents of a function returning a Number
 * @default return this.fittingHeight(2);
 *
 * @param hotkeyCmdListWindowX
 * @desc Sets the x position of the window listing hotkeys in battle
 * It'll be the contents of a function returning a Number
 * @default return 0;
 *
 * @param hotkeyCmdListWindowY
 * @desc Sets the y position of the window listing hotkeys in battle
 * It'll be the contents of a function returning a Number
 * @default return Graphics.boxHeight - this.fittingHeight(4) - this.windowHeight();
 *
 * @param hotkeyCmdListLineH
 * @desc Sets the line height of the window listing hotkeys in battle
 * It'll be the contents of a function returning a Number
 * @default return 36;
 *
 * @param hotkeyCmdListFontSize
 * @desc Sets the font size of the window listing hotkeys in battle
 * It'll be the contents of a function returning a Number
 * @default return 28;
 *
 * @param hotkeyCmdListPadding
 * @desc Sets the padding of the window listing hotkeys in battle
 * It'll be the contents of a function returning a Number
 * @default return 18;
 *
 * @param hotkeyCmdListTextPadding
 * @desc Sets the text padding of the hotkey window in battle
 * It'll be the contents of a function returning a Number
 * @default return 6;
 *
 * @param hotkeyCmdListBackOpacity
 * @desc Sets the back opacity of the hotkey window in battle
 * It'll be the contents of a function returning a Number
 * @default return 192;
 *
 * @param hotkeyCmdListTranslucentOpacity
 * @desc Sets the translucent opacity of the hotkey window in battle
 * It'll be the contents of a function returning a Number
 * @default return 160;
 *
 * @param hotkeyCmdListSpacing
 * @desc Sets the spacing of the window listing hotkeys in battle
 * It'll be the contents of a function returning a Number
 * @default return 12;

Notetags
Code: [Select]
*       Among all the same notetag types in the same data, only the 1st one 
 *       can be effective(Reference tag: NOTETAG_MONO)                       
 *       Each line can only have at most 1 notetag(Reference tag: LINE_MONO) 
 *----------------------------------------------------------------------------
 *    # Actor/Class/Weapon/Armor/State/Skill Notetags:                       
 *      Having no effective notetag means the actors can bind hotkeys         
 *      to the skills(Reference tag: DEFAULT_TRUE)                           
 *      1. <bind skill hotkey: BSHX>                                         
 *         - Sets whether the actor can bind hotkeys for the skill as the     
 *           value returned by function with name BSHX, which can only be     
 *           edited in the configuration region, which is inside this plugin 
 *           js file contents, directly                                       
 *         - E.g.:                                                           
 *           <bind skill hotkey: BSH1> will set the actor to always be able to
 *           bind the skill due to BSH1, which is the name of a function in   
 *           the configuration region, always returning true                 
 *    # Actor/Class/Weapon/Armor/State Notetags:                             
 *      Having no effective notetag means the actors can use hotkeys         
 *      1. <use skill hotkey: USHX>                                           
 *         - Sets whether the actor can use hotkeys as the value returned by 
 *           function with name USHX, which can only be edited in the         
 *           configuration region, which is inside this plugin js file       
 *           contents, directly                                               
 *         - E.g.:                                                           
 *           <use skill hotkey: USH1> will set the actor to always be able to
 *           use the skill due to USH1, which is the name of a function in the
 *           configuration region, always returning true                     

Plugin Calls
Code: [Select]
*    # Configuration manipulations                                           
 *      1. $gameSystem.skillHotkeys.params.param                             
 *         - Returns the stored value of param listed in the plugin manager or
 *           their configuration counterpart                                 
 *         - E.g.:                                                           
 *           $gameSystem.skillHotkeys.params.isEnabled will return the       
 *           contents of a function returning a Boolean indicating whether   
 *           this plugin's enabled                                           
 *      2. $gameSystem.skillHotkeys.params.param = funcContents               
 *         - Sets the stored value of param listed in the plugin manager or   
 *           their configuration counterpart as funcContents, which is the   
 *           contents of a function                                           
 *         - E.g.:                                                           
 *           $gameSystem.skillHotkeys.params.isEnabled = return false; will   
 *           set the stored value of parameter isEnabled shown on the plugin 
 *           manager or its configuration counterpart as return false;,       
 *           causing the corresponding function to always return false, thus 
 *           always disabling this plugin                                     
 *         - $gameSystem.skillHotkeys.params.param changes will be saved     
 *         - DoubleX_RMMV.Skill_Hotkeys.params.param = func, where func is the
 *           corresponding function having funcContents as its contents,     
 *           should be explicitly called immediately afterwards               
 *      3. $gameSystem.skillHotkeys.cfgs.cfg                                 
 *         - Basically the same as $gameSystem.skillHotkeys.params.param,     
 *           except that this plugin call applies to configurations found in 
 *           the configuration region only                                   
 *      4. $gameSystem.skillHotkeys.cfgs.cfg = funcContents                   
 *         - Basically the same as                                           
 *           $gameSystem.skillHotkeys.params.param = funcContents, except that
 *           this plugin call applies to configurations found in the         
 *           configuration region only                                       
 *         - DoubleX_RMMV.Skill_Hotkeys.cfgs.cfg = func, where func is the   
 *           corresponding function having funcContents as its contents,     
 *           should be explicitly called immediately afterwards               
 *      5. $gameSystem.skillHotkeys.notes.note                               
 *         - Basically the same as $gameSystem.skillHotkeys.params.param,     
 *           except that this plugin call applies to notetag values found in 
 *           the configuration region                                         
 *      6. $gameSystem.skillHotkeys.notes.note = funcContents                 
 *         - Basically the same as                                           
 *           $gameSystem.skillHotkeys.params.param = funcContents, except that
 *           this plugin call applies to notetag values found in the         
 *           configuration region                                             
 *         - DoubleX_RMMV.Skill_Hotkeys.notes.note = func, where func is the 
 *           corresponding function having funcContents as its contents,     
 *           should be explicitly called immediately afterwards               
 *    # Actor/Class/Weapon/Armor/State/Skill notetag manipulations           
 *      1. meta.skillHotkeys.canBind                                         
 *         - Returns the function name BSHX, which is a String, in           
 *           <bind skill hotkey: BSHX>                                       
 *         - E.g.:                                                           
 *           $dataStates[1].meta.skillHotkeys.canBind will return the function
 *           name BSH1, which is a String, in <bind skill hotkey: BSH1>       
 *           notetag of state with id 1                                       
 *      2. meta.skillHotkeys.canBind = BSHX                                   
 *         - Sets the <bind skill hotkey: BSHX> notetag to use the function   
 *           with name BSHX, which is a String                               
 *         - E.g.:                                                           
 *           $dataActors[2].meta.skillHotkeys.canBind = BSH1 will set the     
 *           <bind skill hotkey: BSHX> notetag of actor with id 2 to use the 
 *           function with name BSH1, with is a String                       
 *         - The function name must be one of the notetag values in the       
 *           configuration region                                             
 *         - All meta.statusBars changes can be saved if                     
 *           DoubleX RMMV Dynamic Data is used                               
 *      3. meta.skillHotkeys.canUse                                           
 *         - Basically the same as meta.skillHotkeys.canBind, except that this
 *           plugin call works with <use skill hotkey: USHX>                 
 *      4. meta.skillHotkeys.canUse = USHX                                   
 *         - Basically the same as meta.skillHotkeys.canBind = BSHX, except   
 *           that this plugin call works with <use skill hotkey: USHX>       
 *    # Actor manipulations                                                   
 *      1. bindSkillHotkey(skillId, hotkey)                                   
 *         - Binds the hotkey with symbol hotkey to the skill with id skillId
 *           for the actor involved, bypassing all <bind skill hotkey: BSHX> 
 *           notetags                                                         
 *         - E.g.:                                                           
 *           $gameParty.aliveMembers()[0].bindSkillHotkey(1, #1) will bind the
 *           hotkey with symbol #1 to the skill with id 1 for the 1st alive   
 *           party member                                                     
 *         - Don't use this plugin call when players are                     
 *           binding/using hotkeys unless you really know what you're truly   
 *           doing                                                           
 *      2. canBindSkillHotkey(skillId)                                       
 *         - Returns whether the actor involved can bind hotkeys for the skill
 *           with id skillId                                                 
 *         - E.g.:                                                           
 *           $gameParty.aliveMembers()[0].canBindSkillHotkey(1) will return   
 *           whether the 1st alive party member can bind hotkeys for the skill
 *           with id 1                                                       
 *      3. canUseSkillHotkey(skillId)                                         
 *         - Returns whether the actor involved can use the hotkey bound to   
 *           the skill with id skillId                                       
 *         - E.g.:                                                           
 *           $gameActors.actor(1).canUseSkillHotkey(1) will return whether the
 *           actor with id 1 can use the hotkey bound to the skill with id 1 
 *      4. isSkillHotkeysBound(skillId)                                       
 *         - Returns whether the actor has bound a hotkey for the skill with 
 *           id skillId                                                       
 *         - E.g.:                                                           
 *           $gameParty.aliveMembers()[$gameParty.aliveMembers().length - 1].
 *                   isSkillHotkeysBound(1) will return whether the last alive
 *           party member has bound a hotkey for the skill with id 1         
 *      5. boundSkillHotkeys(skillId)                                         
 *         - Returns the list of symbols of hotkeys bound to the skill with id
 *           skillId                                                         
 *         - E.g.:                                                           
 *           $gameParty.aliveMembers()[$gameParty.aliveMembers().length - 1].
 *                   boundSkillHotkeys(1) will return the list of symbols of 
 *           hotkeys bound to the skill with id 1                             
 *      6. hotkeys()                                                         
 *         - Returns the list of symbols of hotkeys bound to skills           
 *         - E.g.:                                                           
 *           $gameParty.aliveMembers()[$gameParty.aliveMembers().length - 1].
 *                   hotkeys() will return the list of symbols of hotkeys     
 *           bound to the skills                                             
 *      7. raiseSkillHotkeyNoteChangeFactors()                               
 *         - Notifys that all notetags might need to be reevaluated due to   
 *           potential data source changes or changes in the actor involved   
 *         - This plugin call should be called whenever there are potential   
 *           changes in the bindNoteChainingRule/useNoteChainingRule         
 *           parameter/configuration                                         
 *         - E.g.:                                                           
 *           $gameActors.actor(1).raiseSkillHotkeyNoteChangeFactors() will   
 *           notify the actor with id 1 that all notetags might need to be   
 *           reevaluated due to potential data source changes or changes in   
 *           the actor involved                                               
 *      8. skillHotkeys.hotkeyMapping                                         
 *         - Access the mapping from the hotkey symbols to the skill ids where
 *           the hotkey represented by the formers' bound to the skill       
 *           referred by the latters                                         
 *         - E.g.:                                                           
 *           $gameActors.actor(1).skillHotkeys.hotkeyMapping will access the 
 *           mapping from the hotkey symbols to the skill ids where the hotkey
 *           represented by the formers' bound to the skill referred by the   
 *           latters for the actor with id 1                                 
 *      9. skillHotkeys.noteChangeFactors[note][factor] = true               
 *         - Notifys that the notetag note might need to be reevaluated due to
 *           potential changes in factor factor                               
 *         - note is either "canBind", referring to the notetag               
 *           <bind skill hotkey: BSHX>, or 'canUse", referring to the notetag
 *           <use skill hotkey: USHX>                                         
 *         - factor is either "states", meaning the changes in state notetags,
 *           "armors", meaning the changes in armor notetags, "weapons",     
 *           meaning the changes in weapon notetags, "classes", meaning the   
 *           changes in classes notetags, "actors", meaning the changes in   
 *           actors notetags, or "priority", meaning the changes in the       
 *           bindNotePriority/useNotePriority parameter/configuration         
 *         - E.g.:                                                           
 *           $gameParty.aliveMembers()[$gameParty.aliveMembers().length - 1].
 *                   skillHotkeys. noteChangeFactors[canBind][priority] = true
 *           will notify the last alive party member that the                 
 *           <bind skill hotkey: BSHX> notetag might need to be reevaluated   
 *           due to potential changes in the bindNotePriority                 
 *           parameter/configuration                                         
 *           (The counterpart for <use skill hotkey: USHX> is useNotePriority)

Plugin Commands
Code: [Select]
*      1. bindSkillHotkey actorId skillId hotkey                             
 *         - The same as the plugin call bindSkillHotkey(skillId, hotkey) in 
 *           Actor manipulations for the actor with id actorId               
 *         - Don't use this plugin command for actors that don't exist yet   
 *           unless you really know what you're truly doing                   
 *      2. canBindSkillHotkey actorId skillId                                 
 *         - The same as the plugin call canBindSkillHotkey(skillId) in       
 *           Actor manipulations for the actor with id actorId               
 *         - Don't use this plugin command for actors that don't exist yet   
 *           unless you really know what you're truly doing                   
 *      3. canUseSkillHotkey actorId skillId                                 
 *         - The same as the plugin call canUseSkillHotkey(skillId) in       
 *           Actor manipulations for the actor with id actorId               
 *         - Don't use this plugin command for actors that don't exist yet   
 *           unless you really know what you're truly doing                   
 *      4. isSkillHotkeysBound actorId skillId                               
 *         - The same as the plugin call isSkillHotkeysBound(skillId) in     
 *           Actor manipulations for the actor with id actorId               
 *         - Don't use this plugin command for actors that don't exist yet   
 *           unless you really know what you're truly doing                   
 *      5. boundSkillHotkeys actorId skillId                                 
 *         - The same as the plugin call boundSkillHotkeys(skillId) in       
 *           Actor manipulations for the actor with id actorId               
 *         - Don't use this plugin command for actors that don't exist yet   
 *           unless you really know what you're truly doing                   
 *      6. hotkeys actorId                                                   
 *         - The same as the plugin call hotkeys() in Actor manipulations for
 *           the actor with id actorId                                       
 *         - Don't use this plugin command for actors that don't exist yet   
 *           unless you really know what you're truly doing                   
 *      7. raiseSkillHotkeyNoteChangeFactors actorId                         
 *         - The same as the plugin call raiseSkillHotkeyNoteChangeFactors() 
 *           in Actor manipulations for the actor with id actorId             
 *         - Don't use this plugin command for actors that don't exist yet   
 *           unless you really know what you're truly doing                   

Configurations
Code: [Select]
        /**
         * The this pointer refers to the actor involved
         * Sets the list of hotkeys mapped with their corresponding names
         * None of the hotkeys are supposed to be changed during the same battle
         * Using a keyboard mapping plugin, like Quasi Input, can be useful here
         * Ensure it won't return different values when binding/using hotkeys
         * unless you really know what you're truly doing
         * Potential Hotspot/Nullipotent
         * @returns {Object[String, String]} The requested hotkey-name mapping
         * @since v1.00a
         * @version v1.00a
         */
        hotkeyNames: function() {
            return {
                "#1" : "1", // Hotkey #1 with name 1
                "#2" : "2", // Hotkey #2 with name 2
                "#3" : "3", // Hotkey #3 with name 3
                "#4" : "4", // Hotkey #4 with name 4
                "#5" : "5", // Hotkey #5 with name 5
                "#6" : "6", // Hotkey #6 with name 6
                "#7" : "7", // Hotkey #7 with name 7
                "#8" : "8", // Hotkey #8 with name 8
                "#9" : "9", // Hotkey #9 with name 9
                "#0" : "0" // Hotkey #0 with name 0
            };
        } // hotkeyNames

Author Notes
Code: [Select]
*      1. DoubleX RMMV Skill Hotkeys aims to give extreme control and freedom
 *         to users by making it as flexible as I can with as little damage to
 *         user-friendliness as I can                                         

Instructions
Code: [Select]
*      1. If you want to edit configurations instead of parameters, you must
 *         open this js file to access its configuration region               
 *         Some settings, like the hotkey mappings, are only available as     
 *         configurations                                                     
 *      2. The default plugin file name is DoubleX RMMV Skill Hotkeys v100a   
 *         If you want to change that, you must edit the value of             
 *         DoubleX_RMMV.Skill_Hotkeys_File, which must be done via opening   
 *         this plugin js file directly                                       
 *      3. If you wish to use DoubleX RMMV Skill Hotkeys Unit Test, place it 
 *         right below this plugin                                           

Prerequisites
Code: [Select]
*      Abilities:                                                           
 *      1. Nothing special for most ordinary cases                           
 *      2. Little RMMV plugin development proficiency for more advanced uses 
 *      3. Some RMMV plugin development proficiency to fully utilize this     

Terms Of Use
Code: [Select]
*      1. Commercial use's always allowed and crediting me's always optional.
 *      2. You shall keep this plugin's Plugin Info part's contents intact.   
 *      3. You shalln't claim that this plugin's written by anyone other than
 *         DoubleX or my aliases. I always reserve the right to deny you from
 *         using any of my plugins anymore if you've violated this.           
 *      4. CC BY 4.0, except those conflicting with any of the above, applies
 *         to this plugin, unless you've my permissions not needing follow so.
 *      5. I always reserve the right to deny you from using this plugin     
 *         anymore if you've violated any of the above.                       

Download Link
DoubleX RMMV Skill Hotkeys
DoubleX RMMV Skill Hotkeys Unit Test