Refresh text variables
This commit is contained in:
parent
148d70cab2
commit
d0a6d40534
2 changed files with 70 additions and 0 deletions
|
|
@ -2537,4 +2537,10 @@ var $plugins = [
|
|||
pauseAtBottom: "120",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "RefreshTextVariables",
|
||||
status: true,
|
||||
description: "Adds F9 keybind to refresh text variables with updated translations",
|
||||
parameters: {},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
64
js/plugins/RefreshTextVariables.js
Normal file
64
js/plugins/RefreshTextVariables.js
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
//=============================================================================
|
||||
// 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();
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
Loading…
Reference in a new issue