Hashes

In ruby, you usually address hashes like this. How do you do this in JavaScript respectively?

Code:
    Movement = {      :x =>      [0,0,"%s_1"],      :y =>     [0,2,"%s_2"],    }
There is no dedicated hash/map/associative array class, you use objects, instead:

Code:
var Movement = {    x: [0, 0, "%s_1"],    y: [0, 2, "%s_2"],};
Also, since you are using "%s", i'm assuming you want to format the String. Note, that JavaScript doesn't have a String.format function and you'll need to manually replace th placeholders like this:
Code:
string = string.replace("%s", "some text");
Oh wow. Yes, the %s_1 was for me to trace for the character name. So, if its actor 1, I use $actor1_1, for second movement, I use $actor1_2...etc.

I'll have to study this so I can make my plugin work 😀
You can also use regex in replace functions, if you want more options:

Code:
var result = "$actor1_2".replace(/\$actor(\d+)_(\d+)/g, function(m, group1, group2) {    // group1 will be "1", while group2 will be "2". m contains the whole matched string, which isn't important here.    // whatever you return here will replace the matched string.});
This is interesting. Thanks a lot. <3
MV has the format string function, it's on line 46 in rpg_core. But you use %1, %2, ect. instead of %s. It uses a pretty similar replace function like the one larva showed.
Ah, yes, but it's rather limited compared to how format works in other languages (padding strings, float precision, ...).

Original thread: https://forums.rpgmakerweb.com/threads/hashes.53340/