MV Help Moving from Ruby to Javascript

Hello, I was wondering if anyone had any advice or sources on translating scripts, specifically from Ruby to JS. Things like tutorial videos, a simple guide on where to start translating, or a list of function equivalents and the like would be extremely helpful.

I've dug around for a while to try and find such things, but from little to no avail.

It looks like the two codes have more differences than similarities; or rather, one is more complex than the other. Though, that may be because I'm simply novice at it.

There's plenty of helpful threads on here, but I've not yet seen one deal with translation (Maybe I overlooked it somewhere.). I figured since I already know a fair amount of Ruby, it might be easier to try and pick up JS based on what I already know. Not to mention, I have a handful of old scripts I made that could certainly be useful for the later RM builds that use JS.

I'd appreciate anything to get me going in the right direction here.
first of all... since you already have rpg maker ruby basic... it will be easier to learn rpg maker javascript... you only need to learn the syntax and some difference between ruby to javascript...

most RPG Maker ACE object (ruby language) is almost have the same structure in MV (javascript)... so i have easier time when i switch from ruby to javascript.

google is your friend... for example... you can type
javascript for
javascript if
javascript switch case
javascript array split
etc... and it usually will give you result about how that code syntax in javascript.

i also usually use stackoverflow.com and search for question i have there...

then the next step is read the engine javascript code... you can find that in your project/js/ folder...
to learn how the engine works... and like i said... they did not change much structure-wise from ACE to MV... so your old ruby ACE knowledge could still useful to some extent...

after that you can read some other plugin maker plugin... learn from their code...
if you don't understand it... try asking the question on this forum -> javascript -> learning javascript...
lots of people here might help you 😀.

then... you can start gradually making plugins... start small first... then raise the difficulty one step at a time... till you achieve the plugin you want to make...

also... if you work with image... i need to warn you... different with Ruby... image in javascript is loaded asychronously... meaning after you try loading the image... it will directly execute the next line of code... (which sometime the image not finished loading). thus sometime you will encounter problem such as no image shown... or other error... you need to learn about "listener" to solve this issue... but you can always find other people plugin and read the code to learn how they tackle the issue. 😀.

hope this help.
Mind that Ruby classes and Javascript prototypes are different.
Start from learning what exactly is the prototype.

Also, translating a script is not that simple.
There is no silver bullet for translating RGSS scripts to JS.
You have to read what the script does and see the counterpart in the MV/MZ, then write according to that. A direct line per line just doesn't work.
first of all... since you already have rpg maker ruby basic... it will be easier to learn rpg maker javascript... you only need to learn the syntax and some difference between ruby to javascript...

most RPG Maker ACE object (ruby language) is almost have the same structure in MV (javascript)... so i have easier time when i switch from ruby to javascript.

google is your friend... for example... you can type
javascript for
javascript if
javascript switch case
javascript array split
etc... and it usually will give you result about how that code syntax in javascript.

i also usually use stackoverflow.com and search for question i have there...

then the next step is read the engine javascript code... you can find that in your project/js/ folder...
to learn how the engine works... and like i said... they did not change much structure-wise from ACE to MV... so your old ruby ACE knowledge could still useful to some extent...

after that you can read some other plugin maker plugin... learn from their code...
if you don't understand it... try asking the question on this forum -> javascript -> learning javascript...
lots of people here might help you 😀.

then... you can start gradually making plugins... start small first... then raise the difficulty one step at a time... till you achieve the plugin you want to make...

also... if you work with image... i need to warn you... different with Ruby... image in javascript is loaded asychronously... meaning after you try loading the image... it will directly execute the next line of code... (which sometime the image not finished loading). thus sometime you will encounter problem such as no image shown... or other error... you need to learn about "listener" to solve this issue... but you can always find other people plugin and read the code to learn how they tackle the issue. 😀.

hope this help.

Mind that Ruby classes and Javascript prototypes are different.
Start from learning what exactly is the prototype.

Also, translating a script is not that simple.
There is no silver bullet for translating RGSS scripts to JS.
You have to read what the script does and see the counterpart in the MV/MZ, then write according to that. A direct line per line just doesn't work.

I very much appreciate the advice. This will help me immensely. Thank you both! I'll be sure to keep this all in mind as I progress further with learning the language.

Original thread: https://forums.rpgmakerweb.com/threads/help-moving-from-ruby-to-javascript.131645/