Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-08-2008, 01:30 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
loadSubFolders(str, int);

I would like to request this EXTREMELY useful function. As of now, I can load a folder's content with loadFolder(str, int); - but that's it. If I have a lot of dynamically created folders (which I do) as subfolders to a folder, there is no way I can find them out at the moment - without resorting to saving the name of each created folder in an array (heaven forbid).

This function would only list the name of the subfolders to the folder sent as parameter.

Example:

PHP Code:
temp.foo loadSubFolders("levels/"0);
echo(
temp.foo); 
Would (on Mythic anyways) echo:

PHP Code:
audioganisgmapsimagesMUDLIBProjectCastleTownrandomizedstafftemplates 


So pwetty pwease, can this be added?

*begs*
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #2  
Old 07-08-2008, 02:01 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Can't you just do loadfolder([str]startfolder,[bool]recursive) and make recursive true? Recursive should grab every single file starting from start folder then all subfolders until it gets everything.
Reply With Quote
  #3  
Old 07-08-2008, 02:12 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Didn't work when I tried it, so I doubt it.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #4  
Old 07-08-2008, 02:15 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
PHP Code:
temp.array.loadfolder("twinny/test/*"1); 
Started at twinny/test/ and managed to grab all the files in the subfolders . Just had to make sure NPC-Server had for twinny/test/* and twinny/test/*/*
Reply With Quote
  #5  
Old 07-08-2008, 02:23 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Twinny View Post
PHP Code:
temp.array.loadfolder("twinny/test/*"1); 
Started at twinny/test/ and managed to grab all the files in the subfolders . Just had to make sure NPC-Server had for twinny/test/* and twinny/test/*/*
Hmph, I see. It didn't work when I did:

PHP Code:
temp.foo.loadFolder("levels/MUDLIB/*.ini"1);
echo(
temp.foo); 
But this solved that issue:

PHP Code:
temp.foo.loadFolder("levels/MUDLIB/*/*.ini"1);
echo(
temp.foo); 
However, I reckon this could still prove a useful function to list what folders there are. No?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #6  
Old 07-08-2008, 07:35 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Loading the files in subfolders works flawlessly for my by setting the second parameter to true.
__________________
Reply With Quote
  #7  
Old 07-08-2008, 07:40 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by cbk1994 View Post
Loading the files in subfolders works flawlessly for my by setting the second parameter to true.
Did you even bother to read my post above your post?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #8  
Old 07-08-2008, 08:11 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by xXziroXx View Post
Did you even bother to read my post above your post?
Yes. I'm saying that I don't need to use the second /* like you have to.
__________________
Reply With Quote
  #9  
Old 07-08-2008, 08:22 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Were you trying it with a file extension? Because, it's when you do that you need that extra /*.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #10  
Old 07-08-2008, 08:23 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by xXziroXx View Post
Were you trying it with a file extension? Because, it's when you do that you need that extra /*.
No ;o

I've just always run my own check (file.ends( ".txt" ))
__________________
Reply With Quote
  #11  
Old 07-08-2008, 08:34 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by cbk1994 View Post
No ;o

I've just always run my own check (file.ends( ".txt" ))
Silly.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #12  
Old 07-09-2008, 10:33 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Folders don't end in .ini so why would they show up?
__________________
Do it with a DON!
Reply With Quote
  #13  
Old 07-09-2008, 01:55 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by zokemon View Post
Folders don't end in .ini so why would they show up?
DAMNIT, people need to learn how to read. -_-


PHP Code:
temp.foo.loadFolder("levels/*.nw"0); 
Will load all .nw files from levels folder.


PHP Code:
temp.foo.loadFolder("levels/*/*.nw"1); 
Will load all .nw files from levels folder, and direct subfolders (not indirect ones though).


PHP Code:
temp.foo.loadFolder("levels/*"0); 
Will load all files from levels folder.


PHP Code:
temp.foo.loadFolder("levels/*"1); 
Will load all files from levels folder and all subfolders.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #14  
Old 07-09-2008, 10:46 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by xXziroXx View Post
DAMNIT, people need to learn how to read. -_-

Stuff
Exactly. Again, why would a folder end in .ini? It makes perfect sense why it doesn't work when you end your wildcard with an extension.
__________________
Do it with a DON!
Reply With Quote
  #15  
Old 07-10-2008, 12:31 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Its a simple concept, loadfolder() will only include filenames that fit the wildcard. So obviously if you do loadfolder("levels/*.nw", 0); its only gonna include nw files in the array, there is no need to use variable.ends() to check extension unless you're dealing with more than one or something. If dealing with more than one it would probably be easier to use more than one loadfolder with different extensions.

Zero I don't think you understand how the function is working.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.