Tutorial: Ruby Coding Environment Alternatives

BadMinotaur

You can do it!
Veteran
Joined
Mar 13, 2012
Messages
260
Reaction score
115
First Language
English
Primarily Uses
RMVXA
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 :p ).
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.
 
Last edited by a moderator:

Gump

War Veteran
Veteran
Joined
Mar 14, 2013
Messages
43
Reaction score
10
First Language
English
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.
 

Gump

War Veteran
Veteran
Joined
Mar 14, 2013
Messages
43
Reaction score
10
First Language
English
Primarily Uses
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.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.
 
Last edited by a moderator:

TroyZ

The Slayer
Veteran
Joined
Jun 18, 2013
Messages
74
Reaction score
5
First Language
Indonesian
Primarily Uses
RMVXA
this happens when i tried with encrypted archive. i tried it in vxace



require, load, it didn't seem to work with encrypted archive
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.
 
Last edited by a moderator:

TroyZ

The Slayer
Veteran
Joined
Jun 18, 2013
Messages
74
Reaction score
5
First Language
Indonesian
Primarily Uses
RMVXA
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?
 

TroyZ

The Slayer
Veteran
Joined
Jun 18, 2013
Messages
74
Reaction score
5
First Language
Indonesian
Primarily Uses
RMVXA
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 :D

EDIT AGAIN

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

 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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).
 
Last edited by a moderator:

TroyZ

The Slayer
Veteran
Joined
Jun 18, 2013
Messages
74
Reaction score
5
First Language
Indonesian
Primarily Uses
RMVXA
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:
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.
 
Last edited by a moderator:

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
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
 
Last edited by a moderator:

Gump

War Veteran
Veteran
Joined
Mar 14, 2013
Messages
43
Reaction score
10
First Language
English
Primarily Uses
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.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
You will probably still need to specify the order that the scripts should be loaded, however.
 

TroyZ

The Slayer
Veteran
Joined
Jun 18, 2013
Messages
74
Reaction score
5
First Language
Indonesian
Primarily Uses
RMVXA
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
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
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 :)
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,854
Messages
1,016,998
Members
137,562
Latest member
tamedeathman
Top