Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-29-2008, 08:34 PM
TheStan TheStan is offline
Stan?
Join Date: May 2008
Location: U.S.
Posts: 100
TheStan is on a distinguished road
Send a message via AIM to TheStan Send a message via MSN to TheStan
File Functions

Recently, I found a need for a few quick access file functions. They may or may not help you but I thought it would be helpful to release to the public.

I replaced the percent signs with "#" signs. For the problem with the request error.

PHP Code:
public function getfolder(folder) {
  
temp.folder.loadfolder(folder "*"0);
  return 
temp.folder;
}
public function 
getfilelines(file) {
  
temp.lines.loadlines(file);
  return 
temp.lines;
}
public function 
getfilevars(file) {
  
temp.vars = new TStaticVar();
  
temp.vars.loadvars(file0);
  return 
temp.vars.getdynamicvarnames();
}
public function 
garbagecollect(foldfiletype) {
  
temp.folder null;
  
temp.null;
  
temp.file null;
  
  
folder.loadfolder(format("#s*.#s"foldfiletype), 0);
  echo(
folder);
  for (
ffolder) {
    if (
filesize(format("#s#s"foldf)) < 1) {
      
//deletefile(folder @ f);
      //deletefile(f);
    
}
    else {
      
file = new TStaticVar();
      
file.loadvars(format("#s#s"foldf));
      
      if (
file.getdynamicvarnames().size() < 1) {
        
//deletefile(folder @ f);
        //deletefile(f);
      
}
    }
  }

Determine whether or not you like the code through the reputation.
Reply With Quote
  #2  
Old 06-29-2008, 09:05 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
uh what about the last function?
echo?
commented out delete file? o.o
__________________
Reply With Quote
  #3  
Old 06-29-2008, 11:07 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Uh, okay? Always nice to have more code gallery additions It's not worth repping though.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #4  
Old 06-29-2008, 11:57 PM
TheStan TheStan is offline
Stan?
Join Date: May 2008
Location: U.S.
Posts: 100
TheStan is on a distinguished road
Send a message via AIM to TheStan Send a message via MSN to TheStan
Quote:
Originally Posted by projectigi View Post
uh what about the last function?
echo?
commented out delete file? o.o
I commented out delete file because I'm not sure which one is the proper way, with the filepath or just the file name.

Quote:
Originally Posted by Tigairius View Post
Uh, okay? Always nice to have more code gallery additions It's not worth repping though.
Lmao, rightyo Tig.
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 05:57 AM.


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