Conversion some codes RGSS3 to Javascript

Hello makers!
I would like to know how to convert the codes below RGSS3 to Javascript:
Spoiler
$game_variables[5] = ($game_party.members()[0] ? $game_party.members()[0].name : "-")
$game_variables[6] = ($game_party.members()[1] ? $game_party.members()[1].name : "-")
$game_variables[7] = ($game_party.members()[2] ? $game_party.members()[2].name : "-")
$game_variables[8] = ($game_party.members()[3] ? $game_party.members()[3].name : "-")

Spoiler
$game_variables[9] = $game_party.members()[1]

Conditions > script
Spoiler
map_skills = [
[1, 1, 12], # 1: Eric
[3, 0, 11], # 2: Nathalie
]

id = $game_variables[9].id
map = map_skills[id-1]

$game_variables[10] = map[0]
$game_variables[11] = map[1]
$game_variables[12] = map[2]

I found some pre-defined codes on this site https://kinoar.github.io/rmmv-doc-web/index.html
But as I've never used Java, I've had doubts.
If anyone can help, I appreciate it! ^^
Note you can use the Control Variables > Script option to set variables to non-integer values, too! I'm guessing you have a reason to stick to pure script calls, though, so here goes~ 😂

1) Each line is the same except for the numbers; first line:
Code:
$gameVariables.setValue(5, $gameParty.members()[0] ? $gameParty.members()[0].name() : '-');

2)
Code:
$gameVariables.setValue(9, $gameParty.members()[1]);

3) Not sure what you mean by "Conditions > script" here, but I think this ought to work:
Code:
var mapSkills = [
  [ 1,  1, 12],    // 1: Eric
  [ 3,  0, 11],    // 2: Nathalie
]

var id = $gameVariables.value(9).actorId();
var actSkills = mapSkills[id - 1];

$gameVariables.setValue(10, actSkills[0]);
$gameVariables.setValue(11, actSkills[1]);
$gameVariables.setValue(12, actSkills[2]);
Do make sure variable #9 has an actor stored in it before running this one, though, or it'll cause an error. 👋
I'll explain what I want to do so you have an idea.
It would be a SkillTree system where you take the player to maps where the characters can unlock habillities / spells. Each character has a different map (all 4 characters), after he finished unlocking the skills, he would return to the map / stage he was in.
I defined some variables:
ds293.png


Maps:
2jewfnq.png



Starting with Common Event I have set some commands as you can check below:
dheu68.png



The action of this process begins on the event on any map.
16m7xjd.png



When you talk to an NPC, a window of choices is shown for the player to select which skill map of the characters he wants.
Since at the moment only Haroldo has playable, only his name appears in the choices, if you have more characters in the team, the names will appear. So far everything is working.
fcij6c.png


The problem occurs when the player selects the character, instead of being teleported to his skill map, the game crashes.
35lhm5t.png


Well, in this case what would be going wrong in processing the common event?
Thanks in advance.
The Problem here is that the script event command is sandboxed. All newly defined variables inside a scriptbox are deleted when the scriptbox is closed.
That results in the "$selected_actor" being undefined in later script boxes.

You'll either need to store this in a normal game variable or use a plugin to define them outside a scriptbox.
Moved to: JS Plugin Requests

Original thread: https://forums.rpgmakerweb.com/threads/conversion-some-codes-rgss3-to-javascript.97774/