MV EnemyBook.js - How to always select the last Enemy on the list?

I'm using the Enemy Book plugin that comes with MV, but I wanted to modify which monster is selected when opening the book.
I wanted it to always select the last available enemy on the list.

Little explanation: the battle encounters will follow the order of the Enemies database, and before each battle the player can read about the enemy they're about to face, which will be on the bottom of the list once added to it. That's why I need to select the last index available, so the player is taken straight to it.

There's this part in the code:
JavaScript:
function Window_EnemyBookIndex() {
        this.initialize.apply(this, arguments);
    }

    Window_EnemyBookIndex.prototype = Object.create(Window_Selectable.prototype);
    Window_EnemyBookIndex.prototype.constructor = Window_EnemyBookIndex;

    Window_EnemyBookIndex.lastTopRow = 0;
    Window_EnemyBookIndex.lastIndex  = 0;

    Window_EnemyBookIndex.prototype.initialize = function(x, y) {
        var width = Graphics.boxWidth;
        var height = this.fittingHeight(1);
        Window_Selectable.prototype.initialize.call(this, x, y, width / 2, height / 2);
        this.refresh();
        this.setTopRow(Window_EnemyBookIndex.lastTopRow);
        this.select(Window_EnemyBookIndex.lastIndex);
        this.activate();
    };

I guess I could tie "this.select" to a variable, but I'd rather not... if possible. Please... :blush:
what if there are 2 enemies added? as last index isn't useful,
as its best to start from the top if they close and re-enter it.

if you always want it to be the last index, than you need to change
this line: Window_EnemyBookIndex.lastIndex = 0; and change 0 to
$gameVariable.value(x); X being the number.

inside the game, you initilize this variable to be the last killed troopMember ID.
so whatever that number will be will be selected in the editor.

for grabbing the troopID killed (if not escaped) and IF its a new entree,
than it needs something different and on a different spot.

Original thread: https://forums.rpgmakerweb.com/threads/enemybook-js-how-to-always-select-the-last-enemy-on-the-list.178806/