hay, i'm programming in this bgt thingy. But i want an easy bgt file packer where can i get one? thanks!
:D
You are not logged in. Please login or register.
AudioGames.net Forum → Developers room → where can i get an easy file packer?
hay, i'm programming in this bgt thingy. But i want an easy bgt file packer where can i get one? thanks!
I feel like we've been here before; have we been here before?
// Pack all files in a certain directory, recursive.
// This probably needs to be in its own script; pack everything separately from the game, otherwise it will do weird things when someone tries to play it.
// Both parameters here have a default value, so you can just call pack_all().close() and that's everything. You might try pack_all("sounds") if you only want the sounds folder, for example.
pack_file@ pack_all(string top="", pack_file@ ret=null) {
if(@ret==null) {
pack_file temp;
@ret=temp;
ret.create("sounds.dat");
}
// Formatting:
if((top!="")&&(string_right(top, 1)!="/")&&(string_right(top, 1)!="\\")) {
top += "/";
}
string[] dirs=find_directories(top + "*");
string[] files=find_files(top + "*");
for(uint i=0; i<files.length(); i++) {
ret.add_file(top + files[i], top + files[i]); // The filename in the pack matches the filename on the system.
}
for(uint i=0; i<dirs.length(); i++) {
@ret=pack_all(top + dirs[i], ret); // Since ret is a handle, we shouldn't need to save it, but if this doesn't work, try adding @ret= to the start of this line.
}
return ret;
}
void main() {
// Example, packing everything in ./sounds
pack_all("sounds/").close();
}
i don't understand preaty much this CAE thingy
uh, hello?
Save the code I posted and run it. It will pack everything in the sounds folder.
If you want to pack other things, change this line:
pack_all("sounds/").close();
Replacing "sounds/" with the path to the folder to pack. (Or just remove "sounds/" to pack everything under the current folder.)
AudioGames.net Forum → Developers room → where can i get an easy file packer?
Generated in 0.023 seconds (57% PHP - 43% DB) with 11 queries