CoffeeScript VNM snippets that don't deserve their own thread

Share snippets.
No questions allowed. Just post in the support forum if you need help.

p2mfJ44.png

Add Right Click -> Cancel to Backlog
  • Copy and Paste Template_MessageBacklog
  • Look for this line:
    Code:
    "frame": [0, 0, Graphics.width, Graphics.height]
  • Add this code below it:
    Code:
    "action": { "event": "onCancel", "name": "disposeControl", "params": 'backlog' }
p2mfJ44.png

​
Disable Skipping when Backlog is visible
  • Look for Component_GameSceneBehavior
  • Look for this line:
Code:
    updateSkipShortcut: ->
        if @object.settings.allowSkip
            if Input.keys[Input.KEY_CONTROL] == 1
                GameManager.tempSettings.skip = yes
            else if Input.keys[Input.KEY_CONTROL] == 2
                GameManager.tempSettings.skip = no
  • Replace with this one
Code:
    # Adjust logic to disable skipping when Backlog is on - Archeia
    updateSkipShortcut: ->
        # Access the control for backlog visibility
        backlogControl = gs.ObjectManager.current.objectById("backlogBox") || gs.ObjectManager.current.objectById("backlog")
    
        if backlogControl && backlogControl.visible
            # If backlog is visible, do not allow skipping
            GameManager.tempSettings.skip = no
        else if @object.settings.allowSkip
            # Process skip controls if skipping is allowed and backlog is not visible
            if Input.keys[Input.KEY_CONTROL] == 1
                GameManager.tempSettings.skip = yes
            else if Input.keys[Input.KEY_CONTROL] == 2
                GameManager.tempSettings.skip = no
​
Disable Escape Key
  • Go to Script Editor and look for: Components > Scenes > Component_GameSceneBehavior
  • Below that, make a new script and add the following code: (Do not use this when using the latest version of VNM, or the deployed version will break)
Spoiler
Code:
# ===================================================================
#
#   Script: Component_GameSceneBehavior
#
#   $$COPYRIGHT$$
#
# ===================================================================
class Component_CustomGameSceneBehavior extends vn.Component_GameSceneBehavior
    ###*
    * Checks for the shortcut to exit the game. By default, this is the escape-key. You
    * can override this method to change the shortcut.
    *
    * @method updateQuitShortcut
    * @protected
    ###
    updateQuitShortcut: ->
 
vn.Component_GameSceneBehavior = Component_CustomGameSceneBehavior
It should look like this:
Spoiler
upload_2018-4-25_2-30-2.png

p2mfJ44.png

​
Disable Settings Shortcut Key
  • Go to Script Editor and look for: Components > Scenes > Component_GameSceneBehavior
  • Below that, make a new script and add the following code:
Spoiler
Code:
# ===================================================================
#
#   Script: Component_GameSceneBehavior
#
#   $$COPYRIGHT$$
#
# ===================================================================
class Component_CustomGameSceneBehavior extends vn.Component_GameSceneBehavior
    ###*
    * Checks for the shortcut to open the Settings menu by Pressing A and disables it.
    * You can override this method to change the shortcut.
    *
    * @method updateSettingsShortcut
    * @protected
    ###
      updateSettingsShortcut: ->
      # Do nothing
vn.Component_GameSceneBehavior = Component_CustomGameSceneBehavior
It should look like this:
Spoiler
2018-05-04_4-34-26.png

p2mfJ44.png

Disable Settings and Quit Shortcut Keys
Spoiler
Code:
# ===================================================================
#
#   Script: Component_GameSceneBehavior
#
#   $$COPYRIGHT$$
#
# ===================================================================
class Component_CustomGameSceneBehavior extends vn.Component_GameSceneBehavior
    ###*
    * Disables shortcut keys for settings and quitting. By default these are the
    * A and ESC keys. You can override this method to change the shortcut.
    *
    * @method updateQuitShortcut
    * @protected
    ###
      updateQuitShortcut: ->
      # Do nothing
 
    ###*
    * @method updateSettingsShortcut
    * @protected
    ###
      updateSettingsShortcut: ->
      # Do nothing
vn.Component_GameSceneBehavior = Component_CustomGameSceneBehavior
It should look like this:
Spoiler
2018-05-04_4-40-49.png
I greatly appreciate this!

Original thread: https://forums.rpgmakerweb.com/threads/vnm-snippets-that-dont-deserve-their-own-thread.94488/