64 lines
2 KiB
JavaScript
64 lines
2 KiB
JavaScript
//=============================================================================
|
|
// RefreshTextVariables.js
|
|
//=============================================================================
|
|
|
|
/*:
|
|
* @target MZ
|
|
* @plugindesc Adds F9 keybind to refresh text variables with updated translations
|
|
* @author DazedTranslations
|
|
*
|
|
* @help RefreshTextVariables.js
|
|
*
|
|
* Press F9 at any time to refresh text variables to use updated translations.
|
|
* This is useful after updating translation files with old save data.
|
|
*
|
|
* The plugin calls Common Event 112 which handles all variable refreshing.
|
|
*/
|
|
|
|
(() => {
|
|
'use strict';
|
|
|
|
// Function to refresh all text variables by calling Common Event 112
|
|
function refreshTextVariables() {
|
|
$gameTemp.reserveCommonEvent(112);
|
|
console.log("Text variables refreshed! (Common Event 112 called)");
|
|
}
|
|
|
|
// Store the original Scene_Map update method
|
|
const _Scene_Map_update = Scene_Map.prototype.update;
|
|
|
|
// Override Scene_Map update to check for F9 key press
|
|
Scene_Map.prototype.update = function() {
|
|
_Scene_Map_update.call(this);
|
|
|
|
// Check if F9 is pressed (keyCode 120 = "debug")
|
|
if (Input.isTriggered("debug")) {
|
|
refreshTextVariables();
|
|
}
|
|
};
|
|
|
|
// Also add to Scene_Menu for menu access
|
|
const _Scene_Menu_update = Scene_Menu.prototype.update;
|
|
|
|
Scene_Menu.prototype.update = function() {
|
|
_Scene_Menu_update.call(this);
|
|
|
|
// Check if F9 is pressed
|
|
if (Input.isTriggered("debug")) {
|
|
refreshTextVariables();
|
|
}
|
|
};
|
|
|
|
// Also add to Scene_Battle for battle access
|
|
const _Scene_Battle_update = Scene_Battle.prototype.update;
|
|
|
|
Scene_Battle.prototype.update = function() {
|
|
_Scene_Battle_update.call(this);
|
|
|
|
// Check if F9 is pressed
|
|
if (Input.isTriggered("debug")) {
|
|
refreshTextVariables();
|
|
}
|
|
};
|
|
|
|
})();
|