Help for my custom window

Hi guys,

I search to create a command to go a next or previous actor, see below :

Spoiler
rpgweb.png

As you can see, in the left side on top, I have create a window. When we click on, the status window change for the next actor.
But my problem is that, I don't know wich code used for see the next actor or previous in my window, see my code below :

Spoiler
Code:
function Window_FaceNext() {
    this.initialize.apply(this, arguments);
}

Window_FaceNext.prototype = Object.create(Window_Command.prototype);
Window_FaceNext.prototype.constructor = Window_FaceNext;

Window_FaceNext.prototype.initialize = function(x, y, width, height) {
    this._windowWidth = width;
    this._windowHeight = height;
    Window_Command.prototype.initialize.call(this, x, y);
    this.refresh();
    this.activate();
};

Window_FaceNext.prototype.windowWidth = function() {
    return this._windowWidth;
};

Window_FaceNext.prototype.windowHeight = function() {
    return this._windowHeight;
};

Window_FaceNext.prototype.standardPadding = function() {
    return 0;
};

Window_FaceNext.prototype.lineHeight = function() {
    return this.windowHeight();
};

Window_FaceNext.prototype.makeCommandList = function() {
    this.addCommand("Before", 'before', true);
};

Window_FaceNext.prototype.processOk = function() {
        if (this.isCurrentItemEnabled()) {
        this.updateInputData();
        this.callOkHandler();
    } else {
        this.playBuzzerSound();
    }
};

Window_FaceNext.prototype.setActor = function(actor) {
    if (this._actor !== actor) {
        this._actor = actor;
        this.refresh();
    }
};

Window_FaceNext.prototype.refresh = function() {
    this.contents.clear();
    if (this._actor) {
        var lineHeight = this.lineHeight();
        var actor = this._actor;
        this.drawActorFace(actor, 0, 0, 144, 144);
    }
};

I think my error is somewhere there, I shouldn't use "this._actor" but something else...

Anybody can help me ?
I think iknwo what your trying to do.

As far as i know in the Status Screen pressing Page Up or Page Down will cause the screen to go to the next or previous actor.
The screen knows which actor becuase it refers to $gameParty.menuActor();
when you press those keys, $gameParty.makeMenuActorNext(); and $gameParty.makeMenuActorPrevious(); gets called, they changed the return value of the first function.

from here you can look at those two function and use them to calculate the next and previous actors ID then retreive them from $gameParty. we can't use $gameParty.makeMenuActorNext(); because this will hcange the current actor. heres the code on those two.
Spoiler
Code:
/**
 * changes to the next Menu Actor
 */
Game_Party.prototype.makeMenuActorNext = function() {
    var index = this.members().indexOf(this.menuActor());
    if (index >= 0) {
        index = (index + 1) % this.members().length;
        this.setMenuActor(this.members()[index]);
    } else {
        this.setMenuActor(this.members()[0]);
    }
};

/**
 * changes to the previous Menu Actor
 */
Game_Party.prototype.makeMenuActorPrevious = function() {
    var index = this.members().indexOf(this.menuActor());
    if (index >= 0) {
        index = (index + this.members().length - 1) % this.members().length;
        this.setMenuActor(this.members()[index]);
    } else {
        this.setMenuActor(this.members()[0]);
    }
};

As you can see in both functions it first finds the index of $gameParty.menuActor() using IndexOf. then uses some calculations to find the next one. the % operator is the modulas operator, despite its name it actually gets the remainder after division. its used here to make the the index "wrap around".
e.g
3 % 2 == 1
124 % 70 == 54
32 % 31 == 1

Original thread: https://forums.rpgmakerweb.com/threads/help-for-my-custom-window.83805/