[VSCode] Script Editor for RPG Maker XP, VX and VX Ace [v1.6.1]

RGSS Script Editor
Use Visual Studio Code instead of the RPG Maker built-in script editor
​
This is a VSCode extension that allows you to extract all scripts from the scripts file that RPG Maker uses into individual Ruby files. Once extraction is done, it creates a backup of the original scripts file (Scripts.rxdata, Scripts.rvdata or Scripts.rvdata2) as a security measure, subsequently, it overwrites the original scripts file with a script loader that loads ruby scripts inside a relative folder based on a text file that dictates the loading order.

I have decided to go with this approach to allow having the RPG Maker editor running at the same time you are creating/modifying scripts with an external code editor.

You can check the README on GitHub for a more detailed description.


Features​

  • Seamlessly extract and manage RPG Maker scripts as individual Ruby files.
  • Edit the game scripts in VSCode while the RPG Maker editor is open and the game is running.
  • Organize your scripts in a tree view: folders and separators with drag & drop support.
  • Copy, cut and paste scripts and folders anywhere in the tree view.
  • Enable/disable scripts and folders to load or skip them when running the game.
  • Run the game directly from VSCode with lots of customizable options.
  • Process game exceptions with detailed backtrace visualization inside VSCode.
  • RPG Maker default script list hierarchy has been replaced with a tree hierarchy.
  • Backup and compile script bundles for distribution.
  • Seamlessly change between active folders in the VSCode current workspace.
  • File system watcher tracking your project's script folder for changes outside VSCode.
  • Use version control software (Git) to track script changes visually on the script editor.


️ Screenshots​


You can open any folder from the current workspace
feature-editor.gif



You can create any type of section inside the editor tree
feature-editor-2.gif



Example tree
feature-editor-collapsed.jpg
​


️ ️Other notable extensions​

These extensions enhance the experience of working with Ruby in VSCode with RGSS Script Editor​




If you find a bug or you want to request something new feel free to open an issue on the GitHub page.

Extension Links

GitHub
VSCode Marketplace
Open VSX Marketplace

Any feedback is appreciated.
​
Wow, you are a legend.
It's sad there aren't any responses yet. This is huge, a big Thank You!
I hope I can try this out anytime soon. I checked your information page and I have one question about Wine, as I'm a Linux user. You state:

rgssScriptEditor.gameplay.useWine: Whether to use Wine to execute the game executable in Linux or not. (Linux Only)
How exactly does this approach Wine on my system? Can I customize the command in some way or does it only default to vanilla Wine like
Code:
wine "path/to/game/exe"
?
I ask because there are several Wine forks in the wild and I personally use Wine_GE (essentially Proton with Steam features stripped out) for which I have customized a nice alias so I can just type
Code:
wine-ge "path/to/game/exe"
beside the vanilla Wine.

Oh, any chance one can donate for your project?
Wow, you are a legend.
It's sad there aren't any responses yet. This is huge, a big Thank You!
I hope I can try this out anytime soon. I checked your information page and I have one question about Wine, as I'm a Linux user.
Thank you! 🙂

It's probably not the best extension made for this because it's my first time with VSCode API and TypeScript but I appreciate your words. 🙂

I was waiting for a Linux user to use the extension and report it since my Linux HDD died and I have not been able to fully test it and ensure that everything works perfectly on that OS.

How exactly does this approach Wine on my system? Can I customize the command in some way or does it only default to vanilla Wine like
Right now Wine usage is hardcoded to use "wine", so yeah, it is the vanilla binaries, if you are interested, I can add a new option in the extension to allow you to modify the command to call Wine without any problems.

The command to call the game with Wine is structured in the following way:
wine "PATH_TO_GAME_EXECUTABLE" [args1, args2, args3...]

``args1``, ``args2``... being the arguments that the extension automatically determines (based on the RGSS version detected) or the custom arguments you can send deactivating the "auto mode" on the settings page and filling this input there.

1705845146437.png


I tried to make the extension as user-friendly as possible, that's why this "auto-detection" thing exists to avoid sending invalid arguments.

Oh, any chance one can donate for your project?
I did not expect anyone to want to donate, there is no way to do so at the moment. If you are interested let me know via PM.

Right now I am trying to get the VSCode team to implement a way to order the files in the VSCode peek menu.

I would appreciate it if you guys could upvote the petition, it is the only way (that I know?) in which I will be able to show the files in the peek menu in the same order as the exception backtrace from the game process. (You can read more about this in the issue).
Right now Wine usage is hardcoded to use "wine", so yeah, it is the vanilla binaries, if you are interested, I can add a new option in the extension to allow you to modify the command to call Wine without any problems.
That would be appreciated!

---

So, I tried to use your extension. Keep in mind, I'm not that experienced in VStudio yet.
I'm having problems setting this up, don't know if I'm doing smth. wrong. A hint would be nice. What I have done:

- Install the exentions
- Open a project folder in VStudio
- Click on the extension icon on the left side
- Click on "Set Active Project Folder"
- Nothing happens

Clicking on the little icons at the top like "Choose Editor Mode" throws me an error like
"command 'rgss-script-editor.chooseEditorMode' not found.

Any idea?

---

Oh, btw, it's possible you could also offer your extension in the VSCodium Market? Though VSCodium can use extensions from the Microsoft market with a workaround, it would be nice to have it in its native market for installation. VSCodium is, if you don't know, VStudio without the Microsoft specific stuff (it's privacy friendly etc.). I've tested your extension in both versions (Microsoft VStudio and the FOSS VStudio VSCodium) and I have the same problem in both versions. Some info:


Market for extensions

Info for distribution
That would be appreciated!

---

So, I tried to use your extension. Keep in mind, I'm not that experienced in VStudio yet.
I'm having problems setting this up, don't know if I'm doing smth. wrong. A hint would be nice. What I have done:

- Install the exentions
- Open a project folder in VStudio
- Click on the extension icon on the left side
- Click on "Set Active Project Folder"
- Nothing happens

Clicking on the little icons at the top like "Choose Editor Mode" throws me an error like
"command 'rgss-script-editor.chooseEditorMode' not found.

Any idea?

---

Oh, btw, it's possible you could also offer your extension in the VSCodium Market? Though VSCodium can use extensions from the Microsoft market with a workaround, it would be nice to have it in its native market for installation. VSCodium is, if you don't know, VStudio without the Microsoft specific stuff (it's privacy friendly etc.). I've tested your extension in both versions (Microsoft VStudio and the FOSS VStudio VSCodium) and I have the same problem in both versions. Some info:


Market for extensions

Info for distribution
That's weird because I have checked and the extension registers all callbacks for the commands appropriately when it is activated, maybe the extension failed to activate on your end? What version of VSCode are you running the extension on?

Also if possible, send me the log file the extension creates within the project's folder, in case the log file does not exist, check the information written into the output channel, it should look something like this:
1706134679166.png


In case the extension was not able to register the output channel, VSCode likely failed to activate the extension on your system, in that case, open the command palette and type "Show Logs", click on the "Developer: Show Logs..." and then click on "Extension Host" and search the entry with the extension ID (SnowSzn.rgss-script-editor) If the extension was activated it should look something like this:
1706135519688.png


Oh, btw, it's possible you could also offer your extension in the VSCodium Market? Though VSCodium can use extensions from the Microsoft market with a workaround, it would be nice to have it in its native market for installation. VSCodium is, if you don't know, VStudio without the Microsoft specific stuff (it's privacy friendly etc.). I've tested your extension in both versions (Microsoft VStudio and the FOSS VStudio VSCodium) and I have the same problem in both versions. Some info:
Sure no problem, I will check VSCodium out once I release v1.0.9, I'm planning to change the current setting "rgssScriptEditor.gameplay.useWine" from a boolean value to a string set to "wine" by default, so you will be able to change the Wine command freely.
Thanks for the hint.

It seems that the extension can't be activated on my side. No log file is created in the project folder.
I have a fresh version of both installed on my system. Here is the "Extension Host" output.

VSCodium
Code:
2024-01-24 23:47:47.833 [info] ExtensionService#_doActivateExtension SnowSzn.rgss-script-editor, startup: true, activationEvent: 'workspaceContains:Game.ini'
2024-01-24 23:47:47.845 [error] Activating extension SnowSzn.rgss-script-editor failed due to an error:
2024-01-24 23:47:47.845 [error] Error: Cannot find module './ui/ui_extension'
Require stack:
- /home/schM0ggi/.vscode-oss/extensions/snowszn.rgss-script-editor-1.0.8/out/modules/manager.js
- /home/schM0ggi/.vscode-oss/extensions/snowszn.rgss-script-editor-1.0.8/out/extension.js
- /usr/share/codium/resources/app/out/vs/loader.js
- /usr/share/codium/resources/app/out/bootstrap-amd.js
- /usr/share/codium/resources/app/out/bootstrap-fork.js
-
    at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
    at o._resolveFilename (node:electron/js2c/utility_init:2:3040)
    at Module._load (node:internal/modules/cjs/loader:927:27)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:6981)
    at n._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:36227)
    at t._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:45311)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at h (/usr/share/codium/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/schM0ggi/.vscode-oss/extensions/snowszn.rgss-script-editor-1.0.8/out/modules/manager.js:35:24)
    at o._compile (/usr/share/codium/resources/app/out/vs/loader.js:4:1271)
    at Module._extensions..js (node:internal/modules/cjs/loader:1324:10)
    at Module.load (node:internal/modules/cjs/loader:1124:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:6981)
    at n._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:36227)
    at t._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:45311)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at h (/usr/share/codium/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/schM0ggi/.vscode-oss/extensions/snowszn.rgss-script-editor-1.0.8/out/extension.js:28:30)
    at o._compile (/usr/share/codium/resources/app/out/vs/loader.js:4:1271)
    at Module._extensions..js (node:internal/modules/cjs/loader:1324:10)
    at Module.load (node:internal/modules/cjs/loader:1124:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:6981)
    at n._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:36227)
    at t._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:45311)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Function.i [as __$__nodeRequire] (/usr/share/codium/resources/app/out/vs/loader.js:5:98)
    at f._loadCommonJSModule (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:37854)
    at async Promise.all (index 0)

Microsoft VStudio
Code:
2024-01-24 23:53:15.616 [error] Activating extension SnowSzn.rgss-script-editor failed due to an error:
2024-01-24 23:53:15.616 [error] Error: Cannot find module './ui/ui_extension'
Require stack:
- /home/schM0ggi/.vscode/extensions/snowszn.rgss-script-editor-1.0.8/out/modules/manager.js
- /home/schM0ggi/.vscode/extensions/snowszn.rgss-script-editor-1.0.8/out/extension.js
- /usr/share/code/resources/app/out/vs/loader.js
- /usr/share/code/resources/app/out/bootstrap-amd.js
- /usr/share/code/resources/app/out/bootstrap-fork.js
-
    at Module._resolveFilename (node:internal/modules/cjs/loader:1129:15)
    at s._resolveFilename (node:electron/js2c/utility_init:2:2786)
    at Module._load (node:internal/modules/cjs/loader:974:27)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:5632)
    at n._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:29551)
    at t._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:35226)
    at Module.require (node:internal/modules/cjs/loader:1195:19)
    at h (/usr/share/code/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/schM0ggi/.vscode/extensions/snowszn.rgss-script-editor-1.0.8/out/modules/manager.js:35:24)
    at o._compile (/usr/share/code/resources/app/out/vs/loader.js:4:1271)
    at Module._extensions..js (node:internal/modules/cjs/loader:1371:10)
    at Module.load (node:internal/modules/cjs/loader:1171:32)
    at Module._load (node:internal/modules/cjs/loader:1012:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:5632)
    at n._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:29551)
    at t._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:35226)
    at Module.require (node:internal/modules/cjs/loader:1195:19)
    at h (/usr/share/code/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/schM0ggi/.vscode/extensions/snowszn.rgss-script-editor-1.0.8/out/extension.js:28:30)
    at o._compile (/usr/share/code/resources/app/out/vs/loader.js:4:1271)
    at Module._extensions..js (node:internal/modules/cjs/loader:1371:10)
    at Module.load (node:internal/modules/cjs/loader:1171:32)
    at Module._load (node:internal/modules/cjs/loader:1012:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:5632)
    at n._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:29551)
    at t._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:35226)
    at Module.require (node:internal/modules/cjs/loader:1195:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Function.i [as __$__nodeRequire] (/usr/share/code/resources/app/out/vs/loader.js:5:98)
    at f.vb (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:30730)
    at async Promise.all (index 0)

The output in both versions looks the same, except the difference in the path.

Sure no problem, I will check VSCodium out once I release v1.0.9, I'm planning to change the current setting "rgssScriptEditor.gameplay.useWine" from a boolean value to a string set to "wine" by default, so you will be able to change the Wine command freely.

Sounds awesome!
Thanks for the hint.

It seems that the extension can't be activated on my side. No log file is created in the project folder.
I have a fresh version of both installed on my system. Here is the "Extension Host" output.

VSCodium
Code:
2024-01-24 23:47:47.833 [info] ExtensionService#_doActivateExtension SnowSzn.rgss-script-editor, startup: true, activationEvent: 'workspaceContains:Game.ini'
2024-01-24 23:47:47.845 [error] Activating extension SnowSzn.rgss-script-editor failed due to an error:
2024-01-24 23:47:47.845 [error] Error: Cannot find module './ui/ui_extension'
Require stack:
- /home/schM0ggi/.vscode-oss/extensions/snowszn.rgss-script-editor-1.0.8/out/modules/manager.js
- /home/schM0ggi/.vscode-oss/extensions/snowszn.rgss-script-editor-1.0.8/out/extension.js
- /usr/share/codium/resources/app/out/vs/loader.js
- /usr/share/codium/resources/app/out/bootstrap-amd.js
- /usr/share/codium/resources/app/out/bootstrap-fork.js
-
    at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
    at o._resolveFilename (node:electron/js2c/utility_init:2:3040)
    at Module._load (node:internal/modules/cjs/loader:927:27)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:6981)
    at n._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:36227)
    at t._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:45311)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at h (/usr/share/codium/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/schM0ggi/.vscode-oss/extensions/snowszn.rgss-script-editor-1.0.8/out/modules/manager.js:35:24)
    at o._compile (/usr/share/codium/resources/app/out/vs/loader.js:4:1271)
    at Module._extensions..js (node:internal/modules/cjs/loader:1324:10)
    at Module.load (node:internal/modules/cjs/loader:1124:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:6981)
    at n._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:36227)
    at t._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:45311)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at h (/usr/share/codium/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/schM0ggi/.vscode-oss/extensions/snowszn.rgss-script-editor-1.0.8/out/extension.js:28:30)
    at o._compile (/usr/share/codium/resources/app/out/vs/loader.js:4:1271)
    at Module._extensions..js (node:internal/modules/cjs/loader:1324:10)
    at Module.load (node:internal/modules/cjs/loader:1124:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:6981)
    at n._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:36227)
    at t._load (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:45311)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Function.i [as __$__nodeRequire] (/usr/share/codium/resources/app/out/vs/loader.js:5:98)
    at f._loadCommonJSModule (/usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:37854)
    at async Promise.all (index 0)

Microsoft VStudio
Code:
2024-01-24 23:53:15.616 [error] Activating extension SnowSzn.rgss-script-editor failed due to an error:
2024-01-24 23:53:15.616 [error] Error: Cannot find module './ui/ui_extension'
Require stack:
- /home/schM0ggi/.vscode/extensions/snowszn.rgss-script-editor-1.0.8/out/modules/manager.js
- /home/schM0ggi/.vscode/extensions/snowszn.rgss-script-editor-1.0.8/out/extension.js
- /usr/share/code/resources/app/out/vs/loader.js
- /usr/share/code/resources/app/out/bootstrap-amd.js
- /usr/share/code/resources/app/out/bootstrap-fork.js
-
    at Module._resolveFilename (node:internal/modules/cjs/loader:1129:15)
    at s._resolveFilename (node:electron/js2c/utility_init:2:2786)
    at Module._load (node:internal/modules/cjs/loader:974:27)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:5632)
    at n._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:29551)
    at t._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:35226)
    at Module.require (node:internal/modules/cjs/loader:1195:19)
    at h (/usr/share/code/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/schM0ggi/.vscode/extensions/snowszn.rgss-script-editor-1.0.8/out/modules/manager.js:35:24)
    at o._compile (/usr/share/code/resources/app/out/vs/loader.js:4:1271)
    at Module._extensions..js (node:internal/modules/cjs/loader:1371:10)
    at Module.load (node:internal/modules/cjs/loader:1171:32)
    at Module._load (node:internal/modules/cjs/loader:1012:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:5632)
    at n._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:29551)
    at t._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:35226)
    at Module.require (node:internal/modules/cjs/loader:1195:19)
    at h (/usr/share/code/resources/app/out/vs/loader.js:4:647)
    at Object.<anonymous> (/home/schM0ggi/.vscode/extensions/snowszn.rgss-script-editor-1.0.8/out/extension.js:28:30)
    at o._compile (/usr/share/code/resources/app/out/vs/loader.js:4:1271)
    at Module._extensions..js (node:internal/modules/cjs/loader:1371:10)
    at Module.load (node:internal/modules/cjs/loader:1171:32)
    at Module._load (node:internal/modules/cjs/loader:1012:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at c._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:5632)
    at n._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:29551)
    at t._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:133:35226)
    at Module.require (node:internal/modules/cjs/loader:1195:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Function.i [as __$__nodeRequire] (/usr/share/code/resources/app/out/vs/loader.js:5:98)
    at f.vb (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:168:30730)
    at async Promise.all (index 0)

The output in both versions looks the same, except the difference in the path.



Sounds awesome!
Could check if the given file exists within the extension's folder? For some reason, it seems that the extension fails to load the script that I use to handle the UI.

Go to the directory where VSCode installs all extensions, should be on Linux by default:
Bash:
cd ~/.vscode/extensions

Now cd into "./snowszn.rgss-script-editor-1.0.8/out/modules/UI" folder
Bash:
cd "./snowszn.rgss-script-editor-1.0.8/out/modules/UI"
A file called "ui_extension.js" should exist in there, if it does not try to install the extension again and let me know.

EDIT: I think I may have an idea of what is happening, could you confirm to me that the folder UI is all uppercase on your end? because since Linux is case sensitive and the script require sentence path is 'ui/...' it may be failing to load it.
Yeah, you've nailed it. The extension works now after renaming the folder "UI" into "ui".

But the next problem appears. Due to the hard coded way of using wine in your extension, wine does create, if not present, a new prefix with the default directory
Bash:
~/.wine
and is trying to start the Game.exe in that place. In my case, because I do not rely on only one wine prefix and have several prefixes for different games/apps, launching a project via the extension fails. After copying the RPG Maker XP installation into that default prefix, launching the Game.exe works.

So I would suggest to not only let the the user customize the wine command but also make it possible to define a wine prefix for a project.
Yeah, you've nailed it. The extension works now after renaming the folder "UI" into "ui".

But the next problem appears. Due to the hard coded way of using wine in your extension, wine does create, if not present, a new prefix with the default directory
Bash:
~/.wine
and is trying to start the Game.exe in that place. In my case, because I do not rely on only one wine prefix and have several prefixes for different games/apps, launching a project via the extension fails. After copying the RPG Maker XP installation into that default prefix, launching the Game.exe works.

So I would suggest to not only let the the user customize the wine command but also make it possible to define a wine prefix for a project.
My bad then haha, I messed up the package when I uploaded it into VSCode marketplace, this is because originally the folder was called "UI", and sometime during development I renamed it into "ui", since Windows is case insensitive it never renamed the folder inside the output folder and works out of the box. The same may have happened to other folders/files inside the output folder.

I'm gonna clean up the output folder for v1.0.9 so all files within the output folder have valid names and include what you have suggested about Wine, speaking of which, could explain what wine does if that prefix is not given? (I have not used Wine very much) like does the command need an argument to specify the current working folder?
The same may have happened to other folders/files inside the output folder.
Some files have upper/lower case mixed together, if that helps.
I'm gonna clean up the output folder for v1.0.9 so all files within the output folder have valid names and include what you have suggested about Wine, speaking of which, could explain what wine does if that prefix is not given? (I have not used Wine very much) like does the command need an argument to specify the current working folder?
When just running an app via wine without any additional parameters, the default wine prefix is, if not present yet, created under
Bash:
~/.wine
and the app is launched in that environment.
To specify a custom wine prefix, one has to use
Bash:
WINEPREFIX=/path/to/prefix
So, running an app installed in a custom prefix with wine would look like this
Bash:
WINEPREFIX=/path/to/prefix/folder wine /path/to/app.exe

A good insight might be the official wine documentation

---

I played around a bit and so far, everything seems to work fine. Script files are created and loaded, Backtrace is functional.
One thing I noticed is that, when creating a bundle from the extracted scripts, I have to additionally name the extension (.rxdata) of the file despite having the option to choose between RPG Maker XP and VX Ace in the save dialog. Could be a general problem of the file dialog, though.

Feel free to ask me to test specific things of your extension.
Some files have upper/lower case mixed together, if that helps.

When just running an app via wine without any additional parameters, the default wine prefix is, if not present yet, created under
Bash:
~/.wine
and the app is launched in that environment.
To specify a custom wine prefix, one has to use
Bash:
WINEPREFIX=/path/to/prefix
So, running an app installed in a custom prefix with wine would look like this
Bash:
WINEPREFIX=/path/to/prefix/folder wine /path/to/app.exe

A good insight might be the official wine documentation
I pushed v1.0.9, let me know if you can use your aliased wine fork, as well as setting up that env. variable when calling it, I believe as long as any wine fork accepts the arguments in the same order as the original Wine it should not be a problem.

The old useWine option was replaced with an input box.

1706213935327.png


For linux-based systems, I changed the logic to determine whether the game is a Linux executable or a Windows one, no need to activate/deactivate a flag to use Wine or not, the extension should be able to use that command to invoke Wine (or not) based on what type of executable is being used. But, since I cannot test it, I cannot ensure it works 100%

Also, I cleaned the output folder, you should have a clean "out" folder inside the extension's folder with the correct names, and removed all unnecessary files.

I played around a bit and so far, everything seems to work fine. Script files are created and loaded, Backtrace is functional.
One thing I noticed is that, when creating a bundle from the extracted scripts, I have to additionally name the extension (.rxdata) of the file despite having the option to choose between RPG Maker XP and VX Ace in the save dialog. Could be a general problem of the file dialog, though.

Feel free to ask me to test specific things of your extension.
Thanks, I have not managed to replicate what you say about creating a new bundle file from the extracted scripts, now that it works, could you check the output channel of the extension to see what destination path it gets from the VSCode API? Could it be a OS thing?

This is what happens on Windows:
1. On the save window
1706213694726.png


2. Once you save it, the output channel should look like this:
1706213596656.png
Ah, I see you've combined the customizable wine and wine prefix into one input box. That's fine.
I have tested this new input box and it works, though I can't use my defined aliases in .bashrc but that was to be expected.
I could play around with a symlink and putting it into a path which resides in $PATH, but nah ... it's okay.
Instead, I just input the absolute path to the wine fork, this does also the job. So, in the end it looks like this on my side:

Code:
WINEPREFIX="/path/to/prefix" "/path/to/wine/fork/wine"

Also, I cleaned the output folder, you should have a clean "out" folder inside the extension's folder with the correct names, and removed all unnecessary files.
Yes, looking good.

Regarding the bundle. This is how it looks on my side with the output:

Screenshot_20240125_233909.png

Screenshot_20240125_233957.png


The file is created, but without the correct extension. Workaround is to just manually add it afterwards to the specific file or directly typing it in the name when saving.
Ah, I see you've combined the customizable wine and wine prefix into one input box. That's fine.
I have tested this new input box and it works, though I can't use my defined aliases in .bashrc but that was to be expected.
Instead, I just input the absolute path to the wine fork, this does also the job. So, in the end it looks like this on my side:

Code:
WINEPREFIX="/path/to/prefix" "/path/to/wine/fork/wine"


Yes, looking good.

Regarding the bundle. This is how it looks on my side with the output:

View attachment 293088
View attachment 293089

The file is created, but without the correct extension. Workaround is to just manually add it afterwards to the specific file or directly typing it in the name when saving.
Hmm I see, I thought that by using the NodeJS fs module to spawn a shell and execute the command it would support aliases since the shell would have loaded them upon creation, but I guess I was wrong, no idea why tbh.

EDIT: it seems the default shell that NodeJS uses on UNIX system is "/bin/sh", maybe this is the problem?

About the bundle file, I guess the save dialog is OS-dependent, VSCode is supposed to add the file extension automatically but it is directly omitted in Linux, unlike Windows.

One thing I can do about it is to ensure that an extension exists in the destination path, so it would work with Linux without manually adding it in the file name, I'll try to do this and include it in a future update.

If you have any other idea/feature feel free to suggest it!

I will try to get the extension into open-vsx in the next days, I need to verify the publisher namespace first and will try to upload it.
Hmm I see, I thought that by using the NodeJS fs module to spawn a shell and execute the command it would support aliases since the shell would have loaded them upon creation, but I guess I was wrong, no idea why tbh.

EDIT: it seems the default shell that NodeJS uses on UNIX system is "/bin/sh", maybe this is the problem?
Yeah, seems so.
On my system/distro, "/bin/sh" is a symlink to "/bin/bash".
Probably the symlink is wrecking things as when using "/bin/sh" instead of "/bin/bash" or "/usr/bin/bash", script files also don't seem to work when combined with an alias for a wine fork. If possible, you could add an input box to customize the path to the shell or smth. similar if you like. But not necessary if you ask me, as one can just point to the absolute path regarding a wine fork.

About the bundle file, I guess the save dialog is OS-dependent, VSCode is supposed to add the file extension automatically but it is directly omitted in Linux, unlike Windows.

One thing I can do about it is to ensure that an extension exists in the destination path, so it would work with Linux without manually adding it in the file name, I'll try to do this and include it in a future update.
Probably OS-dependent, yeah. Sounds good if you can do that easily.
Yeah, seems so.
On my system/distro, "/bin/sh" is a symlink to "/bin/bash".
Probably the symlink is wrecking things as when using "/bin/sh" instead of "/bin/bash" or "/usr/bin/bash", script files also don't seem to work when combined with an alias for a wine fork. If possible, you could add an input box to customize the path to the shell or smth. similar if you like. But not necessary if you ask me, as one can just point to the absolute path regarding a wine fork.


Probably OS-dependent, yeah. Sounds good if you can do that easily.
As long as it works with the absolute path I think I'd rather leave it as it is, trying to have as few settings as possible to make it easier to understand.

I think I fixed the bundle creation extension thing with the last version, I also uploaded it to open-vsx, I believe I do not have to modify anything to share the extension in that marketplace, let me know if it works in VSCodium downloading it from there.
Tested the native extension in VSCodium, works like a charm. Very nice and thank you!
The budnle creation process is now good. File name extension is present when saving.

I think you might want to also advertise your extension in the discord server of mkxp and mkxp-z.
I can imagine there are some people who would take your work with a kiss on your hand. 😉
New version 1.1.0 released, changelog notes below.

The extension is now able to recreate a tree on the script editor view based on a previous bundle file created, due to obvious limitations of the RPG Maker data format, I had to use the script's name to save the filesystem location where a specific script was before it was bundled up.

This is something I wanted to fix asap since it could break the whole tree arrangement if the user accidentally overwrites the scripts bundle file this extension creates, forcing them to order the whole tree again.

As a small addition, you can use a new command to quickly create backups of the current state of all scripts and save them into the RPG Maker data format, since it uses the same functionality as the "Create Bundle" command, only enabled (loaded) scripts are considered for this backup.

If you have an issue (or an idea) feel free to open an issue on the Github repo, or say it here on this thread.

[1.1.0] - 01/02/2024​

Added​

  • Extension is now able to create a script tree and load order from a bundled scripts data file
    • Only bundled scripts data files created by this extension are supported
    • You will be able to restore the tree easily in case it was overwritten
  • Allows the user to quickly create a back up file of the current enabled scripts in the tree
    • This process is the same as creating a bundle file but does it automatically
    • All backups are stored with a time stamp

Changed​

  • Avoid creating empty backup files of the bundled scripts data if invalid
    • 'Invalid' means that only the script loader was inside of the bundled data file
  • Bundle creation now allows to overwrite an existing file
  • Modified some logging information to make it clearer

Fixed​

  • Fixed folder recognition to avoid empty filesystem entries to be recognized as valid folders
Thanks a bunch! 😀going to try this one out. Love the black mode, very low vision friendly.
Thanks a bunch! 😀going to try this one out. Love the black mode, very low vision friendly.
No problem! If you have any questions about how the extension works feel free to ask 🙂
New version 1.2.0 released, changelog notes below.

[1.2.0] - 29/02/2024​

Added​

  • A new command to create a bundle file from the current selected editor sections on the tree view
    • You can select any group of sections on the tree view and create a bundle including only those sections
    • Sections will be included whether they are enabled or disabled

Changed​

  • Modified create bundle file and create backup bundle file commands to adapt it to the new feature
  • Renamed Create Script Loader command

Original thread: https://forums.rpgmakerweb.com/threads/vscode-script-editor-for-rpg-maker-xp-vx-and-vx-ace-v1-6-1.164586/