MV How to use the left/rightArrowVisible, they don't exist as functions. But they exist as pictures

So essentially exactly what the title says. I want to place these arrows at the edges of my window.
I think I could be able to create the functions for doing this by looking over the up and down arrows. But I am just confused, since if they are in the pictures... shouldn't there already be a function I can use?
1635162259865.png


Best regards,
Bishiba
drawRightArrow does exist, but it doesn't use the windowskin. It's for drawing the "comparison" arrow on the equip menu. Although there are left and right arrows on the graphic, there don't appear to be any functions that draw them. However, I had a similar need, so here:

JavaScript:
Window.prototype.drawLeftArrow = function(x, y, enabled) {
    this.changePaintOpacity(enabled);
    var bmp = this._windowskin;
    this.contents.blt(bmp, 96 + 24, 24 + 12, 12, 24, x, y);
    this.changePaintOpacity(true);
};

Window.prototype.drawRightArrow = function(x, y, enabled) {
    this.changePaintOpacity(enabled);
    var bmp = this._windowskin;
    this.contents.blt(bmp, 96 + 24 + 12 + 24, 24 + 12, 12, 24, x, y);
    this.changePaintOpacity(true);
};

You don't actually need "enabled" as a parameter, I only had that because I had to change the appearance of the arrow if you couldn't hit left/right.
drawRightArrow does exist, but it doesn't use the windowskin. It's for drawing the "comparison" arrow on the equip menu. Although there are left and right arrows on the graphic, there don't appear to be any functions that draw them. However, I had a similar need, so here:

JavaScript:
Window.prototype.drawLeftArrow = function(x, y, enabled) {
    this.changePaintOpacity(enabled);
    var bmp = this._windowskin;
    this.contents.blt(bmp, 96 + 24, 24 + 12, 12, 24, x, y);
    this.changePaintOpacity(true);
};

Window.prototype.drawRightArrow = function(x, y, enabled) {
    this.changePaintOpacity(enabled);
    var bmp = this._windowskin;
    this.contents.blt(bmp, 96 + 24 + 12 + 24, 24 + 12, 12, 24, x, y);
    this.changePaintOpacity(true);
};

You don't actually need "enabled" as a parameter, I only had that because I had to change the appearance of the arrow if you couldn't hit left/right.
Thanks!
It is perfect, I made some slight changes, primarily for ease of access. You don't need to assign x or y values now and they'll go kinda where you'd expect. And I did deactivate the opacity change. I'll reactivate it if the situation occurs where it is needed 🙂
JavaScript:
Window.prototype.drawLeftArrow = function(x, y, enabled) {
    x = x || 0; //If x is undefined, sets it to the left edge of the window.
    y = y || this.contents.height / 2 - 12; //If y is undefined, sets it to center of window.
    //this.changePaintOpacity(enabled);
    var bmp = this._windowskin;
    this.contents.blt(bmp, 96 + 24, 24 + 12, 12, 24, x, y);
    this.changePaintOpacity(true);
};

Window.prototype.drawRightArrow = function(x, y, enabled) {
    x = x || this.contents.width - 12; //If x is undefined, sets it to the right edge of the window.
    y = y || this.contents.height / 2 - 12; //If y is undefined, sets it to center of window.
    //this.changePaintOpacity(enabled);
    var bmp = this._windowskin;
    this.contents.blt(bmp, 96 + 24 + 12 + 24, 24 + 12, 12, 24, x, y);
    this.changePaintOpacity(true);
};
I am curious, how do I bypass the safe area? The arrows should preferably be touching the edges, or be one or two pixels away from them. But at the moment they are a bit far away.
1635208756490.png
Hi,

I've been toying with windows and found this method in "rpg_windows.js".

JavaScript:
//Just rename Window_Base to the class name of your HUD window
Window_Base.prototype.standardPadding = function() {
    return 18; //smaller number means you can draw nearer the window border.
};

Overriding this method in your defined custom class window can allow you to decrease the "safe area" to extend to the edges. The problem is that this means that your face graphic and HP bar will then extend to the edges too, which means you'll want to add a margin to keep them positioned as they currently are.
It's because you're painting them onto the contents bitmap. Instead I would consider making the arrows separate child sprites of the window, like the up/down arrows (cf rpg_core.js). E.g. (untested):
Spoiler: click to see code
JavaScript:
(function(alias) {
  Window.prototype.createAllParts = function() {
    alias.apply(this, arguments);
    this._leftArrowSprite = new Sprite();
    this._rightArrowSprite = new Sprite();
    this.addChild(this._leftArrowSprite);
    this.addChild(this._rightArrowSprite);
  };
})(Window.prototype.createAllParts);

(function(alias) {
  Window.prototype._refreshArrows = function() {
    alias.apply(this, arguments);
    var w = this._width;
    var h = this._height;
    var p = 24;
    var q = p/2;
    this._leftArrowSprite.bitmap = this._windowskin;
    this._leftArrowSprite.anchor.x = 0.5;
    this._leftArrowSprite.anchor.y = 0.5;
    this._leftArrowSprite.setFrame(96 + 24, 24 + 12, 12, 24);   // source x, y, w, h
    this._leftArrowSprite.move(q, h/2);   // target x, y
    this._rightArrowSprite.bitmap = this._windowskin;
    this._rightArrowSprite.bitmap.anchor.x = 0.5;
    this._rightArrowSprite.bitmap.anchor.y = 0.5;
    this._rightArrowSprite.setFrame(96 + 24 + 12 + 24, 24 + 12, 12, 24);
    this._rightArrowSprite.move(w-q, h/2);
  };
})(Window.prototype._refreshArrows);

(function(alias) {
  Window.prototype._updateArrows = function() {
    alias.apply(this, arguments);
    this._leftArrowSprite.visible = this.isOpen() && this.leftArrowVisible;
    this._rightArrowSprite.visible = this.isOpen() && this.rightArrowVisible;
  };
})(Window.prototype._updateArrows);

(function(alias) {
  Window.prototype.initialize = function() {
    alias.apply(this, arguments);
    this.leftArrowVisible = false;
    this.rightArrowVisible = false;
  };
})(Window.prototype.initialize);
I just copied the windowskin coordinates directly from Trihan's post, and followed the core scripts for the rest. Feel free to use/modify it as you like~

You'd need to add some extra code to set the leftArrowVisible and rightArrowVisible properties when appropriate. You'd also need to manually code the left/right functionality for your window(s).
Hi,

I've been toying with windows and found this method in "rpg_windows.js".

JavaScript:
//Just rename Window_Base to the class name of your HUD window
Window_Base.prototype.standardPadding = function() {
    return 18; //smaller number means you can draw nearer the window border.
};

Overriding this method in your defined custom class window can allow you to decrease the "safe area" to extend to the edges. The problem is that this means that your face graphic and HP bar will then extend to the edges too, which means you'll want to add a margin to keep them positioned as they currently are.
Thank you, this works flawlessly! 🙂

It's because you're painting them onto the contents bitmap. Instead I would consider making the arrows separate child sprites of the window, like the up/down arrows (cf rpg_core.js). E.g. (untested):
Spoiler: click to see code
JavaScript:
(function(alias) {
  Window.prototype.createAllParts = function() {
    alias.apply(this, arguments);
    this._leftArrowSprite = new Sprite();
    this._rightArrowSprite = new Sprite();
    this.addChild(this._leftArrowSprite);
    this.addChild(this._rightArrowSprite);
  };
})(Window.prototype.createAllParts);

(function(alias) {
  Window.prototype._refreshArrows = function() {
    alias.apply(this, arguments);
    var w = this._width;
    var h = this._height;
    var p = 24;
    var q = p/2;
    this._leftArrowSprite.bitmap = this._windowskin;
    this._leftArrowSprite.anchor.x = 0.5;
    this._leftArrowSprite.anchor.y = 0.5;
    this._leftArrowSprite.setFrame(96 + 24, 24 + 12, 12, 24);   // source x, y, w, h
    this._leftArrowSprite.move(q, h/2);   // target x, y
    this._rightArrowSprite.bitmap = this._windowskin;
    this._rightArrowSprite.bitmap.anchor.x = 0.5;
    this._rightArrowSprite.bitmap.anchor.y = 0.5;
    this._rightArrowSprite.setFrame(96 + 24 + 12 + 24, 24 + 12, 12, 24);
    this._rightArrowSprite.move(w-q, h/2);
  };
})(Window.prototype._refreshArrows);

(function(alias) {
  Window.prototype._updateArrows = function() {
    alias.apply(this, arguments);
    this._leftArrowSprite.visible = this.isOpen() && this.leftArrowVisible;
    this._rightArrowSprite.visible = this.isOpen() && this.rightArrowVisible;
  };
})(Window.prototype._updateArrows);

(function(alias) {
  Window.prototype.initialize = function() {
    alias.apply(this, arguments);
    this.leftArrowVisible = false;
    this.rightArrowVisible = false;
  };
})(Window.prototype.initialize);
I just copied the windowskin coordinates directly from Trihan's post, and followed the core scripts for the rest. Feel free to use/modify it as you like~

You'd need to add some extra code to set the leftArrowVisible and rightArrowVisible properties when appropriate. You'd also need to manually code the left/right functionality for your window(s).
Thank you!
Sadly, it prompts me with the error below.
TypeError: Cannot set property 'bitmap' of undefined

I might put time on this part later, but it doesn't affect the plugin functionality and since @autodidact's advice worked I am very happy with it! 🙂

Thanks again though! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-use-the-left-rightarrowvisible-they-dont-exist-as-functions-but-they-exist-as-pictures.141522/