Suggestion Right-click - "Convert to javascript"

Description of the Feature:
Able to turn any line into its equivalent script within the right-click context menu.

Mockups:
View attachment 236674

Why is this feature good?
  • Cuts down on time looking up and debugging script calls for parts you're unfamiliar with or are insufficiently documented.
  • More accessible than scripting by hand when you only need to make minor changes beyond the editor's limits.
  • Educates on scripting by turning literally anything into a script call instead of having to toy around with the reference list.

Possible issues with this feature?
  • Reversing the conversion would not be possible, this would be an issue in very large blocks if done unintentionally or prematurely.
  • Due to the line limit, extremely large blocks of converted script could run into issues.
Won't work, because event commands aren't linked to individual lines of code. Some of them hide quite lengthy scripts, and some of them hide scripts that call scripts that call scripts.
It doesn't have to be all of them. I guess this entire franchise is just badly mismanaged if something this simple can't be implemented.
It doesn't have to be all of them. I guess this entire franchise is just badly mismanaged if something this simple can't be implemented.
It is possible to implement what you describe for all event commands. But like Shaz implies, the engine does not handle event commands like you think it does.

For instance, the actual core script call equivalent for your example:

◆Control Variables:#0001 += 5
...is this:

this.command122([1, 1, 1, 0, 5]);
That doesn't look very intuitive to me. 😅

If, like you seem to suggest, it instead converted to lower-level script calls:
  1. It would add extra maintenance/QA/etc work for the RM dev team to ensure core script updates get accurately reflected in the editor each update.

  2. You'd potentially end up with discrepancies between event commands and their script "equivalents", due to plugins. For example, the TinyGetInfoWndMZ plugin that ships with RMMZ patches the command methods 125~128 (Change Gold/Items/Weapons/Armors) rather than the lower-level methods like Game_Party#gainItem.

    Typically I wouldn't make a point of the editor not reflecting plugin changes, but we're talking about script calls here and in many ways a plugin is just a big script call that runs on game boot.
Also, for future reference, note that the typical script call for your example is:

$gameVariables.setValue(1, $gameVariables.value(1) + 5);
$gameVariables.value(1, +5) will simply get the value of variable 1; the core scripts do nothing with the second input. In case you're interested you can find a bunch of script call examples over here:
(Not sure if that's what you meant when you said "reference list". There's also an MZ Script Call Reference: it has much less explanation, but is more comprehensive.)

Would you still like this thread to be approved for discussion?

Original thread: https://forums.rpgmakerweb.com/threads/right-click-convert-to-javascript.150098/