LeTBS get active actor and enemy ID at turn start

Dear rpgmakerweb-community,

I'm using Lecode's LeTBS for my project, but I run into a big issue.
For my whole project to function I need to get the current active actor id and
when its an enemy turn the current active enemy id to be put into a variable at the start of a turn.
I'm no programmer but I think this is the code which Lecode uses to determinate who's turn it is.

BattleManagerTBS.determineTurnOrder = function () {
if (Lecode.S_TBS.turnOrderFairDistribution)
this.determineTurnOrderFair();
else
this.determineTurnOrderSimple();
};

BattleManagerTBS.determineTurnOrderSimple = function () {
var array = [];
this._turnOrder = [];
this._activeIndex = 0;

this.allPlayableEntities().forEach(function (entity) {
array.push(entity);
});
array = array.sort(function (a, b) {
return b._battler.agi - a._battler.agi;
});

this._turnOrder = array;
this._turnOrderVisual.set(this._turnOrder);
};

BattleManagerTBS.activeEntity = function () {
return this._turnOrder[this._activeIndex];
};

BattleManagerTBS.activeBattler = function () {
return this.activeEntity()._battler;
};

BattleManagerTBS.startTurn = function () {
this._actionScope = {};
this.getLayer("scopes").clear();
this.getLayer("scopes").clearSelection();
this._subPhase = "";
var entity = this.activeEntity();
entity.onTurnStart();

var battler = this.activeBattler();
this.newAction(battler, true);
LeUtilities.getScene().showStatusWindow(entity, true);

var cell = entity.getCell();
this.setCursorCell(cell);
this.cursor().show();

if (entity.playableByAI()) {
this.startAiTurn(entity);
}

this.executeEventsWhen("turn_start");
if (this.activeBattler().isActor()) {
this.executeEventsWhen("actor_turn_start");
} else {
this.executeEventsWhen("enemy_turn_start");
}
this.executeEntityEventsWhen("entity_turn_start", entity);
};

By using a script call like this, the variable always returns [object Object]:

var currentbattler = BattleManagerTBS.activeBattler();
$gameVariables.setValue(1, currentbattler)

Also, when I converted it into an integer it's always zero.

The second thing I need determinate is whether its an actor's or an enemy's turn.
I guess the following code can do that but I don't know how to use it:

if (this.activeBattler().isActor()) {
this.executeEventsWhen("actor_turn_start");
} else {
this.executeEventsWhen("enemy_turn_start");

I hope someone can help me.

Original thread: https://forums.rpgmakerweb.com/threads/letbs-get-active-actor-and-enemy-id-at-turn-start.98765/