Tutorial: Ruby Coding Environment Alternatives

You mean like you have only 1 script with a bunch of "require" and then edit all files externally? That sounds nice. I really do not like the RM editor (always looking for that missing "end" for my if-statements 😛 ).
Yepyep. Quake actually did exactly that in its QuakeC programming... pretty interesting stuff. Learn from the best, etc.

Ya, the process is straightforward. Here's a tutorial a script that does it

http://forum.chaos-project.com/index.php?topic=9938.0

Tried it, but didn't like it. Maybe cause I was using notepad++ and not sublime or a ruby IDE.
Thank you so much! This helps out a ton.

EDIT:

I wonder if you can toss the scripts into the encrypted archive and have it still work? My gut says "probably not," since require takes a filename and not an actual file stream or anything.
Yepyep. Quake actually did exactly that in its QuakeC programming... pretty interesting stuff. Learn from the best, etc.

Thank you so much! This helps out a ton.

EDIT:

I wonder if you can toss the scripts into the encrypted archive and have it still work? My gut says "probably not," since require takes a filename and not an actual file stream or anything.
Well other things encrypted by game builds with encryption enabled still work and scripts look them up as filenames (pictures etc) or at least they can.

I don't know if you could require something within the encrypted data but I don't see why you shouldn't be able to.
I did consider this too, but I don't know what effect it will have if you compress the game without reimporting all the scripts, and does it open a path to hacking your game?


I messed around with Sublime 2 yesterday, thinking it'd be great to have multiple scripts open at once while I'm building a new scene and all its windows, but to be honest, I found it more difficult than doing it in the RGSS editor. MAYBE just because I'm so used to the editor - if I persevered with it for a while, it might get more comfortable.
EDIT:


I wonder if you can toss the scripts into the encrypted archive and have it still work? My gut says "probably not," since require takes a filename and not an actual file stream or anything.
Instead of "requiring" just load it and then eval it.
I messed around with Sublime 2 yesterday, thinking it'd be great to have multiple scripts open at once while I'm building a new scene and all its windows, but to be honest, I found it more difficult than doing it in the RGSS editor. MAYBE just because I'm so used to the editor - if I persevered with it for a while, it might get more comfortable.
Definately becuase you're used to the editor. The main thing with Sublime is you have a much bigger editing area, can see long lines of code much easier (where long lines in the ace editor can feel very clunky and require left/right scrolling) and of course the control over the visual theme helps too. Right down to the font size. You'll also get a productivity boost if you are working with multiple monitors on your computer.
Anyways if someone wants to make a "plugin" tool for RM scripts this is one way that it could be accomplished.


The plugin tool could even automatically register scripts, provide a UI for setting configuration options (which are then written out to the script), and other things.


The plugin tool would be used to determine what order the scripts are placed using a nice UI (rather than having to manage it yourself in a script).


Overall, a nice way to manage custom scripts and allows both scripters and script users to never have to touch the RM script editor.
this happens when i tried with encrypted archive. i tried it in vxace

Screenshot_12_2_2013_11_42_36_AM.jpg


require, load, it didn't seem to work with encrypted archive
Yes, you need to write your own custom script loader for encrypted archives.

It can be as simple as

Code:
script = load_data("Scripts/myScript.rb")eval(script)
And then you modify load_data to accept non-Marshal objects.
Yes, you need to write your own custom script loader for encrypted archives.

It can be as simple as

script = load_data("Scripts/myScript.rb")eval(script)And then you modify load_data to accept non-Marshal objects.
how can i modify the load_data? can you give me example?
Here is an example. It doesn't modify load_data directly, but it returns a bytestream, which load_data accepts.

http://himeworks.wordpress.com/2013/12/02/external-script-loader/

Code:
load_script("Scripts/myScript.rb")
already downloaded it, will be tested. soonly will be reported when it works

EDIT

whoa it really works, even in encrypted archive. you're a big help tsuki. now we have another way to do scripting hehehe 😀

EDIT AGAIN

i tested it with White Flute's Crypt-EX encryptor and it comes an error

Screenshot_12_2_2013_12_57_48_PM.jpg
Are you sure the rb file is inside the archive?


Crypt-EX is junk as far as I'm concerned. I mean, it's a great concept, but the execution of their archiver is junk, which is a critical component of the script (cause the whole point is to pack stuff together and then use the custom encryption).


The Rgss3a packer they provide is used to show you what gets encrypted or not, and they are VERY selective about file extensions. It's something like if it's NOT rvdata2, png, or ogg, they don't take it. I don't know whether there is some option to add everything, but this is just based on simple testing (and not reading any of their docs).
Instead of "requiring" just load it and then eval it.
Ah, clever! Thank you =]
Are you sure the rb file is inside the archive?
i'm not sure if the .rb file is inside the archive, cause i put it in Data folders, cause i know that Data folders and all of the contents in it will be encrypted as well. but maybe you're right, the Crypt-Ex itself is too selective about file extensions. but still i'm not sure if it's the packer fault (because the packer didn't encrypt the .rb file) or it's the script fault (because can't read the file inside the specially encrypted archive) :distrust: :distrust:
Here's a simple test: create a rb file, type in random stuff to make it about 5 MB, and then encrypt it using RM. You'll get an rgss3a file that's about 5 MB.


Now repeat the same with the data packer: you'll get an archive that looks like it doesn't even have the rb file.
Here is an example. It doesn't modify load_data directly, but it returns a bytestream, which load_data accepts.

http://himeworks.wordpress.com/2013/12/02/external-script-loader/

load_script("Scripts/myScript.rb")
So by using your neat script there (thanks Hime, you're awesome as always!) I made this script entry in Ace:

Dir.glob("Scripts/**/*.rb").each do |plugin| load_script(plugin)endThis loads all .rb (Ruby) files in the Scripts folder (in your project's root directory) and all subfolders in it (!), and it works beautifully. I'm going to keep tinkering with this now :3
I will be amending this methodology to the tutorial soon as the new primary method for getting the script data into ace, instead of the copy/paste method. I'm also going to reference that little script you wrote Tsukihime, thanks a lot for it! Galenmareth, I think I'm going to use that snippet of code in the tutorial as well if you don't mind. 🙂 I'll leave my origonal copy/paste method as a secondary when its all updated.
You will probably still need to specify the order that the scripts should be loaded, however.
Here's a simple test: create a rb file, type in random stuff to make it about 5 MB, and then encrypt it using RM. You'll get an rgss3a file that's about 5 MB.

Now repeat the same with the data packer: you'll get an archive that looks like it doesn't even have the rb file.
nah forget it about Crypt-Ex incompatibility with this kind of trick. that encryptor was just mess things up. i love this trick because it'll shorten the time when we must copy paste the scripts into ace script editor. but still if there are another encryptor, i'll test it with this trick to make sure that if it's work or not.

So by using your neat script there (thanks Hime, you're awesome as always!) I made this script entry in Ace:

Dir.glob("Scripts/**/*.rb").each do |plugin| load_script(plugin)endThis loads all .rb (Ruby) files in the Scripts folder (in your project's root directory) and all subfolders in it (!), and it works beautifully. I'm going to keep tinkering with this now :3
does it load the scripts in alphabetically order? or in order that you've defined before? cause scripts have a right order too when they have to be loaded into ace

I will be amending this methodology to the tutorial soon as the new primary method for getting the script data into ace, instead of the copy/paste method. I'm also going to reference that little script you wrote Tsukihime, thanks a lot for it! Galenmareth, I think I'm going to use that snippet of code in the tutorial as well if you don't mind. 🙂 I'll leave my origonal copy/paste method as a secondary when its all updated.
don't forget also with the encrypted archive, is it work or not, especially with the special encrypter such as Crypt-Ex (cause Crypt-Ex just mess things up, so just forget about using it with this trick). but in my testing with default encrypted archive, it worked smoothly, so don't worry with the default encrypted archive
Galenmareth, I think I'm going to use that snippet of code in the tutorial as well if you don't mind.  🙂
Of course not; go ahead. But be aware that it loads everything alphabetically, and see the below too 🙂  

does it load the scripts in alphabetically order? or in order that you've defined before? cause scripts have a right order too when they have to be loaded into ace
It loads them alphabetically, which became a problem I noticed a few minutes later 😉 But I've got a solution working now where plugins are folders of files that are self contained, and where there's a "bootstrapper" in the root of a Plugins folder that loads bootstrap files in each subfolder. These bootstrap files are passed their relative path so that they can load their own files in whatever order they want to, and have as many subfolders of their own as required. Obviously there needs to be a system where one "plugin" is aware of other "plugins", but this can be solved too. I'm going to make a separate thread about this stuff very soon, instead of hijacking this one 🙂

Original thread: https://forums.rpgmakerweb.com/threads/tutorial-ruby-coding-environment-alternatives.20422/