Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- # Script Disabler v1.0.0
- # FenixFyreX
- # RPG Maker XP, VX, and VXAce
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- # This script allows the user to disable scripts by id; more specifically, the
- # ScriptsToDisable array below includes scripts to disable at runtime that need
- # to be disabled so as to debug a project without actually deleting the script.
- #
- # This script needs to be placed ABOVE ALL CUSTOM SCRIPTS to function; it does
- # not work if it isn't the VERY first custom script installed.
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- # CONFIG
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- # These are ids, starting from 0, which are placed immediately AFTER the script
- # entry Scene_Gameover, so Scene_Gameover is -1, the one after is 0, and so on.
- # This will ignore the Main script (you can't disable it).
- ScriptsToDisable = []
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- # PLEASE DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING.
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- # For The Curious Scripter - How It Works
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- # RPG Maker's internals call eval() to execute the scripts in the database; thus
- # I've overriden it to ignore eval'ing the script should it's index be found in
- # the config below. It "undefines" my alias to eval when the Main script is
- # reached.
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- GameOverIndex = $RGSS_SCRIPTS.index($RGSS_SCRIPTS.find {|a| a[1] == "Scene_GameOver" })
- binding = self
- alias eval_disable_alot_of_scripts eval
- def eval(code, *argv)
- if code.is_a?(String) && $RGSS_SCRIPTS.any? {|a| a[3] == code }
- if code.include?("rgss_main { SceneManager.run }")
- eval("def eval(*argv); eval_disable_alot_of_scripts(*argv); end", binding)
- else
- index = $RGSS_SCRIPTS.index($RGSS_SCRIPTS.find {|s| s[3] == code })
- if ScriptsToDisable.include?(index - GameOverIndex)
- code = ""
- end
- end
- end
- eval_ex(code, *argv)
- end
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
- # END SCRIPT
- #×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
RAW Paste Data