MV Targeting the two middle rows in Yanfly's Row Formation Plugin

I have 4 rows. I'd like to be able to only target the enemies in either row 2 or row 3 and not the enemies in row 1 or row 4.

I tried using this code in my skill:

<Custom Target Eval> targets=$gameTroop.filter(battler => battler.row()==2 || battler.row()==3); </Custom Target Eval>

But I'm still able to select the enemies in rows 1 and 4.

Thanks for any help and have a great day!
$gameTroop is not an array, so you can't use filter() on it.

If you anticipate wanting to continue doing some more advanced stuff with notetags code, you might want to check out some JavaScript tutorials - I like this one, but you can find lots on Google. A lot of your code has the right idea but with some small fundamental errors.

It should work correctly if you do:
Code:
targets=$gameTroop.aliveMembers().filter(battler => battler.row()==2 || battler.row()==3);[/ICODE]
Target and selection are two different things. And two different Yanfly plugins.
<Select Conditions> is what you want.
JavaScript:
if (target.row() === 1 || 3) condition = true
Use === and not ==. Future you says thanks.

edit: Also I assume you want to do this with script and not plugin commands because there is plugin commands for this.

Original thread: https://forums.rpgmakerweb.com/threads/targeting-the-two-middle-rows-in-yanflys-row-formation-plugin.154184/