Hello people :cutesmile:
Im new to the forum, although I've been using RPG Maker for quite a long time and I've been a user of almost every single RPG maker forum that has ever existed :guffaw: this means I have a fairly decent scripting level, so I'm confident I can follow if anyone wants to help.
Anyway, I registered because I recently decided to start a new RM project, and I'm kinda stuck with RGSS3. So my problem is this:
I want to know if it's possible for RPG Maker to access a folder information, like the number of files inside the folder.
I'm trying to create a custon animation script, that plays videos inside RPG Maker, but since I need to use Alpha channel and whatnot, I decided to separate the videos in individual image files.
What I'm trying to do is for the script to detect the number of frames (files) inside a given folder, and build the video based on that. Is there any way to achieve this?
Any suggestion or input would be much appreciated! ;)
Access folder info
● ARCHIVED · READ-ONLY
-
-
Ruby has a Dir class: http://www.ruby-doc.org/core-1.9.2/Dir.html.
I think you're looking for either ::[] or ::glob. They return an array of filenames and, well, since you're fairly decent at scripting, I guess you know how to get the length of an array. There's your number of files!
Example:
Dir['animations/hugging/frame[0-9][0-9][0-9].png']Dir::entries + Regexp is an alternative as it's easier (not simpler) and mightier than shell globs. -
Note that if you're planning to encrypt your resources, Dir isn't going to help, and the only methods provided for file IO require you to pass in the exact path to the resource.
-
Ha! That's great! I think it worked! I feel like I could really finish this script for once :guffaw: , thank you so much! and specially thank you for the convenient links!Ruby has a Dir class: http://www.ruby-doc.org/core-1.9.2/Dir.html.
I think you're looking for either ::[] or ::glob. They return an array of filenames and, well, since you're fairly decent at scripting, I guess you know how to get the length of an array. There's your number of files!
Example:
Dir['animations/hugging/frame[0-9][0-9][0-9].png']Dir::entries + Regexp is an alternative as it's easier (not simpler) and mightier than shell globs.
:o Wait...I don't get it, I mean, if I give the Dir of a folder within the encrypted file, it can gather info about that specific folder and the files inside. That's possible, right? if not, then like...why? :distrust:Note that if you're planning to encrypt your resources, Dir isn't going to help, and the only methods provided for file IO require you to pass in the exact path to the resource. -
Cause Dir doesn't know how to read the archive.
-
What you can do is compile a ruby readable file which contains an object that has all the paths to the files, which is compiled each time you run the game in test mode. That's how I got around the encryption restrictions with my plugin framework.
-
Hmmm...Sounds a bit tricky, but I'll see what I can do about it.
I just succesfully finished writing the animation script and as of now it's fully functional, so thank you all very much!
For now I'll stick to that and slowly start researching about this file workaround you suggest, or consider leaving the project open, Idk.
Anyway, Thanks a bunch guys! ;)