the error says "cannot read property "bitmap" of undefined"
//=============================================================================
// CustomTextPositionPlugin.js
//=============================================================================
/*:
* @plugindesc Allows you to adjust the position of custom text in the menu.
*
* @param Custom Text
* @desc The initial text to display when the custom option is selected.
* @default Hello from your custom menu option!
*
* @param Text X Position
* @desc The X coordinate for the custom text.
* @default 100
*
* @param Text Y Position
* @desc The Y coordinate for the custom text.
* @default 200
*
* @help
* This plugin allows you to display custom text at specific X and Y positions
* in the menu without interfering with other elements.
*
* Plugin Commands:
* - ChangeCustomText [newText]
* Example: ChangeCustomText New message here!
* Changes the custom text to the specified [newText].
*/
(function() {
var parameters = PluginManager.parameters('CustomTextPositionPlugin');
var customText = String(parameters['Custom Text'] || 'Hello from your custom menu option!');
var textX = Number(parameters['Text X Position'] || 100);
var textY = Number(parameters['Text Y Position'] || 200);
// Add the custom text to the menu scene
var _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
_Scene_Menu_create.call(this);
this.createCustomText();
};
Scene_Menu.prototype.createCustomText = function() {
this._customTextSprite = new Sprite();
this._customTextSprite.bitmap = new Bitmap(200, 48); // Adjust dimensions as needed
this._customTextSprite.bitmap.drawText(customText, 0, 0, 200, 48, 'left');
this._customTextSprite.x = textX;
this._customTextSprite.y = textY;
this.addChild(this._customTextSprite);
};
// Plugin command to change the custom text
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'ChangeCustomText') {
customText = args.join(' ');
this._customTextSprite.bitmap.clear();
this._customTextSprite.bitmap.drawText(customText, 0, 0, 200, 48, 'left');
}
};
})();