Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Level Copy // No scripts (https://forums.graalonline.com/forums/showthread.php?t=77970)

xAndrewx 12-18-2007 11:05 PM

Level Copy // No scripts
 
Description:
Copys levels from one folder in to another folder, without the scripts! It's magic


How-to:
this.structure = "levels/levels/overworld/";
The current folder that the levels are in

this.newfolder = "levels/newLevels";
The new folder that the levels will be placed in

Code: [Place as a Database NPC]
PHP Code:

function onCreated() {
  
this.structure "levels/levels/overworld/";
  
temp.folder.loadfolder(this.structure "*"0);
  
this.newfolder "levels/newLevels";
  
  
this.onScan(temp.folder);
}

function 
onScan(folder) {  
  for (
temp.0temp.999temp.g++) {
    if (
temp.temp.folder.size()) {
      break;
    }
    
    
temp.data.loadlines(this.structure temp.folder[temp.g]);
    
    
temp.newfile = new[temp.data.size()];
    
temp.0;

    for (
temp.itemp.data) {     
      if (
temp.i.starts("LIN") || temp.i.starts("BOAR") || temp.i.starts("GLEVN")) {
        
temp.newfile[temp.c] = temp.i;
        
temp.c++;
      }
    }

    for (
temp.temp.ctemp.temp.newfile.size(); temp.i++) {
      
temp.newfile[temp.i] = null;
    }

    
temp.newfile.savelines(this.newfolder temp.folder[temp.g], 0);
    echo(
"Saved:" SPC temp.folder[temp.g]);
    
    
temp.folder.delete(temp.g);
  }
  
  if (
temp.folder.size() > 0) {
    
scheduleevent(1"Scan", {temp.folder});
  } else {
    echo(
"Finished copying levels!");
  }


Oh, and don't forget to give the NPC server rights to each folder!

MysticalDragonP2P 12-18-2007 11:09 PM

Great NPC helped out Bravo Evolved alot A++++. Thank YOU!


All times are GMT +2. The time now is 01:10 AM.

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